mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Show number of links and inode num for hard links
This commit is contained in:
parent
2f6046e6da
commit
9f0a374255
16
src/nnn.c
16
src/nnn.c
|
@ -5688,9 +5688,9 @@ static void statusbar(char *path)
|
||||||
{
|
{
|
||||||
i = readlink(pent->name, g_buf, PATH_MAX);
|
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';
|
g_buf[i] = '\0';
|
||||||
addstr(" ->");
|
addstr(" ->");
|
||||||
addstr(g_buf);
|
addstr(g_buf);
|
||||||
|
@ -5699,6 +5699,18 @@ static void statusbar(char *path)
|
||||||
addstr(coolsize(pent->size));
|
addstr(coolsize(pent->size));
|
||||||
addch(' ');
|
addch(' ');
|
||||||
addstr(ptr);
|
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');
|
addch('\n');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue