aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-23 20:46:12 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-23 20:46:12 +0100
commit9a64c3337cc0a5e84e9ad457eeb1d475c311e9fc (patch)
treecd43138ae6a3ac7b7ced022d69117503e8dc06fd /coreutils
parentccc1699e3ec5ae0ec43a24fcad58c110f6f8360c (diff)
downloadbusybox-w32-9a64c3337cc0a5e84e9ad457eeb1d475c311e9fc.tar.gz
busybox-w32-9a64c3337cc0a5e84e9ad457eeb1d475c311e9fc.tar.bz2
busybox-w32-9a64c3337cc0a5e84e9ad457eeb1d475c311e9fc.zip
ls: convert DISP_DIRNAME to a bool variable
function old new delta ls_main 553 548 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index f90784a1a..a858a3217 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -192,10 +192,6 @@ TERMINAL_WIDTH = 80, /* use 79 if terminal has linefold bug */
192SPLIT_FILE = 0, 192SPLIT_FILE = 0,
193SPLIT_DIR = 1, 193SPLIT_DIR = 1,
194SPLIT_SUBDIR = 2, 194SPLIT_SUBDIR = 2,
195
196/* Bits in G.all_fmt: */
197/* what files will be displayed */
198DISP_DIRNAME = 1 << 9, /* 2 or more items? label directories */
199}; 195};
200 196
201/* -Cadi1l Std options, busybox always supports */ 197/* -Cadi1l Std options, busybox always supports */
@@ -330,7 +326,7 @@ struct globals {
330# define G_show_color 0 326# define G_show_color 0
331#endif 327#endif
332 smallint exit_code; 328 smallint exit_code;
333 unsigned all_fmt; 329 smallint show_dirname;
334#if ENABLE_FEATURE_LS_WIDTH 330#if ENABLE_FEATURE_LS_WIDTH
335 unsigned terminal_width; 331 unsigned terminal_width;
336# define G_terminal_width (G.terminal_width) 332# define G_terminal_width (G.terminal_width)
@@ -1010,9 +1006,7 @@ static void scan_and_display_dirs_recur(struct dnode **dn, int first)
1010 struct dnode **subdnp; 1006 struct dnode **subdnp;
1011 1007
1012 for (; *dn; dn++) { 1008 for (; *dn; dn++) {
1013 if ((G.all_fmt & DISP_DIRNAME) 1009 if (G.show_dirname || (option_mask32 & OPT_R)) {
1014 || (option_mask32 & OPT_R)
1015 ) {
1016 if (!first) 1010 if (!first)
1017 bb_putchar('\n'); 1011 bb_putchar('\n');
1018 first = 0; 1012 first = 0;
@@ -1186,7 +1180,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1186 *--argv = (char*)"."; 1180 *--argv = (char*)".";
1187 1181
1188 if (argv[1]) 1182 if (argv[1])
1189 G.all_fmt |= DISP_DIRNAME; /* 2 or more items? label directories */ 1183 G.show_dirname = 1; /* 2 or more items? label directories */
1190 1184
1191 /* stuff the command line file names into a dnode array */ 1185 /* stuff the command line file names into a dnode array */
1192 dn = NULL; 1186 dn = NULL;