diff options
author | James Youngman <jay@gnu.org> | 2010-12-20 01:36:16 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-12-20 01:36:16 +0100 |
commit | a4bc10cec7645d72c7284deec070c0f56ebdadaf (patch) | |
tree | 51c12d85e77a8e1d0bb25919be069d362d7317eb /coreutils | |
parent | 982aa263a0cef10ee4f4c06084a87af736c449ac (diff) | |
download | busybox-w32-a4bc10cec7645d72c7284deec070c0f56ebdadaf.tar.gz busybox-w32-a4bc10cec7645d72c7284deec070c0f56ebdadaf.tar.bz2 busybox-w32-a4bc10cec7645d72c7284deec070c0f56ebdadaf.zip |
ls: remove redundant constants LIST_FILENAME and LIST_SHORT
LIST_FILENAME is always true and LIST_SHORT affects nothing.
Signed-off-by: James Youngman <jay@gnu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index d27c36ddc..2be3afadf 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -135,51 +135,48 @@ LIST_ID_NAME = 1 << 4, | |||
135 | LIST_ID_NUMERIC = 1 << 5, | 135 | LIST_ID_NUMERIC = 1 << 5, |
136 | LIST_CONTEXT = 1 << 6, | 136 | LIST_CONTEXT = 1 << 6, |
137 | LIST_SIZE = 1 << 7, | 137 | LIST_SIZE = 1 << 7, |
138 | //LIST_DEV = 1 << 8, - unused, synonym to LIST_SIZE | 138 | LIST_DATE_TIME = 1 << 8, |
139 | LIST_DATE_TIME = 1 << 9, | 139 | LIST_FULLTIME = 1 << 9, |
140 | LIST_FULLTIME = 1 << 10, | 140 | LIST_SYMLINK = 1 << 10, |
141 | LIST_FILENAME = 1 << 11, | 141 | LIST_FILETYPE = 1 << 11, |
142 | LIST_SYMLINK = 1 << 12, | 142 | LIST_EXEC = 1 << 12, |
143 | LIST_FILETYPE = 1 << 13, | ||
144 | LIST_EXEC = 1 << 14, | ||
145 | LIST_MASK = (LIST_EXEC << 1) - 1, | 143 | LIST_MASK = (LIST_EXEC << 1) - 1, |
146 | 144 | ||
147 | /* what files will be displayed */ | 145 | /* what files will be displayed */ |
148 | DISP_DIRNAME = 1 << 15, /* 2 or more items? label directories */ | 146 | DISP_DIRNAME = 1 << 13, /* 2 or more items? label directories */ |
149 | DISP_HIDDEN = 1 << 16, /* show filenames starting with . */ | 147 | DISP_HIDDEN = 1 << 14, /* show filenames starting with . */ |
150 | DISP_DOT = 1 << 17, /* show . and .. */ | 148 | DISP_DOT = 1 << 15, /* show . and .. */ |
151 | DISP_NOLIST = 1 << 18, /* show directory as itself, not contents */ | 149 | DISP_NOLIST = 1 << 16, /* show directory as itself, not contents */ |
152 | DISP_RECURSIVE = 1 << 19, /* show directory and everything below it */ | 150 | DISP_RECURSIVE = 1 << 17, /* show directory and everything below it */ |
153 | DISP_ROWS = 1 << 20, /* print across rows */ | 151 | DISP_ROWS = 1 << 18, /* print across rows */ |
154 | DISP_MASK = ((DISP_ROWS << 1) - 1) & ~(DISP_DIRNAME - 1), | 152 | DISP_MASK = ((DISP_ROWS << 1) - 1) & ~(DISP_DIRNAME - 1), |
155 | 153 | ||
156 | /* what is the overall style of the listing */ | 154 | /* what is the overall style of the listing */ |
157 | STYLE_COLUMNAR = 1 << 21, /* many records per line */ | 155 | STYLE_COLUMNAR = 1 << 19, /* many records per line */ |
158 | STYLE_LONG = 2 << 21, /* one record per line, extended info */ | 156 | STYLE_LONG = 2 << 19, /* one record per line, extended info */ |
159 | STYLE_SINGLE = 3 << 21, /* one record per line */ | 157 | STYLE_SINGLE = 3 << 19, /* one record per line */ |
160 | STYLE_MASK = STYLE_SINGLE, | 158 | STYLE_MASK = STYLE_SINGLE, |
161 | 159 | ||
162 | /* which of the three times will be used */ | 160 | /* which of the three times will be used */ |
163 | TIME_CHANGE = (1 << 23) * ENABLE_FEATURE_LS_TIMESTAMPS, | 161 | TIME_CHANGE = (1 << 21) * ENABLE_FEATURE_LS_TIMESTAMPS, |
164 | TIME_ACCESS = (1 << 24) * ENABLE_FEATURE_LS_TIMESTAMPS, | 162 | TIME_ACCESS = (1 << 22) * ENABLE_FEATURE_LS_TIMESTAMPS, |
165 | TIME_MASK = (3 << 23) * ENABLE_FEATURE_LS_TIMESTAMPS, | 163 | TIME_MASK = (3 << 21) * ENABLE_FEATURE_LS_TIMESTAMPS, |
166 | 164 | ||
167 | /* how will the files be sorted (CONFIG_FEATURE_LS_SORTFILES) */ | 165 | /* how will the files be sorted (CONFIG_FEATURE_LS_SORTFILES) */ |
168 | SORT_REVERSE = 1 << 25, | 166 | SORT_REVERSE = 1 << 23, |
169 | 167 | ||
170 | SORT_NAME = 0, /* sort by file name */ | 168 | SORT_NAME = 0, /* sort by file name */ |
171 | SORT_SIZE = 1 << 26, /* sort by file size */ | 169 | SORT_SIZE = 1 << 24, /* sort by file size */ |
172 | SORT_ATIME = 2 << 26, /* sort by last access time */ | 170 | SORT_ATIME = 2 << 24, /* sort by last access time */ |
173 | SORT_CTIME = 3 << 26, /* sort by last change time */ | 171 | SORT_CTIME = 3 << 24, /* sort by last change time */ |
174 | SORT_MTIME = 4 << 26, /* sort by last modification time */ | 172 | SORT_MTIME = 4 << 24, /* sort by last modification time */ |
175 | SORT_VERSION = 5 << 26, /* sort by version */ | 173 | SORT_VERSION = 5 << 24, /* sort by version */ |
176 | SORT_EXT = 6 << 26, /* sort by file name extension */ | 174 | SORT_EXT = 6 << 24, /* sort by file name extension */ |
177 | SORT_DIR = 7 << 26, /* sort by file or directory */ | 175 | SORT_DIR = 7 << 24, /* sort by file or directory */ |
178 | SORT_MASK = (7 << 26) * ENABLE_FEATURE_LS_SORTFILES, | 176 | SORT_MASK = (7 << 24) * ENABLE_FEATURE_LS_SORTFILES, |
179 | 177 | ||
180 | LIST_SHORT = LIST_FILENAME, | ||
181 | LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ | 178 | LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ |
182 | LIST_DATE_TIME | LIST_FILENAME | LIST_SYMLINK, | 179 | LIST_DATE_TIME | LIST_SYMLINK, |
183 | }; | 180 | }; |
184 | 181 | ||
185 | /* -Cadil1 Std options, busybox always supports */ | 182 | /* -Cadil1 Std options, busybox always supports */ |
@@ -265,16 +262,16 @@ enum { | |||
265 | 262 | ||
266 | /* TODO: simple toggles may be stored as OPT_xxx bits instead */ | 263 | /* TODO: simple toggles may be stored as OPT_xxx bits instead */ |
267 | static const uint32_t opt_flags[] = { | 264 | static const uint32_t opt_flags[] = { |
268 | LIST_SHORT | STYLE_COLUMNAR, /* C */ | 265 | STYLE_COLUMNAR, /* C */ |
269 | DISP_HIDDEN | DISP_DOT, /* a */ | 266 | DISP_HIDDEN | DISP_DOT, /* a */ |
270 | DISP_NOLIST, /* d */ | 267 | DISP_NOLIST, /* d */ |
271 | LIST_INO, /* i */ | 268 | LIST_INO, /* i */ |
272 | LIST_LONG | STYLE_LONG, /* l */ | 269 | LIST_LONG | STYLE_LONG, /* l */ |
273 | LIST_SHORT | STYLE_SINGLE, /* 1 */ | 270 | STYLE_SINGLE, /* 1 */ |
274 | 0, /* g (don't show owner) - handled via OPT_g */ | 271 | 0, /* g (don't show owner) - handled via OPT_g */ |
275 | LIST_ID_NUMERIC, /* n */ | 272 | LIST_ID_NUMERIC, /* n */ |
276 | LIST_BLOCKS, /* s */ | 273 | LIST_BLOCKS, /* s */ |
277 | LIST_SHORT | DISP_ROWS | STYLE_COLUMNAR, /* x */ | 274 | DISP_ROWS | STYLE_COLUMNAR, /* x */ |
278 | 0, /* Q (quote filename) - handled via OPT_Q */ | 275 | 0, /* Q (quote filename) - handled via OPT_Q */ |
279 | DISP_HIDDEN, /* A */ | 276 | DISP_HIDDEN, /* A */ |
280 | ENABLE_SELINUX * LIST_CONTEXT, /* k (ignored if !SELINUX) */ | 277 | ENABLE_SELINUX * LIST_CONTEXT, /* k (ignored if !SELINUX) */ |
@@ -711,7 +708,7 @@ static NOINLINE unsigned list_single(const struct dnode *dn) | |||
711 | (int) dn->dstat.st_uid, | 708 | (int) dn->dstat.st_uid, |
712 | (int) dn->dstat.st_gid); | 709 | (int) dn->dstat.st_gid); |
713 | } | 710 | } |
714 | if (all_fmt & (LIST_SIZE /*|LIST_DEV*/ )) { | 711 | if (all_fmt & LIST_SIZE) { |
715 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { | 712 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { |
716 | column += printf("%4u, %3u ", | 713 | column += printf("%4u, %3u ", |
717 | (int) major(dn->dstat.st_rdev), | 714 | (int) major(dn->dstat.st_rdev), |
@@ -759,20 +756,20 @@ static NOINLINE unsigned list_single(const struct dnode *dn) | |||
759 | freecon(dn->sid); | 756 | freecon(dn->sid); |
760 | } | 757 | } |
761 | #endif | 758 | #endif |
762 | if (all_fmt & LIST_FILENAME) { | 759 | |
763 | #if ENABLE_FEATURE_LS_COLOR | 760 | #if ENABLE_FEATURE_LS_COLOR |
764 | if (show_color) { | 761 | if (show_color) { |
765 | info.st_mode = 0; /* for fgcolor() */ | 762 | info.st_mode = 0; /* for fgcolor() */ |
766 | lstat(dn->fullname, &info); | 763 | lstat(dn->fullname, &info); |
767 | printf("\033[%u;%um", bold(info.st_mode), | 764 | printf("\033[%u;%um", bold(info.st_mode), |
768 | fgcolor(info.st_mode)); | 765 | fgcolor(info.st_mode)); |
769 | } | 766 | } |
770 | #endif | 767 | #endif |
771 | column += print_name(dn->name); | 768 | column += print_name(dn->name); |
772 | if (show_color) { | 769 | if (show_color) { |
773 | printf("\033[0m"); | 770 | printf("\033[0m"); |
774 | } | ||
775 | } | 771 | } |
772 | |||
776 | if (all_fmt & LIST_SYMLINK) { | 773 | if (all_fmt & LIST_SYMLINK) { |
777 | if (S_ISLNK(dn->dstat.st_mode) && lpath) { | 774 | if (S_ISLNK(dn->dstat.st_mode) && lpath) { |
778 | printf(" -> "); | 775 | printf(" -> "); |
@@ -1043,7 +1040,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
1043 | 1040 | ||
1044 | init_unicode(); | 1041 | init_unicode(); |
1045 | 1042 | ||
1046 | all_fmt = LIST_SHORT | (ENABLE_FEATURE_LS_SORTFILES * SORT_NAME); | 1043 | all_fmt = ENABLE_FEATURE_LS_SORTFILES * SORT_NAME; |
1047 | 1044 | ||
1048 | #if ENABLE_FEATURE_AUTOWIDTH | 1045 | #if ENABLE_FEATURE_AUTOWIDTH |
1049 | /* obtain the terminal width */ | 1046 | /* obtain the terminal width */ |