diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-22 22:02:19 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-22 22:02:19 +0100 |
commit | e1f90d13fa07d2974908470ce818ef956b7740f2 (patch) | |
tree | 91c246eec97dcd96bc3d97945988a35a53cd74b5 /coreutils/ls.c | |
parent | f580baf94a5ad9cdfed919c17a1a1cdf26089f15 (diff) | |
download | busybox-w32-e1f90d13fa07d2974908470ce818ef956b7740f2.tar.gz busybox-w32-e1f90d13fa07d2974908470ce818ef956b7740f2.tar.bz2 busybox-w32-e1f90d13fa07d2974908470ce818ef956b7740f2.zip |
ls: -1 should be ignored by -l (and options which imply -l)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r-- | coreutils/ls.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index b9d74a2cb..b48df8bf5 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -130,8 +130,8 @@ | |||
130 | //usage: "\n -n List numeric UIDs and GIDs instead of names" | 130 | //usage: "\n -n List numeric UIDs and GIDs instead of names" |
131 | //usage: "\n -s List allocated blocks" | 131 | //usage: "\n -s List allocated blocks" |
132 | //usage: IF_FEATURE_LS_TIMESTAMPS( | 132 | //usage: IF_FEATURE_LS_TIMESTAMPS( |
133 | //usage: "\n -c List ctime" | 133 | //usage: "\n -lc List ctime" |
134 | //usage: "\n -u List atime" | 134 | //usage: "\n -lu List atime" |
135 | //usage: ) | 135 | //usage: ) |
136 | //usage: IF_FEATURE_LS_TIMESTAMPS(IF_LONG_OPTS( | 136 | //usage: IF_FEATURE_LS_TIMESTAMPS(IF_LONG_OPTS( |
137 | //usage: "\n --full-time List full date and time" | 137 | //usage: "\n --full-time List full date and time" |
@@ -243,7 +243,7 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ | |||
243 | LIST_DATE_TIME | LIST_SYMLINK, | 243 | LIST_DATE_TIME | LIST_SYMLINK, |
244 | }; | 244 | }; |
245 | 245 | ||
246 | /* -Cadil1 Std options, busybox always supports */ | 246 | /* -Cadi1l Std options, busybox always supports */ |
247 | /* -gnsxA Std options, busybox always supports */ | 247 | /* -gnsxA Std options, busybox always supports */ |
248 | /* -Q GNU option, busybox always supports */ | 248 | /* -Q GNU option, busybox always supports */ |
249 | /* -k SELinux option, busybox always supports (ignores if !SELinux) */ | 249 | /* -k SELinux option, busybox always supports (ignores if !SELinux) */ |
@@ -256,7 +256,7 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \ | |||
256 | /* -T WIDTH Ignored (we don't use tabs on output) */ | 256 | /* -T WIDTH Ignored (we don't use tabs on output) */ |
257 | /* -Z SELinux mandated option, busybox optionally supports */ | 257 | /* -Z SELinux mandated option, busybox optionally supports */ |
258 | static const char ls_options[] ALIGN1 = | 258 | static const char ls_options[] ALIGN1 = |
259 | "Cadil1gnsxQAk" /* 13 opts, total 13 */ | 259 | "Cadi1lgnsxQAk" /* 13 opts, total 13 */ |
260 | IF_FEATURE_LS_TIMESTAMPS("ctu") /* 3, 16 */ | 260 | IF_FEATURE_LS_TIMESTAMPS("ctu") /* 3, 16 */ |
261 | IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 20 */ | 261 | IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 20 */ |
262 | IF_FEATURE_LS_FILETYPES("Fp") /* 2, 22 */ | 262 | IF_FEATURE_LS_FILETYPES("Fp") /* 2, 22 */ |
@@ -271,8 +271,8 @@ enum { | |||
271 | //OPT_a = (1 << 1), | 271 | //OPT_a = (1 << 1), |
272 | //OPT_d = (1 << 2), | 272 | //OPT_d = (1 << 2), |
273 | //OPT_i = (1 << 3), | 273 | //OPT_i = (1 << 3), |
274 | OPT_l = (1 << 4), | 274 | //OPT_1 = (1 << 4), |
275 | //OPT_1 = (1 << 5), | 275 | OPT_l = (1 << 5), |
276 | OPT_g = (1 << 6), | 276 | OPT_g = (1 << 6), |
277 | //OPT_n = (1 << 7), | 277 | //OPT_n = (1 << 7), |
278 | //OPT_s = (1 << 8), | 278 | //OPT_s = (1 << 8), |
@@ -329,10 +329,10 @@ static const uint32_t opt_flags[] = { | |||
329 | DISP_HIDDEN | DISP_DOT, /* a */ | 329 | DISP_HIDDEN | DISP_DOT, /* a */ |
330 | DISP_NOLIST, /* d */ | 330 | DISP_NOLIST, /* d */ |
331 | LIST_INO, /* i */ | 331 | LIST_INO, /* i */ |
332 | LIST_LONG | STYLE_LONG, /* l */ | ||
333 | STYLE_SINGLE, /* 1 */ | 332 | STYLE_SINGLE, /* 1 */ |
333 | LIST_LONG | STYLE_LONG, /* l - by keeping it after -1, "ls -l -1" ignores -1 */ | ||
334 | LIST_LONG | STYLE_LONG, /* g (don't show owner) - handled via OPT_g. assumes l */ | 334 | LIST_LONG | STYLE_LONG, /* g (don't show owner) - handled via OPT_g. assumes l */ |
335 | LIST_ID_NUMERIC | LIST_LONG | STYLE_LONG, /* n (assumes l) */ | 335 | LIST_LONG | STYLE_LONG | LIST_ID_NUMERIC, /* n (assumes l) */ |
336 | LIST_BLOCKS, /* s */ | 336 | LIST_BLOCKS, /* s */ |
337 | DISP_ROWS | STYLE_COLUMNAR, /* x */ | 337 | DISP_ROWS | STYLE_COLUMNAR, /* x */ |
338 | 0, /* Q (quote filename) - handled via OPT_Q */ | 338 | 0, /* Q (quote filename) - handled via OPT_Q */ |
@@ -1215,6 +1215,10 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
1215 | G.all_fmt |= flags; | 1215 | G.all_fmt |= flags; |
1216 | } | 1216 | } |
1217 | } | 1217 | } |
1218 | if (opt & OPT_dirs_first) | ||
1219 | G.all_fmt |= SORT_DIRS_FIRST; | ||
1220 | if (opt & OPT_full_time) | ||
1221 | G.all_fmt |= LIST_FULLTIME; | ||
1218 | 1222 | ||
1219 | #if ENABLE_FEATURE_LS_COLOR | 1223 | #if ENABLE_FEATURE_LS_COLOR |
1220 | /* set G_show_color = 1/0 */ | 1224 | /* set G_show_color = 1/0 */ |
@@ -1240,10 +1244,6 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
1240 | } | 1244 | } |
1241 | } | 1245 | } |
1242 | #endif | 1246 | #endif |
1243 | if (opt & OPT_dirs_first) | ||
1244 | G.all_fmt |= SORT_DIRS_FIRST; | ||
1245 | if (opt & OPT_full_time) | ||
1246 | G.all_fmt |= LIST_FULLTIME; | ||
1247 | 1247 | ||
1248 | /* sort out which command line options take precedence */ | 1248 | /* sort out which command line options take precedence */ |
1249 | if (ENABLE_FEATURE_LS_RECURSIVE && (G.all_fmt & DISP_NOLIST)) | 1249 | if (ENABLE_FEATURE_LS_RECURSIVE && (G.all_fmt & DISP_NOLIST)) |