mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Do not count hard links for dirs
This commit is contained in:
parent
9c100f987c
commit
fc805dac26
13
src/nnn.c
13
src/nnn.c
|
@ -3175,7 +3175,7 @@ static void printent(const struct entry *ent, uint namecols, bool sel)
|
||||||
char ind = get_ind(ent->mode, FALSE);
|
char ind = get_ind(ent->mode, FALSE);
|
||||||
int attrs = sel ? A_REVERSE : 0;
|
int attrs = sel ? A_REVERSE : 0;
|
||||||
|
|
||||||
if ((S_ISREG(ent->mode) && (ent->flags & HARD_LINK)) || ind == '@')
|
if (ind == '@' || (ent->flags & HARD_LINK))
|
||||||
attrs |= A_DIM;
|
attrs |= A_DIM;
|
||||||
|
|
||||||
if (!ind)
|
if (!ind)
|
||||||
|
@ -4204,8 +4204,8 @@ static void launch_app(const char *path, char *newpath)
|
||||||
|
|
||||||
static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
|
static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
|
||||||
{
|
{
|
||||||
if (sb->st_blocks && (typeflag == FTW_F || typeflag == FTW_D)
|
if (sb->st_blocks && (typeflag == FTW_D
|
||||||
&& (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))
|
|| (typeflag == FTW_F && (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))))
|
||||||
ent_blocks += sb->st_blocks;
|
ent_blocks += sb->st_blocks;
|
||||||
|
|
||||||
++num_files;
|
++num_files;
|
||||||
|
@ -4214,8 +4214,8 @@ static int sum_bsize(const char *UNUSED(fpath), const struct stat *sb, int typef
|
||||||
|
|
||||||
static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
|
static int sum_asize(const char *UNUSED(fpath), const struct stat *sb, int typeflag, struct FTW *UNUSED(ftwbuf))
|
||||||
{
|
{
|
||||||
if (sb->st_size && (typeflag == FTW_F || typeflag == FTW_D)
|
if (sb->st_size && (typeflag == FTW_D
|
||||||
&& (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))
|
|| (typeflag == FTW_D && (sb->st_nlink <= 1 || test_set_bit((uint)sb->st_ino)))))
|
||||||
ent_blocks += sb->st_size;
|
ent_blocks += sb->st_size;
|
||||||
|
|
||||||
++num_files;
|
++num_files;
|
||||||
|
@ -4412,7 +4412,8 @@ 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 = (sb.st_nlink > 1) ? HARD_LINK : 0;
|
dentp->flags = S_ISDIR(sb.st_mode) ? 0 : ((sb.st_nlink > 1) ? HARD_LINK : 0);
|
||||||
|
DPRINTF_D(dentp->flags);
|
||||||
|
|
||||||
if (cfg.blkorder) {
|
if (cfg.blkorder) {
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
|
Loading…
Reference in a new issue