]> Sergey Matveev's repositories - nnn.git/commitdiff
Show number of links and inode num for hard links
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 21 Mar 2021 15:54:47 +0000 (21:24 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 21 Mar 2021 15:54:47 +0000 (21:24 +0530)
src/nnn.c

index 4a9bc6747ea1b8e6da2a7bc4201bb09b713ac613..b5172e7e6055e8f189e59a3818a3c4d91b10fd9a 100644 (file)
--- 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');
        }