nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9f0a37425578bde8e448c14de54743b95c6da618
parent 2f6046e6daa9f0391f88d9ffab4aed326814c087
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sun, 21 Mar 2021 21:24:47 +0530

Show number of links and inode num for hard links

Diffstat:
Msrc/nnn.c | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/nnn.c b/src/nnn.c @@ -5688,9 +5688,9 @@ static void statusbar(char *path) { i = readlink(pent->name, g_buf, PATH_MAX); - addstr(coolsize(i >= 0 ? i : pent->size)); + addstr(coolsize(i >= 0 ? i : pent->size)); /* Show symlink size */ - if (i > 1) { + if (i > 1) { /* Show symlink target */ g_buf[i] = '\0'; addstr(" ->"); addstr(g_buf); @@ -5699,6 +5699,18 @@ static void statusbar(char *path) addstr(coolsize(pent->size)); addch(' '); addstr(ptr); + if (pent->flags & HARD_LINK) + { + struct stat sb; + + if (stat(pent->name, &sb) != -1) { + addch(' '); + addstr(xitoa((int)sb.st_nlink)); /* Show number of links */ + addch('-'); + addstr(xitoa((int)sb.st_ino)); /* Show inode number */ + } + } + } addch('\n'); }