diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-04-12 09:17:44 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-04-12 09:17:44 -0400 |
commit | cf6f6bf2501f076160f231de3b5efea804bb72e0 (patch) | |
tree | 2442d2f775fc3a5b194ccfce2569fb6c82e4e930 /ls.c | |
parent | ce021cb8bee8dd2a6e4faf8a05eacdffd7c88787 (diff) |
use two columns for link counts
Diffstat (limited to 'ls.c')
-rw-r--r-- | ls.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -50,6 +50,7 @@ #endif #define SIZEWIDTH (8) +#define LINKWIDTH (2) static enum { ALPHA, @@ -64,7 +65,7 @@ static enum { HIDE_ALL, HIDE_SOME, HIDE_NONE } ls_hidden = HIDE_ALL; static enum { GROUP_NAME, GROUP_ID, GROUP_NONE } ls_group = GROUP_NAME; static enum { OWNER_NAME, OWNER_ID, OWNER_NONE } ls_owner = OWNER_NAME; static enum { MARK_NONE, MARK_DIRS, MARK_ALL } ls_mark = MARK_NONE; -static enum { BLOCKS_NONE, BLOCKS_POSIX, BLOCKS_KIBI } ls_blocks = BLOCKS_NONE; +static enum { BLOCKS_NONE = 0, BLOCKS_POSIX = 512, BLOCKS_KIBI = 1024 } ls_blocks = BLOCKS_NONE; static int ls_print_inodes = 0; static int ls_questionable = 0; @@ -216,8 +217,7 @@ static int ls_dir(const char *dir, int showdirname) } if (ls_blocks != BLOCKS_NONE) { - /* TODO: adjust for BLOCK_KIBI */ - printf("total %ju\n", blocks); + printf("total %ju\n", ls_blocks == BLOCKS_KIBI ? blocks / 2 : blocks); } qsort(files, nfiles, sizeof(*files), ls_compare_files); @@ -352,7 +352,7 @@ static void ls_print_long(size_t n, struct file_info files[static n]) printf("%s ", ls_file_mode(st)); - printf("%ju ", (uintmax_t)st.st_nlink); + printf("%*ju ", LINKWIDTH, (uintmax_t)st.st_nlink); if (ls_owner != OWNER_NONE) { printf("%*s ", - _POSIX_LOGIN_NAME_MAX, |