diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-23 18:34:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-23 18:34:11 +0100 |
commit | b60686cc2a9550527a548f9e52ff4dd96bdfe222 (patch) | |
tree | edc46d8c4c4dd18e608e70fa41d007c5b2a88f95 /coreutils/ls.c | |
parent | f5bd6f631c22530698024afb595418f156e48261 (diff) | |
download | busybox-w32-b60686cc2a9550527a548f9e52ff4dd96bdfe222.tar.gz busybox-w32-b60686cc2a9550527a548f9e52ff4dd96bdfe222.tar.bz2 busybox-w32-b60686cc2a9550527a548f9e52ff4dd96bdfe222.zip |
ls: handle -i through option_mask32
function old new delta
sort_and_display_files 420 424 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r-- | coreutils/ls.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index d11019f7d..7ed6a1fdc 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -198,7 +198,6 @@ SPLIT_SUBDIR = 2, | |||
198 | 198 | ||
199 | /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ | 199 | /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ |
200 | /* what file information will be listed */ | 200 | /* what file information will be listed */ |
201 | LIST_INO = 1 << 0, | ||
202 | LIST_BLOCKS = 1 << 1, | 201 | LIST_BLOCKS = 1 << 1, |
203 | LIST_MODEBITS = 1 << 2, | 202 | LIST_MODEBITS = 1 << 2, |
204 | LIST_NLINKS = 1 << 3, | 203 | LIST_NLINKS = 1 << 3, |
@@ -258,7 +257,7 @@ enum { | |||
258 | //OPT_C = (1 << 0), | 257 | //OPT_C = (1 << 0), |
259 | OPT_a = (1 << 1), | 258 | OPT_a = (1 << 1), |
260 | //OPT_d = (1 << 2), | 259 | //OPT_d = (1 << 2), |
261 | //OPT_i = (1 << 3), | 260 | OPT_i = (1 << 3), |
262 | //OPT_1 = (1 << 4), | 261 | //OPT_1 = (1 << 4), |
263 | OPT_l = (1 << 5), | 262 | OPT_l = (1 << 5), |
264 | OPT_g = (1 << 6), | 263 | OPT_g = (1 << 6), |
@@ -317,7 +316,7 @@ static const uint32_t opt_flags[] = { | |||
317 | STYLE_COLUMNAR, /* C */ | 316 | STYLE_COLUMNAR, /* C */ |
318 | 0, /* a */ | 317 | 0, /* a */ |
319 | DISP_NOLIST, /* d */ | 318 | DISP_NOLIST, /* d */ |
320 | LIST_INO, /* i */ | 319 | 0, /* i */ |
321 | STYLE_SINGLE, /* 1 */ | 320 | STYLE_SINGLE, /* 1 */ |
322 | LIST_LONG | STYLE_LONG, /* l - by keeping it after -1, "ls -l -1" ignores -1 */ | 321 | LIST_LONG | STYLE_LONG, /* l - by keeping it after -1, "ls -l -1" ignores -1 */ |
323 | LIST_LONG | STYLE_LONG, /* g (don't show owner) - handled via OPT_g. assumes l */ | 322 | LIST_LONG | STYLE_LONG, /* g (don't show owner) - handled via OPT_g. assumes l */ |
@@ -557,7 +556,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
557 | if (S_ISLNK(dn->dn_mode)) | 556 | if (S_ISLNK(dn->dn_mode)) |
558 | lpath = xmalloc_readlink_or_warn(dn->fullname); | 557 | lpath = xmalloc_readlink_or_warn(dn->fullname); |
559 | 558 | ||
560 | if (G.all_fmt & LIST_INO) | 559 | if (option_mask32 & OPT_i) /* list inodes */ |
561 | column += printf("%7llu ", (long long) dn->dn_ino); | 560 | column += printf("%7llu ", (long long) dn->dn_ino); |
562 | //TODO: -h should affect -s too: | 561 | //TODO: -h should affect -s too: |
563 | if (G.all_fmt & LIST_BLOCKS) | 562 | if (G.all_fmt & LIST_BLOCKS) |
@@ -707,8 +706,8 @@ static void display_files(struct dnode **dn, unsigned nfiles) | |||
707 | } | 706 | } |
708 | column_width += 2 + | 707 | column_width += 2 + |
709 | IF_SELINUX( ((G.all_fmt & LIST_CONTEXT) ? 33 : 0) + ) | 708 | IF_SELINUX( ((G.all_fmt & LIST_CONTEXT) ? 33 : 0) + ) |
710 | ((G.all_fmt & LIST_INO) ? 8 : 0) + | 709 | ((option_mask32 & OPT_i) ? 8 : 0) /* inode# width */ |
711 | ((G.all_fmt & LIST_BLOCKS) ? 5 : 0); | 710 | + ((G.all_fmt & LIST_BLOCKS) ? 5 : 0); |
712 | ncols = (unsigned)G_terminal_width / column_width; | 711 | ncols = (unsigned)G_terminal_width / column_width; |
713 | } | 712 | } |
714 | 713 | ||