diff options
-rw-r--r-- | coreutils/ls.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 77fc530d8..c62e84263 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -194,23 +194,18 @@ SPLIT_DIR = 1, | |||
194 | SPLIT_SUBDIR = 2, | 194 | SPLIT_SUBDIR = 2, |
195 | 195 | ||
196 | /* Bits in G.all_fmt: */ | 196 | /* Bits in G.all_fmt: */ |
197 | |||
198 | /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ | ||
199 | /* what file information will be listed */ | ||
200 | LIST_LONG = 1 << 0, /* long listing (-l and equivalents) */ | 197 | LIST_LONG = 1 << 0, /* long listing (-l and equivalents) */ |
201 | LIST_FILETYPE = 1 << 1, /* show / suffix for dirs */ | ||
202 | LIST_CLASSIFY = 1 << 2, /* requires LIST_FILETYPE, also show *,|,@,= suffixes */ | ||
203 | 198 | ||
204 | /* what files will be displayed */ | 199 | /* what files will be displayed */ |
205 | DISP_DIRNAME = 1 << 3, /* 2 or more items? label directories */ | 200 | DISP_DIRNAME = 1 << 1, /* 2 or more items? label directories */ |
206 | DISP_NOLIST = 1 << 4, /* show directory as itself, not contents */ | 201 | DISP_NOLIST = 1 << 2, /* show directory as itself, not contents */ |
207 | DISP_RECURSIVE = 1 << 5, /* show directory and everything below it */ | 202 | DISP_RECURSIVE = 1 << 3, /* show directory and everything below it */ |
208 | DISP_ROWS = 1 << 6, /* print across rows */ | 203 | DISP_ROWS = 1 << 4, /* print across rows */ |
209 | 204 | ||
210 | /* what is the overall style of the listing */ | 205 | /* what is the overall style of the listing */ |
211 | STYLE_COLUMNAR = 1 << 7, /* many records per line */ | 206 | STYLE_COLUMNAR = 1 << 5, /* many records per line */ |
212 | STYLE_LONG = 2 << 8, /* one record per line, extended info */ | 207 | STYLE_LONG = 2 << 5, /* one record per line, extended info */ |
213 | STYLE_SINGLE = 3 << 9, /* one record per line */ | 208 | STYLE_SINGLE = 3 << 5, /* one record per line */ |
214 | STYLE_MASK = STYLE_SINGLE, | 209 | STYLE_MASK = STYLE_SINGLE, |
215 | }; | 210 | }; |
216 | 211 | ||
@@ -311,8 +306,8 @@ static const uint32_t opt_flags[] = { | |||
311 | 0, /* A */ | 306 | 0, /* A */ |
312 | 0, /* k (ignored) */ | 307 | 0, /* k (ignored) */ |
313 | #if ENABLE_FEATURE_LS_FILETYPES | 308 | #if ENABLE_FEATURE_LS_FILETYPES |
314 | LIST_FILETYPE | LIST_CLASSIFY, /* F */ | 309 | 0, /* F */ |
315 | LIST_FILETYPE, /* p */ | 310 | 0, /* p */ |
316 | #endif | 311 | #endif |
317 | #if ENABLE_FEATURE_LS_RECURSIVE | 312 | #if ENABLE_FEATURE_LS_RECURSIVE |
318 | DISP_RECURSIVE, /* R */ | 313 | DISP_RECURSIVE, /* R */ |
@@ -449,11 +444,12 @@ static char bold(mode_t mode) | |||
449 | #if ENABLE_FEATURE_LS_FILETYPES | 444 | #if ENABLE_FEATURE_LS_FILETYPES |
450 | static char append_char(mode_t mode) | 445 | static char append_char(mode_t mode) |
451 | { | 446 | { |
452 | if (!(G.all_fmt & LIST_FILETYPE)) | 447 | if (!(option_mask32 & (OPT_F|OPT_p))) |
453 | return '\0'; | 448 | return '\0'; |
449 | |||
454 | if (S_ISDIR(mode)) | 450 | if (S_ISDIR(mode)) |
455 | return '/'; | 451 | return '/'; |
456 | if (!(G.all_fmt & LIST_CLASSIFY)) | 452 | if (!(option_mask32 & OPT_F)) |
457 | return '\0'; | 453 | return '\0'; |
458 | if (S_ISREG(mode) && (mode & (S_IXUSR | S_IXGRP | S_IXOTH))) | 454 | if (S_ISREG(mode) && (mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
459 | return '*'; | 455 | return '*'; |
@@ -643,7 +639,9 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
643 | if (lpath) { | 639 | if (lpath) { |
644 | printf(" -> "); | 640 | printf(" -> "); |
645 | #if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR | 641 | #if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR |
646 | if ((G.all_fmt & LIST_FILETYPE) || G_show_color) { | 642 | if ((option_mask32 & (OPT_F|OPT_p)) |
643 | || G_show_color | ||
644 | ) { | ||
647 | mode_t mode = dn->dn_mode_stat; | 645 | mode_t mode = dn->dn_mode_stat; |
648 | if (!mode) | 646 | if (!mode) |
649 | if (stat(dn->fullname, &statbuf) == 0) | 647 | if (stat(dn->fullname, &statbuf) == 0) |
@@ -665,7 +663,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) | |||
665 | } | 663 | } |
666 | } | 664 | } |
667 | #if ENABLE_FEATURE_LS_FILETYPES | 665 | #if ENABLE_FEATURE_LS_FILETYPES |
668 | if (G.all_fmt & LIST_FILETYPE) { | 666 | if (option_mask32 & (OPT_F|OPT_p)) { |
669 | if (append) { | 667 | if (append) { |
670 | putchar(append); | 668 | putchar(append); |
671 | column++; | 669 | column++; |