diff options
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r-- | coreutils/ls.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 61baa9a11..379b0f94f 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -46,12 +46,12 @@ | |||
46 | */ | 46 | */ |
47 | # undef CONFIG_FEATURE_LS_TIMESTAMPS | 47 | # undef CONFIG_FEATURE_LS_TIMESTAMPS |
48 | # undef ENABLE_FEATURE_LS_TIMESTAMPS | 48 | # undef ENABLE_FEATURE_LS_TIMESTAMPS |
49 | # undef USE_FEATURE_LS_TIMESTAMPS | 49 | # undef IF_FEATURE_LS_TIMESTAMPS |
50 | # undef SKIP_FEATURE_LS_TIMESTAMPS | 50 | # undef IF_NOT_FEATURE_LS_TIMESTAMPS |
51 | # define CONFIG_FEATURE_LS_TIMESTAMPS 1 | 51 | # define CONFIG_FEATURE_LS_TIMESTAMPS 1 |
52 | # define ENABLE_FEATURE_LS_TIMESTAMPS 1 | 52 | # define ENABLE_FEATURE_LS_TIMESTAMPS 1 |
53 | # define USE_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__ | 53 | # define IF_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__ |
54 | # define SKIP_FEATURE_LS_TIMESTAMPS(...) | 54 | # define IF_NOT_FEATURE_LS_TIMESTAMPS(...) |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | 57 | ||
@@ -138,15 +138,15 @@ SPLIT_SUBDIR = 2, | |||
138 | /* "[-]e", I think we made this one up */ | 138 | /* "[-]e", I think we made this one up */ |
139 | static const char ls_options[] ALIGN1 = | 139 | static const char ls_options[] ALIGN1 = |
140 | "Cadil1gnsxQAk" /* 13 opts, total 13 */ | 140 | "Cadil1gnsxQAk" /* 13 opts, total 13 */ |
141 | USE_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */ | 141 | IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */ |
142 | USE_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */ | 142 | IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */ |
143 | USE_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */ | 143 | IF_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */ |
144 | USE_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */ | 144 | IF_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */ |
145 | USE_FEATURE_LS_RECURSIVE("R") /* 1, 25 */ | 145 | IF_FEATURE_LS_RECURSIVE("R") /* 1, 25 */ |
146 | USE_FEATURE_HUMAN_READABLE("h") /* 1, 26 */ | 146 | IF_FEATURE_HUMAN_READABLE("h") /* 1, 26 */ |
147 | USE_SELINUX("K") /* 1, 27 */ | 147 | IF_SELINUX("K") /* 1, 27 */ |
148 | USE_SELINUX("Z") /* 1, 28 */ | 148 | IF_SELINUX("Z") /* 1, 28 */ |
149 | USE_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */ | 149 | IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */ |
150 | ; | 150 | ; |
151 | enum { | 151 | enum { |
152 | //OPT_C = (1 << 0), | 152 | //OPT_C = (1 << 0), |
@@ -232,7 +232,7 @@ struct dnode { /* the basic node */ | |||
232 | const char *fullname; /* the dir entry name */ | 232 | const char *fullname; /* the dir entry name */ |
233 | int allocated; | 233 | int allocated; |
234 | struct stat dstat; /* the file stat info */ | 234 | struct stat dstat; /* the file stat info */ |
235 | USE_SELINUX(security_context_t sid;) | 235 | IF_SELINUX(security_context_t sid;) |
236 | struct dnode *next; /* point at the next node */ | 236 | struct dnode *next; /* point at the next node */ |
237 | }; | 237 | }; |
238 | 238 | ||
@@ -277,9 +277,9 @@ enum { | |||
277 | /* memset: we have to zero it out because of NOEXEC */ | 277 | /* memset: we have to zero it out because of NOEXEC */ |
278 | #define INIT_G() do { \ | 278 | #define INIT_G() do { \ |
279 | memset(&G, 0, sizeof(G)); \ | 279 | memset(&G, 0, sizeof(G)); \ |
280 | USE_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \ | 280 | IF_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \ |
281 | USE_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \ | 281 | IF_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \ |
282 | USE_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \ | 282 | IF_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \ |
283 | } while (0) | 283 | } while (0) |
284 | 284 | ||
285 | 285 | ||
@@ -302,7 +302,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f | |||
302 | { | 302 | { |
303 | struct stat dstat; | 303 | struct stat dstat; |
304 | struct dnode *cur; | 304 | struct dnode *cur; |
305 | USE_SELINUX(security_context_t sid = NULL;) | 305 | IF_SELINUX(security_context_t sid = NULL;) |
306 | 306 | ||
307 | if ((all_fmt & FOLLOW_LINKS) || force_follow) { | 307 | if ((all_fmt & FOLLOW_LINKS) || force_follow) { |
308 | #if ENABLE_SELINUX | 308 | #if ENABLE_SELINUX |
@@ -332,7 +332,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f | |||
332 | cur->fullname = fullname; | 332 | cur->fullname = fullname; |
333 | cur->name = name; | 333 | cur->name = name; |
334 | cur->dstat = dstat; | 334 | cur->dstat = dstat; |
335 | USE_SELINUX(cur->sid = sid;) | 335 | IF_SELINUX(cur->sid = sid;) |
336 | return cur; | 336 | return cur; |
337 | } | 337 | } |
338 | 338 | ||
@@ -570,7 +570,7 @@ static void showfiles(struct dnode **dn, int nfiles) | |||
570 | column_width = len; | 570 | column_width = len; |
571 | } | 571 | } |
572 | column_width += tabstops + | 572 | column_width += tabstops + |
573 | USE_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + ) | 573 | IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + ) |
574 | ((all_fmt & LIST_INO) ? 8 : 0) + | 574 | ((all_fmt & LIST_INO) ? 8 : 0) + |
575 | ((all_fmt & LIST_BLOCKS) ? 5 : 0); | 575 | ((all_fmt & LIST_BLOCKS) ? 5 : 0); |
576 | ncols = (int) (terminal_width / column_width); | 576 | ncols = (int) (terminal_width / column_width); |
@@ -912,7 +912,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
912 | int dndirs; | 912 | int dndirs; |
913 | int i; | 913 | int i; |
914 | /* need to initialize since --color has _an optional_ argument */ | 914 | /* need to initialize since --color has _an optional_ argument */ |
915 | USE_FEATURE_LS_COLOR(const char *color_opt = "always";) | 915 | IF_FEATURE_LS_COLOR(const char *color_opt = "always";) |
916 | 916 | ||
917 | INIT_G(); | 917 | INIT_G(); |
918 | 918 | ||
@@ -927,13 +927,13 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
927 | #endif | 927 | #endif |
928 | 928 | ||
929 | /* process options */ | 929 | /* process options */ |
930 | USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;) | 930 | IF_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;) |
931 | #if ENABLE_FEATURE_AUTOWIDTH | 931 | #if ENABLE_FEATURE_AUTOWIDTH |
932 | opt_complementary = "T+:w+"; /* -T N, -w N */ | 932 | opt_complementary = "T+:w+"; /* -T N, -w N */ |
933 | opt = getopt32(argv, ls_options, &tabstops, &terminal_width | 933 | opt = getopt32(argv, ls_options, &tabstops, &terminal_width |
934 | USE_FEATURE_LS_COLOR(, &color_opt)); | 934 | IF_FEATURE_LS_COLOR(, &color_opt)); |
935 | #else | 935 | #else |
936 | opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt)); | 936 | opt = getopt32(argv, ls_options IF_FEATURE_LS_COLOR(, &color_opt)); |
937 | #endif | 937 | #endif |
938 | for (i = 0; opt_flags[i] != (1U<<31); i++) { | 938 | for (i = 0; opt_flags[i] != (1U<<31); i++) { |
939 | if (opt & (1 << i)) { | 939 | if (opt & (1 << i)) { |