aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorJames Youngman <jay@gnu.org>2010-12-20 01:36:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-12-20 01:36:16 +0100
commita4bc10cec7645d72c7284deec070c0f56ebdadaf (patch)
tree51c12d85e77a8e1d0bb25919be069d362d7317eb /coreutils
parent982aa263a0cef10ee4f4c06084a87af736c449ac (diff)
downloadbusybox-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.c91
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,
135LIST_ID_NUMERIC = 1 << 5, 135LIST_ID_NUMERIC = 1 << 5,
136LIST_CONTEXT = 1 << 6, 136LIST_CONTEXT = 1 << 6,
137LIST_SIZE = 1 << 7, 137LIST_SIZE = 1 << 7,
138//LIST_DEV = 1 << 8, - unused, synonym to LIST_SIZE 138LIST_DATE_TIME = 1 << 8,
139LIST_DATE_TIME = 1 << 9, 139LIST_FULLTIME = 1 << 9,
140LIST_FULLTIME = 1 << 10, 140LIST_SYMLINK = 1 << 10,
141LIST_FILENAME = 1 << 11, 141LIST_FILETYPE = 1 << 11,
142LIST_SYMLINK = 1 << 12, 142LIST_EXEC = 1 << 12,
143LIST_FILETYPE = 1 << 13,
144LIST_EXEC = 1 << 14,
145LIST_MASK = (LIST_EXEC << 1) - 1, 143LIST_MASK = (LIST_EXEC << 1) - 1,
146 144
147/* what files will be displayed */ 145/* what files will be displayed */
148DISP_DIRNAME = 1 << 15, /* 2 or more items? label directories */ 146DISP_DIRNAME = 1 << 13, /* 2 or more items? label directories */
149DISP_HIDDEN = 1 << 16, /* show filenames starting with . */ 147DISP_HIDDEN = 1 << 14, /* show filenames starting with . */
150DISP_DOT = 1 << 17, /* show . and .. */ 148DISP_DOT = 1 << 15, /* show . and .. */
151DISP_NOLIST = 1 << 18, /* show directory as itself, not contents */ 149DISP_NOLIST = 1 << 16, /* show directory as itself, not contents */
152DISP_RECURSIVE = 1 << 19, /* show directory and everything below it */ 150DISP_RECURSIVE = 1 << 17, /* show directory and everything below it */
153DISP_ROWS = 1 << 20, /* print across rows */ 151DISP_ROWS = 1 << 18, /* print across rows */
154DISP_MASK = ((DISP_ROWS << 1) - 1) & ~(DISP_DIRNAME - 1), 152DISP_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 */
157STYLE_COLUMNAR = 1 << 21, /* many records per line */ 155STYLE_COLUMNAR = 1 << 19, /* many records per line */
158STYLE_LONG = 2 << 21, /* one record per line, extended info */ 156STYLE_LONG = 2 << 19, /* one record per line, extended info */
159STYLE_SINGLE = 3 << 21, /* one record per line */ 157STYLE_SINGLE = 3 << 19, /* one record per line */
160STYLE_MASK = STYLE_SINGLE, 158STYLE_MASK = STYLE_SINGLE,
161 159
162/* which of the three times will be used */ 160/* which of the three times will be used */
163TIME_CHANGE = (1 << 23) * ENABLE_FEATURE_LS_TIMESTAMPS, 161TIME_CHANGE = (1 << 21) * ENABLE_FEATURE_LS_TIMESTAMPS,
164TIME_ACCESS = (1 << 24) * ENABLE_FEATURE_LS_TIMESTAMPS, 162TIME_ACCESS = (1 << 22) * ENABLE_FEATURE_LS_TIMESTAMPS,
165TIME_MASK = (3 << 23) * ENABLE_FEATURE_LS_TIMESTAMPS, 163TIME_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) */
168SORT_REVERSE = 1 << 25, 166SORT_REVERSE = 1 << 23,
169 167
170SORT_NAME = 0, /* sort by file name */ 168SORT_NAME = 0, /* sort by file name */
171SORT_SIZE = 1 << 26, /* sort by file size */ 169SORT_SIZE = 1 << 24, /* sort by file size */
172SORT_ATIME = 2 << 26, /* sort by last access time */ 170SORT_ATIME = 2 << 24, /* sort by last access time */
173SORT_CTIME = 3 << 26, /* sort by last change time */ 171SORT_CTIME = 3 << 24, /* sort by last change time */
174SORT_MTIME = 4 << 26, /* sort by last modification time */ 172SORT_MTIME = 4 << 24, /* sort by last modification time */
175SORT_VERSION = 5 << 26, /* sort by version */ 173SORT_VERSION = 5 << 24, /* sort by version */
176SORT_EXT = 6 << 26, /* sort by file name extension */ 174SORT_EXT = 6 << 24, /* sort by file name extension */
177SORT_DIR = 7 << 26, /* sort by file or directory */ 175SORT_DIR = 7 << 24, /* sort by file or directory */
178SORT_MASK = (7 << 26) * ENABLE_FEATURE_LS_SORTFILES, 176SORT_MASK = (7 << 24) * ENABLE_FEATURE_LS_SORTFILES,
179 177
180LIST_SHORT = LIST_FILENAME,
181LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ 178LIST_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 */
267static const uint32_t opt_flags[] = { 264static 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 */