aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 4c0944bb0..9f0462936 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -206,18 +206,18 @@ SPLIT_SUBDIR = 2,
206/* -SXvhTw GNU options, busybox optionally supports */ 206/* -SXvhTw GNU options, busybox optionally supports */
207/* -T WIDTH Ignored (we don't use tabs on output) */ 207/* -T WIDTH Ignored (we don't use tabs on output) */
208/* -Z SELinux mandated option, busybox optionally supports */ 208/* -Z SELinux mandated option, busybox optionally supports */
209static const char ls_options[] ALIGN1 = 209#define ls_options \
210 "Cadi1lgnsxAk" /* 12 opts, total 12 */ 210 "Cadi1lgnsxAk" /* 12 opts, total 12 */ \
211 IF_FEATURE_LS_FILETYPES("Fp") /* 2, 14 */ 211 IF_FEATURE_LS_FILETYPES("Fp") /* 2, 14 */ \
212 IF_FEATURE_LS_RECURSIVE("R") /* 1, 15 */ 212 IF_FEATURE_LS_RECURSIVE("R") /* 1, 15 */ \
213 IF_SELINUX("Z") /* 1, 16 */ 213 IF_SELINUX("Z") /* 1, 16 */ \
214 "Q" /* 1, 17 */ 214 "Q" /* 1, 17 */ \
215 IF_FEATURE_LS_TIMESTAMPS("ctu") /* 3, 20 */ 215 IF_FEATURE_LS_TIMESTAMPS("ctu") /* 3, 20 */ \
216 IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 24 */ 216 IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 24 */ \
217 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 26 */ 217 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 26 */ \
218 IF_FEATURE_HUMAN_READABLE("h") /* 1, 27 */ 218 IF_FEATURE_HUMAN_READABLE("h") /* 1, 27 */ \
219 IF_FEATURE_LS_WIDTH("T:w:") /* 2, 29 */ 219 IF_FEATURE_LS_WIDTH("T:w:") /* 2, 29 */
220; 220
221enum { 221enum {
222 OPT_C = (1 << 0), 222 OPT_C = (1 << 0),
223 OPT_a = (1 << 1), 223 OPT_a = (1 << 1),
@@ -1093,25 +1093,26 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1093#endif 1093#endif
1094 1094
1095 /* process options */ 1095 /* process options */
1096 IF_LONG_OPTS(applet_long_options = ls_longopts;) 1096 opt = getopt32long(argv, "^"
1097 opt_complementary = 1097 ls_options
1098 /* -n and -g imply -l */ 1098 "\0"
1099 "nl:gl" 1099 /* -n and -g imply -l */
1100 /* --full-time implies -l */ 1100 "nl:gl"
1101 IF_FEATURE_LS_TIMESTAMPS(IF_LONG_OPTS(":\xff""l")) 1101 /* --full-time implies -l */
1102 /* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html: 1102 IF_FEATURE_LS_TIMESTAMPS(IF_LONG_OPTS(":\xff""l"))
1103 * in some pairs of opts, only last one takes effect: 1103 /* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html:
1104 */ 1104 * in some pairs of opts, only last one takes effect:
1105 IF_FEATURE_LS_TIMESTAMPS(IF_FEATURE_LS_SORTFILES(":t-S:S-t")) /* time/size */ 1105 */
1106 // ":m-l:l-m" - we don't have -m 1106 IF_FEATURE_LS_TIMESTAMPS(IF_FEATURE_LS_SORTFILES(":t-S:S-t")) /* time/size */
1107 IF_FEATURE_LS_FOLLOWLINKS(":H-L:L-H") 1107 // ":m-l:l-m" - we don't have -m
1108 ":C-xl:x-Cl:l-xC" /* bycols/bylines/long */ 1108 IF_FEATURE_LS_FOLLOWLINKS(":H-L:L-H")
1109 ":C-1:1-C" /* bycols/oneline */ 1109 ":C-xl:x-Cl:l-xC" /* bycols/bylines/long */
1110 ":x-1:1-x" /* bylines/oneline (not in SuS, but in GNU coreutils 8.4) */ 1110 ":C-1:1-C" /* bycols/oneline */
1111 IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */ 1111 ":x-1:1-x" /* bylines/oneline (not in SuS, but in GNU coreutils 8.4) */
1112 /* -w NUM: */ 1112 IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */
1113 IF_FEATURE_LS_WIDTH(":w+"); 1113 /* -w NUM: */
1114 opt = getopt32(argv, ls_options 1114 IF_FEATURE_LS_WIDTH(":w+")
1115 , ls_longopts
1115 IF_FEATURE_LS_WIDTH(, /*-T*/ NULL, /*-w*/ &G_terminal_width) 1116 IF_FEATURE_LS_WIDTH(, /*-T*/ NULL, /*-w*/ &G_terminal_width)
1116 IF_FEATURE_LS_COLOR(, &color_opt) 1117 IF_FEATURE_LS_COLOR(, &color_opt)
1117 ); 1118 );