aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:35:52 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:35:52 +0100
commited15dde60a72dce888df10295a916b199346929d (patch)
treee3d9fab96ea62f20f29460de32e8cacaab9d2267 /coreutils
parent6c1f348fa792a33d5a98e68c139df65c2d4c1628 (diff)
downloadbusybox-w32-ed15dde60a72dce888df10295a916b199346929d.tar.gz
busybox-w32-ed15dde60a72dce888df10295a916b199346929d.tar.bz2
busybox-w32-ed15dde60a72dce888df10295a916b199346929d.zip
Move FEATURE_AUTOWIDTH config option to two applets which use it
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 531eb85b5..13df77410 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -48,6 +48,11 @@
48//config: default y 48//config: default y
49//config: depends on LS 49//config: depends on LS
50//config: 50//config:
51//config:config FEATURE_LS_WIDTH
52//config: bool "Enable -w WIDTH and window size autodetection"
53//config: default y
54//config: depends on LS
55//config:
51//config:config FEATURE_LS_SORTFILES 56//config:config FEATURE_LS_SORTFILES
52//config: bool "Sort the file names" 57//config: bool "Sort the file names"
53//config: default y 58//config: default y
@@ -101,7 +106,7 @@
101//usage: IF_FEATURE_LS_SORTFILES("rSXv") 106//usage: IF_FEATURE_LS_SORTFILES("rSXv")
102//usage: IF_FEATURE_LS_TIMESTAMPS("ctu") 107//usage: IF_FEATURE_LS_TIMESTAMPS("ctu")
103//usage: IF_SELINUX("kKZ") "]" 108//usage: IF_SELINUX("kKZ") "]"
104//usage: IF_FEATURE_AUTOWIDTH(" [-w WIDTH]") " [FILE]..." 109//usage: IF_FEATURE_LS_WIDTH(" [-w WIDTH]") " [FILE]..."
105//usage:#define ls_full_usage "\n\n" 110//usage:#define ls_full_usage "\n\n"
106//usage: "List directory contents\n" 111//usage: "List directory contents\n"
107//usage: "\n -1 One column output" 112//usage: "\n -1 One column output"
@@ -147,7 +152,7 @@
147//usage: "\n -K List security context in long format" 152//usage: "\n -K List security context in long format"
148//usage: "\n -Z List security context and permission" 153//usage: "\n -Z List security context and permission"
149//usage: ) 154//usage: )
150//usage: IF_FEATURE_AUTOWIDTH( 155//usage: IF_FEATURE_LS_WIDTH(
151//usage: "\n -w N Assume the terminal is N columns wide" 156//usage: "\n -w N Assume the terminal is N columns wide"
152//usage: ) 157//usage: )
153//usage: IF_FEATURE_LS_COLOR( 158//usage: IF_FEATURE_LS_COLOR(
@@ -263,7 +268,7 @@ static const char ls_options[] ALIGN1 =
263 IF_SELINUX("KZ") /* 2, 26 */ 268 IF_SELINUX("KZ") /* 2, 26 */
264 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */ 269 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */
265 IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */ 270 IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */
266 IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 31 */ 271 IF_FEATURE_LS_WIDTH("T:w:") /* 2, 31 */
267 /* with --color, we use all 32 bits */; 272 /* with --color, we use all 32 bits */;
268enum { 273enum {
269 //OPT_C = (1 << 0), 274 //OPT_C = (1 << 0),
@@ -298,7 +303,7 @@ enum {
298 OPTBIT_h = OPTBIT_L + 2 * ENABLE_FEATURE_LS_FOLLOWLINKS, 303 OPTBIT_h = OPTBIT_L + 2 * ENABLE_FEATURE_LS_FOLLOWLINKS,
299 OPTBIT_T = OPTBIT_h + 1 * ENABLE_FEATURE_HUMAN_READABLE, 304 OPTBIT_T = OPTBIT_h + 1 * ENABLE_FEATURE_HUMAN_READABLE,
300 OPTBIT_w, /* 30 */ 305 OPTBIT_w, /* 30 */
301 OPTBIT_color = OPTBIT_T + 2 * ENABLE_FEATURE_AUTOWIDTH, 306 OPTBIT_color = OPTBIT_T + 2 * ENABLE_FEATURE_LS_WIDTH,
302 307
303 OPT_c = (1 << OPTBIT_c) * ENABLE_FEATURE_LS_TIMESTAMPS, 308 OPT_c = (1 << OPTBIT_c) * ENABLE_FEATURE_LS_TIMESTAMPS,
304 OPT_e = (1 << OPTBIT_e) * ENABLE_FEATURE_LS_TIMESTAMPS, 309 OPT_e = (1 << OPTBIT_e) * ENABLE_FEATURE_LS_TIMESTAMPS,
@@ -316,8 +321,8 @@ enum {
316 OPT_L = (1 << OPTBIT_L) * ENABLE_FEATURE_LS_FOLLOWLINKS, 321 OPT_L = (1 << OPTBIT_L) * ENABLE_FEATURE_LS_FOLLOWLINKS,
317 OPT_H = (1 << OPTBIT_H) * ENABLE_FEATURE_LS_FOLLOWLINKS, 322 OPT_H = (1 << OPTBIT_H) * ENABLE_FEATURE_LS_FOLLOWLINKS,
318 OPT_h = (1 << OPTBIT_h) * ENABLE_FEATURE_HUMAN_READABLE, 323 OPT_h = (1 << OPTBIT_h) * ENABLE_FEATURE_HUMAN_READABLE,
319 OPT_T = (1 << OPTBIT_T) * ENABLE_FEATURE_AUTOWIDTH, 324 OPT_T = (1 << OPTBIT_T) * ENABLE_FEATURE_LS_WIDTH,
320 OPT_w = (1 << OPTBIT_w) * ENABLE_FEATURE_AUTOWIDTH, 325 OPT_w = (1 << OPTBIT_w) * ENABLE_FEATURE_LS_WIDTH,
321 OPT_color = (1 << OPTBIT_color) * ENABLE_FEATURE_LS_COLOR, 326 OPT_color = (1 << OPTBIT_color) * ENABLE_FEATURE_LS_COLOR,
322}; 327};
323 328
@@ -417,7 +422,7 @@ struct globals {
417#endif 422#endif
418 smallint exit_code; 423 smallint exit_code;
419 unsigned all_fmt; 424 unsigned all_fmt;
420#if ENABLE_FEATURE_AUTOWIDTH 425#if ENABLE_FEATURE_LS_WIDTH
421 unsigned terminal_width; 426 unsigned terminal_width;
422# define G_terminal_width (G.terminal_width) 427# define G_terminal_width (G.terminal_width)
423#else 428#else
@@ -433,7 +438,7 @@ struct globals {
433 setup_common_bufsiz(); \ 438 setup_common_bufsiz(); \
434 /* we have to zero it out because of NOEXEC */ \ 439 /* we have to zero it out because of NOEXEC */ \
435 memset(&G, 0, sizeof(G)); \ 440 memset(&G, 0, sizeof(G)); \
436 IF_FEATURE_AUTOWIDTH(G_terminal_width = TERMINAL_WIDTH;) \ 441 IF_FEATURE_LS_WIDTH(G_terminal_width = TERMINAL_WIDTH;) \
437 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \ 442 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \
438} while (0) 443} while (0)
439 444
@@ -1167,7 +1172,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1167 if (ENABLE_FEATURE_LS_SORTFILES) 1172 if (ENABLE_FEATURE_LS_SORTFILES)
1168 G.all_fmt = SORT_NAME; 1173 G.all_fmt = SORT_NAME;
1169 1174
1170#if ENABLE_FEATURE_AUTOWIDTH 1175#if ENABLE_FEATURE_LS_WIDTH
1171 /* obtain the terminal width */ 1176 /* obtain the terminal width */
1172 G_terminal_width = get_terminal_width(STDIN_FILENO); 1177 G_terminal_width = get_terminal_width(STDIN_FILENO);
1173 /* go one less... */ 1178 /* go one less... */
@@ -1190,9 +1195,9 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1190 ":x-1:1-x" /* bylines/oneline (not in SuS, but in GNU coreutils 8.4) */ 1195 ":x-1:1-x" /* bylines/oneline (not in SuS, but in GNU coreutils 8.4) */
1191 IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */ 1196 IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */
1192 /* -w NUM: */ 1197 /* -w NUM: */
1193 IF_FEATURE_AUTOWIDTH(":w+"); 1198 IF_FEATURE_LS_WIDTH(":w+");
1194 opt = getopt32(argv, ls_options 1199 opt = getopt32(argv, ls_options
1195 IF_FEATURE_AUTOWIDTH(, NULL, &G_terminal_width) 1200 IF_FEATURE_LS_WIDTH(, NULL, &G_terminal_width)
1196 IF_FEATURE_LS_COLOR(, &color_opt) 1201 IF_FEATURE_LS_COLOR(, &color_opt)
1197 ); 1202 );
1198 for (i = 0; opt_flags[i] != (1U << 31); i++) { 1203 for (i = 0; opt_flags[i] != (1U << 31); i++) {