aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /coreutils
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.bz2
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/chmod.c8
-rw-r--r--coreutils/chown.c14
-rw-r--r--coreutils/date.c6
-rw-r--r--coreutils/df.c6
-rw-r--r--coreutils/du.c8
-rw-r--r--coreutils/expand.c8
-rw-r--r--coreutils/id.c4
-rw-r--r--coreutils/install.c6
-rw-r--r--coreutils/libcoreutils/getopt_mk_fifo_nod.c2
-rw-r--r--coreutils/ls.c48
-rw-r--r--coreutils/mkdir.c2
-rw-r--r--coreutils/readlink.c4
-rw-r--r--coreutils/stat.c24
-rw-r--r--coreutils/tail.c6
-rw-r--r--coreutils/touch.c4
-rw-r--r--coreutils/tty.c14
-rw-r--r--coreutils/uname.c2
17 files changed, 83 insertions, 83 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index 40f681fb6..9c1c76047 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -20,10 +20,10 @@
20 20
21 21
22#define OPT_RECURSE (option_mask32 & 1) 22#define OPT_RECURSE (option_mask32 & 1)
23#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0)) 23#define OPT_VERBOSE (IF_DESKTOP(option_mask32 & 2) IF_NOT_DESKTOP(0))
24#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0)) 24#define OPT_CHANGED (IF_DESKTOP(option_mask32 & 4) IF_NOT_DESKTOP(0))
25#define OPT_QUIET (USE_DESKTOP(option_mask32 & 8) SKIP_DESKTOP(0)) 25#define OPT_QUIET (IF_DESKTOP(option_mask32 & 8) IF_NOT_DESKTOP(0))
26#define OPT_STR "R" USE_DESKTOP("vcf") 26#define OPT_STR "R" IF_DESKTOP("vcf")
27 27
28/* coreutils: 28/* coreutils:
29 * chmod never changes the permissions of symbolic links; the chmod 29 * chmod never changes the permissions of symbolic links; the chmod
diff --git a/coreutils/chown.c b/coreutils/chown.c
index 345249261..2d8e556f0 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -16,13 +16,13 @@
16/* This is a NOEXEC applet. Be very careful! */ 16/* This is a NOEXEC applet. Be very careful! */
17 17
18 18
19#define OPT_STR ("Rh" USE_DESKTOP("vcfLHP")) 19#define OPT_STR ("Rh" IF_DESKTOP("vcfLHP"))
20#define BIT_RECURSE 1 20#define BIT_RECURSE 1
21#define OPT_RECURSE (opt & 1) 21#define OPT_RECURSE (opt & 1)
22#define OPT_NODEREF (opt & 2) 22#define OPT_NODEREF (opt & 2)
23#define OPT_VERBOSE (USE_DESKTOP(opt & 0x04) SKIP_DESKTOP(0)) 23#define OPT_VERBOSE (IF_DESKTOP(opt & 0x04) IF_NOT_DESKTOP(0))
24#define OPT_CHANGED (USE_DESKTOP(opt & 0x08) SKIP_DESKTOP(0)) 24#define OPT_CHANGED (IF_DESKTOP(opt & 0x08) IF_NOT_DESKTOP(0))
25#define OPT_QUIET (USE_DESKTOP(opt & 0x10) SKIP_DESKTOP(0)) 25#define OPT_QUIET (IF_DESKTOP(opt & 0x10) IF_NOT_DESKTOP(0))
26/* POSIX options 26/* POSIX options
27 * -L traverse every symbolic link to a directory encountered 27 * -L traverse every symbolic link to a directory encountered
28 * -H if a command line argument is a symbolic link to a directory, traverse it 28 * -H if a command line argument is a symbolic link to a directory, traverse it
@@ -32,10 +32,10 @@
32 * The last option specified shall determine the behavior of the utility." */ 32 * The last option specified shall determine the behavior of the utility." */
33/* -L */ 33/* -L */
34#define BIT_TRAVERSE 0x20 34#define BIT_TRAVERSE 0x20
35#define OPT_TRAVERSE (USE_DESKTOP(opt & BIT_TRAVERSE) SKIP_DESKTOP(0)) 35#define OPT_TRAVERSE (IF_DESKTOP(opt & BIT_TRAVERSE) IF_NOT_DESKTOP(0))
36/* -H or -L */ 36/* -H or -L */
37#define BIT_TRAVERSE_TOP (0x20|0x40) 37#define BIT_TRAVERSE_TOP (0x20|0x40)
38#define OPT_TRAVERSE_TOP (USE_DESKTOP(opt & BIT_TRAVERSE_TOP) SKIP_DESKTOP(0)) 38#define OPT_TRAVERSE_TOP (IF_DESKTOP(opt & BIT_TRAVERSE_TOP) IF_NOT_DESKTOP(0))
39 39
40typedef int (*chown_fptr)(const char *, uid_t, gid_t); 40typedef int (*chown_fptr)(const char *, uid_t, gid_t);
41 41
@@ -85,7 +85,7 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
85 /* This matches coreutils behavior (almost - see below) */ 85 /* This matches coreutils behavior (almost - see below) */
86 if (OPT_NODEREF 86 if (OPT_NODEREF
87 /* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */ 87 /* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
88 USE_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE) 88 IF_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
89 ) { 89 ) {
90 param.chown_func = lchown; 90 param.chown_func = lchown;
91 } 91 }
diff --git a/coreutils/date.c b/coreutils/date.c
index 177b7d075..3a536dbe5 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -52,11 +52,11 @@ int date_main(int argc UNUSED_PARAM, char **argv)
52 char *isofmt_arg = NULL; 52 char *isofmt_arg = NULL;
53 53
54 opt_complementary = "d--s:s--d" 54 opt_complementary = "d--s:s--d"
55 USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); 55 IF_FEATURE_DATE_ISOFMT(":R--I:I--R");
56 opt = getopt32(argv, "Rs:ud:r:" 56 opt = getopt32(argv, "Rs:ud:r:"
57 USE_FEATURE_DATE_ISOFMT("I::D:"), 57 IF_FEATURE_DATE_ISOFMT("I::D:"),
58 &date_str, &date_str, &filename 58 &date_str, &date_str, &filename
59 USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt)); 59 IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt));
60 argv += optind; 60 argv += optind;
61 maybe_set_utc(opt); 61 maybe_set_utc(opt);
62 62
diff --git a/coreutils/df.c b/coreutils/df.c
index dfd6e0b41..34b015090 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -64,9 +64,9 @@ int df_main(int argc, char **argv)
64 opt_complementary = "k-m:m-k"; 64 opt_complementary = "k-m:m-k";
65#endif 65#endif
66 opt = getopt32(argv, "kP" 66 opt = getopt32(argv, "kP"
67 USE_FEATURE_DF_FANCY("aiB:") 67 IF_FEATURE_DF_FANCY("aiB:")
68 USE_FEATURE_HUMAN_READABLE("hm") 68 IF_FEATURE_HUMAN_READABLE("hm")
69 USE_FEATURE_DF_FANCY(, &chp)); 69 IF_FEATURE_DF_FANCY(, &chp));
70 if (opt & OPT_MEGA) 70 if (opt & OPT_MEGA)
71 df_disp_hr = 1024*1024; 71 df_disp_hr = 1024*1024;
72 72
diff --git a/coreutils/du.c b/coreutils/du.c
index 16c773243..ec283f85e 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -155,13 +155,13 @@ int du_main(int argc UNUSED_PARAM, char **argv)
155 unsigned opt; 155 unsigned opt;
156 156
157#if ENABLE_FEATURE_HUMAN_READABLE 157#if ENABLE_FEATURE_HUMAN_READABLE
158 USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;) 158 IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
159 SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;) 159 IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
160 if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */ 160 if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
161 G.disp_hr = 512; 161 G.disp_hr = 512;
162#else 162#else
163 USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;) 163 IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;)
164 /* SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */ 164 /* IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
165#endif 165#endif
166 G.max_print_depth = INT_MAX; 166 G.max_print_depth = INT_MAX;
167 167
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 0967e2534..7137c3b89 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -132,10 +132,10 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
132#endif 132#endif
133 133
134 if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) { 134 if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) {
135 USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts); 135 IF_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
136 opt = getopt32(argv, "it:", &opt_t); 136 opt = getopt32(argv, "it:", &opt_t);
137 } else { 137 } else {
138 USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts); 138 IF_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
139 /* -t NUM sets also -a */ 139 /* -t NUM sets also -a */
140 opt_complementary = "ta"; 140 opt_complementary = "ta";
141 opt = getopt32(argv, "ft:a", &opt_t); 141 opt = getopt32(argv, "ft:a", &opt_t);
@@ -157,9 +157,9 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
157 } 157 }
158 158
159 if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) 159 if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e'))
160 USE_EXPAND(expand(file, tab_size, opt)); 160 IF_EXPAND(expand(file, tab_size, opt));
161 else 161 else
162 USE_UNEXPAND(unexpand(file, tab_size, opt)); 162 IF_UNEXPAND(unexpand(file, tab_size, opt));
163 163
164 /* Check and close the file */ 164 /* Check and close the file */
165 if (fclose_if_not_stdin(file)) { 165 if (fclose_if_not_stdin(file)) {
diff --git a/coreutils/id.c b/coreutils/id.c
index 43f403fa3..6022c9fa4 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -119,8 +119,8 @@ int id_main(int argc UNUSED_PARAM, char **argv)
119 /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/ 119 /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/
120 /* Don't allow more than one username */ 120 /* Don't allow more than one username */
121 opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG" 121 opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG"
122 USE_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G"); 122 IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
123 opt = getopt32(argv, "rnugG" USE_SELINUX("Z")); 123 opt = getopt32(argv, "rnugG" IF_SELINUX("Z"));
124 124
125 username = argv[optind]; 125 username = argv[optind];
126 if (username) { 126 if (username) {
diff --git a/coreutils/install.c b/coreutils/install.c
index 2b796e2a1..24fb402af 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -101,12 +101,12 @@ int install_main(int argc, char **argv)
101#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS 101#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
102 applet_long_options = install_longopts; 102 applet_long_options = install_longopts;
103#endif 103#endif
104 opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); 104 opt_complementary = "s--d:d--s" IF_SELINUX(":Z--\xff:\xff--Z");
105 /* -c exists for backwards compatibility, it's needed */ 105 /* -c exists for backwards compatibility, it's needed */
106 /* -v is ignored ("print name of each created directory") */ 106 /* -v is ignored ("print name of each created directory") */
107 /* -b is ignored ("make a backup of each existing destination file") */ 107 /* -b is ignored ("make a backup of each existing destination file") */
108 opts = getopt32(argv, "cvb" "Ddpsg:m:o:" USE_SELINUX("Z:"), 108 opts = getopt32(argv, "cvb" "Ddpsg:m:o:" IF_SELINUX("Z:"),
109 &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext)); 109 &gid_str, &mode_str, &uid_str IF_SELINUX(, &scontext));
110 argc -= optind; 110 argc -= optind;
111 argv += optind; 111 argv += optind;
112 112
diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c
index ba3222e46..222717149 100644
--- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c
+++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c
@@ -31,7 +31,7 @@ mode_t FAST_FUNC getopt_mk_fifo_nod(char **argv)
31 security_context_t scontext; 31 security_context_t scontext;
32#endif 32#endif
33 int opt; 33 int opt;
34 opt = getopt32(argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); 34 opt = getopt32(argv, "m:" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
35 if (opt & 1) { 35 if (opt & 1) {
36 if (bb_parse_mode(smode, &mode)) 36 if (bb_parse_mode(smode, &mode))
37 umask(0); 37 umask(0);
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 */
139static const char ls_options[] ALIGN1 = 139static 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 ;
151enum { 151enum {
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(&current_time_t);) \ 282 IF_FEATURE_LS_TIMESTAMPS(time(&current_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)) {
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 72bd10581..a110165db 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -48,7 +48,7 @@ int mkdir_main(int argc, char **argv)
48#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS 48#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
49 applet_long_options = mkdir_longopts; 49 applet_long_options = mkdir_longopts;
50#endif 50#endif
51 opt = getopt32(argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); 51 opt = getopt32(argv, "m:p" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
52 if (opt & 1) { 52 if (opt & 1) {
53 mode = 0777; 53 mode = 0777;
54 if (!bb_parse_mode(smode, &mode)) { 54 if (!bb_parse_mode(smode, &mode)) {
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 721fd8597..8d4456214 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -16,14 +16,14 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
16 char *fname; 16 char *fname;
17 char pathbuf[PATH_MAX]; 17 char pathbuf[PATH_MAX];
18 18
19 USE_FEATURE_READLINK_FOLLOW( 19 IF_FEATURE_READLINK_FOLLOW(
20 unsigned opt; 20 unsigned opt;
21 /* We need exactly one non-option argument. */ 21 /* We need exactly one non-option argument. */
22 opt_complementary = "=1"; 22 opt_complementary = "=1";
23 opt = getopt32(argv, "f"); 23 opt = getopt32(argv, "f");
24 fname = argv[optind]; 24 fname = argv[optind];
25 ) 25 )
26 SKIP_FEATURE_READLINK_FOLLOW( 26 IF_NOT_FEATURE_READLINK_FOLLOW(
27 const unsigned opt = 0; 27 const unsigned opt = 0;
28 if (argc != 2) bb_show_usage(); 28 if (argc != 2) bb_show_usage();
29 fname = argv[1]; 29 fname = argv[1];
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 32e8b42f3..44a03e5e7 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -156,7 +156,7 @@ static void printfs(char *pformat, const char *msg)
156/* print statfs info */ 156/* print statfs info */
157static void print_statfs(char *pformat, const char m, 157static void print_statfs(char *pformat, const char m,
158 const char *const filename, const void *data 158 const char *const filename, const void *data
159 USE_SELINUX(, security_context_t scontext)) 159 IF_SELINUX(, security_context_t scontext))
160{ 160{
161 const struct statfs *statfsbuf = data; 161 const struct statfs *statfsbuf = data;
162 if (m == 'n') { 162 if (m == 'n') {
@@ -203,7 +203,7 @@ static void print_statfs(char *pformat, const char m,
203/* print stat info */ 203/* print stat info */
204static void print_stat(char *pformat, const char m, 204static void print_stat(char *pformat, const char m,
205 const char *const filename, const void *data 205 const char *const filename, const void *data
206 USE_SELINUX(, security_context_t scontext)) 206 IF_SELINUX(, security_context_t scontext))
207{ 207{
208#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) 208#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
209 struct stat *statbuf = (struct stat *) data; 209 struct stat *statbuf = (struct stat *) data;
@@ -306,9 +306,9 @@ static void print_stat(char *pformat, const char m,
306} 306}
307 307
308static void print_it(const char *masterformat, const char *filename, 308static void print_it(const char *masterformat, const char *filename,
309 void (*print_func) (char*, char, const char*, const void* USE_SELINUX(, security_context_t scontext)), 309 void (*print_func) (char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)),
310 const void *data 310 const void *data
311 USE_SELINUX(, security_context_t scontext) ) 311 IF_SELINUX(, security_context_t scontext) )
312{ 312{
313 /* Create a working copy of the format string */ 313 /* Create a working copy of the format string */
314 char *format = xstrdup(masterformat); 314 char *format = xstrdup(masterformat);
@@ -347,7 +347,7 @@ static void print_it(const char *masterformat, const char *filename,
347 break; 347 break;
348 default: 348 default:
349 /* Completes "%<modifiers>" with specifier and printfs */ 349 /* Completes "%<modifiers>" with specifier and printfs */
350 print_func(dest, *p, filename, data USE_SELINUX(,scontext)); 350 print_func(dest, *p, filename, data IF_SELINUX(,scontext));
351 break; 351 break;
352 } 352 }
353 } 353 }
@@ -416,7 +416,7 @@ static bool do_statfs(const char *filename, const char *format)
416 ); 416 );
417#endif /* SELINUX */ 417#endif /* SELINUX */
418 } 418 }
419 print_it(format, filename, print_statfs, &statfsbuf USE_SELINUX(, scontext)); 419 print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext));
420#else /* FEATURE_STAT_FORMAT */ 420#else /* FEATURE_STAT_FORMAT */
421 format = (option_mask32 & OPT_TERSE 421 format = (option_mask32 & OPT_TERSE
422 ? "%s %llx %lu " 422 ? "%s %llx %lu "
@@ -560,11 +560,11 @@ static bool do_stat(const char *filename, const char *format)
560 } 560 }
561#endif 561#endif
562 } 562 }
563 print_it(format, filename, print_stat, &statbuf USE_SELINUX(, scontext)); 563 print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext));
564#else /* FEATURE_STAT_FORMAT */ 564#else /* FEATURE_STAT_FORMAT */
565 if (option_mask32 & OPT_TERSE) { 565 if (option_mask32 & OPT_TERSE) {
566 printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu" 566 printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu"
567 SKIP_SELINUX("\n"), 567 IF_NOT_SELINUX("\n"),
568 filename, 568 filename,
569 (uintmax_t) (statbuf.st_size), 569 (uintmax_t) (statbuf.st_size),
570 (uintmax_t) statbuf.st_blocks, 570 (uintmax_t) statbuf.st_blocks,
@@ -642,14 +642,14 @@ static bool do_stat(const char *filename, const char *format)
642int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 642int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
643int stat_main(int argc, char **argv) 643int stat_main(int argc, char **argv)
644{ 644{
645 USE_FEATURE_STAT_FORMAT(char *format = NULL;) 645 IF_FEATURE_STAT_FORMAT(char *format = NULL;)
646 int i; 646 int i;
647 int ok = 1; 647 int ok = 1;
648 statfunc_ptr statfunc = do_stat; 648 statfunc_ptr statfunc = do_stat;
649 649
650 getopt32(argv, "ftL" 650 getopt32(argv, "ftL"
651 USE_SELINUX("Z") 651 IF_SELINUX("Z")
652 USE_FEATURE_STAT_FORMAT("c:", &format) 652 IF_FEATURE_STAT_FORMAT("c:", &format)
653 ); 653 );
654 654
655 if (option_mask32 & OPT_FILESYS) /* -f */ 655 if (option_mask32 & OPT_FILESYS) /* -f */
@@ -663,7 +663,7 @@ int stat_main(int argc, char **argv)
663 } 663 }
664#endif /* ENABLE_SELINUX */ 664#endif /* ENABLE_SELINUX */
665 for (i = optind; i < argc; ++i) 665 for (i = optind; i < argc; ++i)
666 ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format)); 666 ok &= statfunc(argv[i] IF_FEATURE_STAT_FORMAT(, format));
667 667
668 return (ok ? EXIT_SUCCESS : EXIT_FAILURE); 668 return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
669} 669}
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 5dae2d35b..3ce6be0bd 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -110,9 +110,9 @@ int tail_main(int argc, char **argv)
110 } 110 }
111#endif 111#endif
112 112
113 USE_FEATURE_FANCY_TAIL(opt_complementary = "s+";) /* -s N */ 113 IF_FEATURE_FANCY_TAIL(opt_complementary = "s+";) /* -s N */
114 opt = getopt32(argv, "fc:n:" USE_FEATURE_FANCY_TAIL("qs:v"), 114 opt = getopt32(argv, "fc:n:" IF_FEATURE_FANCY_TAIL("qs:v"),
115 &str_c, &str_n USE_FEATURE_FANCY_TAIL(,&sleep_period)); 115 &str_c, &str_n IF_FEATURE_FANCY_TAIL(,&sleep_period));
116#define FOLLOW (opt & 0x1) 116#define FOLLOW (opt & 0x1)
117#define COUNT_BYTES (opt & 0x2) 117#define COUNT_BYTES (opt & 0x2)
118 //if (opt & 0x1) // -f 118 //if (opt & 0x1) // -f
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 20191546c..1d5541710 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -63,9 +63,9 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
63 applet_long_options = longopts; 63 applet_long_options = longopts;
64#endif 64#endif
65#endif 65#endif
66 opts = getopt32(argv, "c" USE_DESKTOP("r:") 66 opts = getopt32(argv, "c" IF_DESKTOP("r:")
67 /*ignored:*/ "fma" 67 /*ignored:*/ "fma"
68 USE_DESKTOP(, &reference_file)); 68 IF_DESKTOP(, &reference_file));
69 69
70 opts &= 1; /* only -c bit is left */ 70 opts &= 1; /* only -c bit is left */
71 argv += optind; 71 argv += optind;
diff --git a/coreutils/tty.c b/coreutils/tty.c
index d49fb50b6..74a4ea3d6 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -13,17 +13,17 @@
13#include "libbb.h" 13#include "libbb.h"
14 14
15int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 15int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM)) 16int tty_main(int argc, char **argv IF_NOT_INCLUDE_SUSv2(UNUSED_PARAM))
17{ 17{
18 const char *s; 18 const char *s;
19 USE_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */ 19 IF_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
20 int retval; 20 int retval;
21 21
22 xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ 22 xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */
23 23
24 USE_INCLUDE_SUSv2(silent = getopt32(argv, "s");) 24 IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
25 USE_INCLUDE_SUSv2(argc -= optind;) 25 IF_INCLUDE_SUSv2(argc -= optind;)
26 SKIP_INCLUDE_SUSv2(argc -= 1;) 26 IF_NOT_INCLUDE_SUSv2(argc -= 1;)
27 27
28 /* gnu tty outputs a warning that it is ignoring all args. */ 28 /* gnu tty outputs a warning that it is ignoring all args. */
29 bb_warn_ignoring_args(argc); 29 bb_warn_ignoring_args(argc);
@@ -37,8 +37,8 @@ int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
37 s = "not a tty"; 37 s = "not a tty";
38 retval = 1; 38 retval = 1;
39 } 39 }
40 USE_INCLUDE_SUSv2(if (!silent) puts(s);) 40 IF_INCLUDE_SUSv2(if (!silent) puts(s);)
41 SKIP_INCLUDE_SUSv2(puts(s);) 41 IF_NOT_INCLUDE_SUSv2(puts(s);)
42 42
43 fflush_stdout_and_exit(retval); 43 fflush_stdout_and_exit(retval);
44} 44}
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 33d026f18..5a790fb70 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
97 const unsigned short *delta; 97 const unsigned short *delta;
98 unsigned toprint; 98 unsigned toprint;
99 99
100 USE_GETOPT_LONG(applet_long_options = longopts); 100 IF_GETOPT_LONG(applet_long_options = longopts);
101 toprint = getopt32(argv, options); 101 toprint = getopt32(argv, options);
102 102
103 if (argv[optind]) { /* coreutils-6.9 compat */ 103 if (argv[optind]) { /* coreutils-6.9 compat */