mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Show hard link symbol
This commit is contained in:
parent
4a91df950b
commit
d0930d0ccf
22
src/nnn.c
22
src/nnn.c
|
@ -173,7 +173,8 @@
|
||||||
#define _FAILURE !_SUCCESS
|
#define _FAILURE !_SUCCESS
|
||||||
|
|
||||||
/* Entry flags */
|
/* Entry flags */
|
||||||
#define DIR_OR_LINK_TO_DIR 0x1
|
#define DIR_OR_LINK_TO_DIR 0x01
|
||||||
|
#define HARD_LINK 0x02
|
||||||
#define FILE_SELECTED 0x10
|
#define FILE_SELECTED 0x10
|
||||||
|
|
||||||
/* Macros to define process spawn behaviour as flags */
|
/* Macros to define process spawn behaviour as flags */
|
||||||
|
@ -3150,9 +3151,14 @@ static void printent(const struct entry *ent, uint namecols, bool sel)
|
||||||
{
|
{
|
||||||
wchar_t *wstr;
|
wchar_t *wstr;
|
||||||
char ind = '\0';
|
char ind = '\0';
|
||||||
|
char hln = '\0';
|
||||||
|
|
||||||
switch (ent->mode & S_IFMT) {
|
switch (ent->mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
|
if (ent->flags & HARD_LINK) {
|
||||||
|
hln = '>';
|
||||||
|
--namecols;
|
||||||
|
}
|
||||||
if (ent->mode & 0100)
|
if (ent->mode & 0100)
|
||||||
ind = '*';
|
ind = '*';
|
||||||
break;
|
break;
|
||||||
|
@ -3191,6 +3197,8 @@ static void printent(const struct entry *ent, uint namecols, bool sel)
|
||||||
addwstr(wstr);
|
addwstr(wstr);
|
||||||
if (ind)
|
if (ind)
|
||||||
addch(ind);
|
addch(ind);
|
||||||
|
if (hln)
|
||||||
|
addch(hln);
|
||||||
addch('\n');
|
addch('\n');
|
||||||
|
|
||||||
if (sel)
|
if (sel)
|
||||||
|
@ -3227,12 +3235,10 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)
|
||||||
|
|
||||||
switch (ent->mode & S_IFMT) {
|
switch (ent->mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
if (ent->mode & 0100)
|
printw("%c%-16.16s %s %8.8s%s %s%s\n", cp, timebuf, permbuf,
|
||||||
printw("%c%-16.16s %s %8.8s* %s*\n", cp, timebuf, permbuf,
|
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size),
|
||||||
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size), pname);
|
((ent->flags & HARD_LINK) ? ">" : " "), pname,
|
||||||
else
|
((ent->mode & 0100) ? "*" : ""));
|
||||||
printw("%c%-16.16s %s %8.8s %s\n", cp, timebuf, permbuf,
|
|
||||||
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size), pname);
|
|
||||||
break;
|
break;
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
printw("%c%-16.16s %s %8.8s %s/\n", cp, timebuf, permbuf,
|
printw("%c%-16.16s %s %8.8s %s/\n", cp, timebuf, permbuf,
|
||||||
|
@ -4401,7 +4407,7 @@ static int dentfill(char *path, struct entry **dents)
|
||||||
dentp->mode = sb.st_mode;
|
dentp->mode = sb.st_mode;
|
||||||
dentp->size = sb.st_size;
|
dentp->size = sb.st_size;
|
||||||
#endif
|
#endif
|
||||||
dentp->flags = 0;
|
dentp->flags = (sb.st_nlink > 1) ? HARD_LINK : 0;
|
||||||
|
|
||||||
if (cfg.blkorder) {
|
if (cfg.blkorder) {
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
|
Loading…
Reference in a new issue