*: 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!
This commit is contained in:
@@ -20,10 +20,10 @@
|
||||
|
||||
|
||||
#define OPT_RECURSE (option_mask32 & 1)
|
||||
#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0))
|
||||
#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0))
|
||||
#define OPT_QUIET (USE_DESKTOP(option_mask32 & 8) SKIP_DESKTOP(0))
|
||||
#define OPT_STR "R" USE_DESKTOP("vcf")
|
||||
#define OPT_VERBOSE (IF_DESKTOP(option_mask32 & 2) IF_NOT_DESKTOP(0))
|
||||
#define OPT_CHANGED (IF_DESKTOP(option_mask32 & 4) IF_NOT_DESKTOP(0))
|
||||
#define OPT_QUIET (IF_DESKTOP(option_mask32 & 8) IF_NOT_DESKTOP(0))
|
||||
#define OPT_STR "R" IF_DESKTOP("vcf")
|
||||
|
||||
/* coreutils:
|
||||
* chmod never changes the permissions of symbolic links; the chmod
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
/* This is a NOEXEC applet. Be very careful! */
|
||||
|
||||
|
||||
#define OPT_STR ("Rh" USE_DESKTOP("vcfLHP"))
|
||||
#define OPT_STR ("Rh" IF_DESKTOP("vcfLHP"))
|
||||
#define BIT_RECURSE 1
|
||||
#define OPT_RECURSE (opt & 1)
|
||||
#define OPT_NODEREF (opt & 2)
|
||||
#define OPT_VERBOSE (USE_DESKTOP(opt & 0x04) SKIP_DESKTOP(0))
|
||||
#define OPT_CHANGED (USE_DESKTOP(opt & 0x08) SKIP_DESKTOP(0))
|
||||
#define OPT_QUIET (USE_DESKTOP(opt & 0x10) SKIP_DESKTOP(0))
|
||||
#define OPT_VERBOSE (IF_DESKTOP(opt & 0x04) IF_NOT_DESKTOP(0))
|
||||
#define OPT_CHANGED (IF_DESKTOP(opt & 0x08) IF_NOT_DESKTOP(0))
|
||||
#define OPT_QUIET (IF_DESKTOP(opt & 0x10) IF_NOT_DESKTOP(0))
|
||||
/* POSIX options
|
||||
* -L traverse every symbolic link to a directory encountered
|
||||
* -H if a command line argument is a symbolic link to a directory, traverse it
|
||||
@@ -32,10 +32,10 @@
|
||||
* The last option specified shall determine the behavior of the utility." */
|
||||
/* -L */
|
||||
#define BIT_TRAVERSE 0x20
|
||||
#define OPT_TRAVERSE (USE_DESKTOP(opt & BIT_TRAVERSE) SKIP_DESKTOP(0))
|
||||
#define OPT_TRAVERSE (IF_DESKTOP(opt & BIT_TRAVERSE) IF_NOT_DESKTOP(0))
|
||||
/* -H or -L */
|
||||
#define BIT_TRAVERSE_TOP (0x20|0x40)
|
||||
#define OPT_TRAVERSE_TOP (USE_DESKTOP(opt & BIT_TRAVERSE_TOP) SKIP_DESKTOP(0))
|
||||
#define OPT_TRAVERSE_TOP (IF_DESKTOP(opt & BIT_TRAVERSE_TOP) IF_NOT_DESKTOP(0))
|
||||
|
||||
typedef int (*chown_fptr)(const char *, uid_t, gid_t);
|
||||
|
||||
@@ -85,7 +85,7 @@ int chown_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* This matches coreutils behavior (almost - see below) */
|
||||
if (OPT_NODEREF
|
||||
/* || (OPT_RECURSE && !OPT_TRAVERSE_TOP): */
|
||||
USE_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
IF_DESKTOP( || (opt & (BIT_RECURSE|BIT_TRAVERSE_TOP)) == BIT_RECURSE)
|
||||
) {
|
||||
param.chown_func = lchown;
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ int date_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *isofmt_arg = NULL;
|
||||
|
||||
opt_complementary = "d--s:s--d"
|
||||
USE_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
||||
IF_FEATURE_DATE_ISOFMT(":R--I:I--R");
|
||||
opt = getopt32(argv, "Rs:ud:r:"
|
||||
USE_FEATURE_DATE_ISOFMT("I::D:"),
|
||||
IF_FEATURE_DATE_ISOFMT("I::D:"),
|
||||
&date_str, &date_str, &filename
|
||||
USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt));
|
||||
IF_FEATURE_DATE_ISOFMT(, &isofmt_arg, &fmt_str2dt));
|
||||
argv += optind;
|
||||
maybe_set_utc(opt);
|
||||
|
||||
|
||||
@@ -64,9 +64,9 @@ int df_main(int argc, char **argv)
|
||||
opt_complementary = "k-m:m-k";
|
||||
#endif
|
||||
opt = getopt32(argv, "kP"
|
||||
USE_FEATURE_DF_FANCY("aiB:")
|
||||
USE_FEATURE_HUMAN_READABLE("hm")
|
||||
USE_FEATURE_DF_FANCY(, &chp));
|
||||
IF_FEATURE_DF_FANCY("aiB:")
|
||||
IF_FEATURE_HUMAN_READABLE("hm")
|
||||
IF_FEATURE_DF_FANCY(, &chp));
|
||||
if (opt & OPT_MEGA)
|
||||
df_disp_hr = 1024*1024;
|
||||
|
||||
|
||||
@@ -155,13 +155,13 @@ int du_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opt;
|
||||
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
|
||||
SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
|
||||
IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 1024;)
|
||||
IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_hr = 512;)
|
||||
if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
|
||||
G.disp_hr = 512;
|
||||
#else
|
||||
USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;)
|
||||
/* SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
|
||||
IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 1;)
|
||||
/* IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(G.disp_k = 0;) - G is pre-zeroed */
|
||||
#endif
|
||||
G.max_print_depth = INT_MAX;
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
|
||||
#endif
|
||||
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) {
|
||||
USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
|
||||
IF_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts);
|
||||
opt = getopt32(argv, "it:", &opt_t);
|
||||
} else {
|
||||
USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
|
||||
IF_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts);
|
||||
/* -t NUM sets also -a */
|
||||
opt_complementary = "ta";
|
||||
opt = getopt32(argv, "ft:a", &opt_t);
|
||||
@@ -157,9 +157,9 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
|
||||
if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e'))
|
||||
USE_EXPAND(expand(file, tab_size, opt));
|
||||
IF_EXPAND(expand(file, tab_size, opt));
|
||||
else
|
||||
USE_UNEXPAND(unexpand(file, tab_size, opt));
|
||||
IF_UNEXPAND(unexpand(file, tab_size, opt));
|
||||
|
||||
/* Check and close the file */
|
||||
if (fclose_if_not_stdin(file)) {
|
||||
|
||||
@@ -119,8 +119,8 @@ int id_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/
|
||||
/* Don't allow more than one username */
|
||||
opt_complementary = "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG"
|
||||
USE_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
opt = getopt32(argv, "rnugG" USE_SELINUX("Z"));
|
||||
IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G");
|
||||
opt = getopt32(argv, "rnugG" IF_SELINUX("Z"));
|
||||
|
||||
username = argv[optind];
|
||||
if (username) {
|
||||
|
||||
@@ -101,12 +101,12 @@ int install_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
|
||||
applet_long_options = install_longopts;
|
||||
#endif
|
||||
opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z");
|
||||
opt_complementary = "s--d:d--s" IF_SELINUX(":Z--\xff:\xff--Z");
|
||||
/* -c exists for backwards compatibility, it's needed */
|
||||
/* -v is ignored ("print name of each created directory") */
|
||||
/* -b is ignored ("make a backup of each existing destination file") */
|
||||
opts = getopt32(argv, "cvb" "Ddpsg:m:o:" USE_SELINUX("Z:"),
|
||||
&gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
|
||||
opts = getopt32(argv, "cvb" "Ddpsg:m:o:" IF_SELINUX("Z:"),
|
||||
&gid_str, &mode_str, &uid_str IF_SELINUX(, &scontext));
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ mode_t FAST_FUNC getopt_mk_fifo_nod(char **argv)
|
||||
security_context_t scontext;
|
||||
#endif
|
||||
int opt;
|
||||
opt = getopt32(argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
|
||||
opt = getopt32(argv, "m:" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
|
||||
if (opt & 1) {
|
||||
if (bb_parse_mode(smode, &mode))
|
||||
umask(0);
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
*/
|
||||
# undef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
# undef ENABLE_FEATURE_LS_TIMESTAMPS
|
||||
# undef USE_FEATURE_LS_TIMESTAMPS
|
||||
# undef SKIP_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_NOT_FEATURE_LS_TIMESTAMPS
|
||||
# define CONFIG_FEATURE_LS_TIMESTAMPS 1
|
||||
# define ENABLE_FEATURE_LS_TIMESTAMPS 1
|
||||
# define USE_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define SKIP_FEATURE_LS_TIMESTAMPS(...)
|
||||
# define IF_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define IF_NOT_FEATURE_LS_TIMESTAMPS(...)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -138,15 +138,15 @@ SPLIT_SUBDIR = 2,
|
||||
/* "[-]e", I think we made this one up */
|
||||
static const char ls_options[] ALIGN1 =
|
||||
"Cadil1gnsxQAk" /* 13 opts, total 13 */
|
||||
USE_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
USE_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
USE_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
USE_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
USE_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
USE_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
USE_SELINUX("K") /* 1, 27 */
|
||||
USE_SELINUX("Z") /* 1, 28 */
|
||||
USE_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
IF_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
IF_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
IF_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
IF_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
IF_SELINUX("K") /* 1, 27 */
|
||||
IF_SELINUX("Z") /* 1, 28 */
|
||||
IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
;
|
||||
enum {
|
||||
//OPT_C = (1 << 0),
|
||||
@@ -232,7 +232,7 @@ struct dnode { /* the basic node */
|
||||
const char *fullname; /* the dir entry name */
|
||||
int allocated;
|
||||
struct stat dstat; /* the file stat info */
|
||||
USE_SELINUX(security_context_t sid;)
|
||||
IF_SELINUX(security_context_t sid;)
|
||||
struct dnode *next; /* point at the next node */
|
||||
};
|
||||
|
||||
@@ -277,9 +277,9 @@ enum {
|
||||
/* memset: we have to zero it out because of NOEXEC */
|
||||
#define INIT_G() do { \
|
||||
memset(&G, 0, sizeof(G)); \
|
||||
USE_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
USE_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
USE_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
IF_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
IF_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
IF_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
{
|
||||
struct stat dstat;
|
||||
struct dnode *cur;
|
||||
USE_SELINUX(security_context_t sid = NULL;)
|
||||
IF_SELINUX(security_context_t sid = NULL;)
|
||||
|
||||
if ((all_fmt & FOLLOW_LINKS) || force_follow) {
|
||||
#if ENABLE_SELINUX
|
||||
@@ -332,7 +332,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
cur->fullname = fullname;
|
||||
cur->name = name;
|
||||
cur->dstat = dstat;
|
||||
USE_SELINUX(cur->sid = sid;)
|
||||
IF_SELINUX(cur->sid = sid;)
|
||||
return cur;
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ static void showfiles(struct dnode **dn, int nfiles)
|
||||
column_width = len;
|
||||
}
|
||||
column_width += tabstops +
|
||||
USE_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
((all_fmt & LIST_INO) ? 8 : 0) +
|
||||
((all_fmt & LIST_BLOCKS) ? 5 : 0);
|
||||
ncols = (int) (terminal_width / column_width);
|
||||
@@ -912,7 +912,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
int dndirs;
|
||||
int i;
|
||||
/* need to initialize since --color has _an optional_ argument */
|
||||
USE_FEATURE_LS_COLOR(const char *color_opt = "always";)
|
||||
IF_FEATURE_LS_COLOR(const char *color_opt = "always";)
|
||||
|
||||
INIT_G();
|
||||
|
||||
@@ -927,13 +927,13 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
#endif
|
||||
|
||||
/* process options */
|
||||
USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
IF_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
#if ENABLE_FEATURE_AUTOWIDTH
|
||||
opt_complementary = "T+:w+"; /* -T N, -w N */
|
||||
opt = getopt32(argv, ls_options, &tabstops, &terminal_width
|
||||
USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#else
|
||||
opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
opt = getopt32(argv, ls_options IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#endif
|
||||
for (i = 0; opt_flags[i] != (1U<<31); i++) {
|
||||
if (opt & (1 << i)) {
|
||||
|
||||
@@ -48,7 +48,7 @@ int mkdir_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
|
||||
applet_long_options = mkdir_longopts;
|
||||
#endif
|
||||
opt = getopt32(argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
|
||||
opt = getopt32(argv, "m:p" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext));
|
||||
if (opt & 1) {
|
||||
mode = 0777;
|
||||
if (!bb_parse_mode(smode, &mode)) {
|
||||
|
||||
@@ -16,14 +16,14 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
|
||||
char *fname;
|
||||
char pathbuf[PATH_MAX];
|
||||
|
||||
USE_FEATURE_READLINK_FOLLOW(
|
||||
IF_FEATURE_READLINK_FOLLOW(
|
||||
unsigned opt;
|
||||
/* We need exactly one non-option argument. */
|
||||
opt_complementary = "=1";
|
||||
opt = getopt32(argv, "f");
|
||||
fname = argv[optind];
|
||||
)
|
||||
SKIP_FEATURE_READLINK_FOLLOW(
|
||||
IF_NOT_FEATURE_READLINK_FOLLOW(
|
||||
const unsigned opt = 0;
|
||||
if (argc != 2) bb_show_usage();
|
||||
fname = argv[1];
|
||||
|
||||
@@ -156,7 +156,7 @@ static void printfs(char *pformat, const char *msg)
|
||||
/* print statfs info */
|
||||
static void print_statfs(char *pformat, const char m,
|
||||
const char *const filename, const void *data
|
||||
USE_SELINUX(, security_context_t scontext))
|
||||
IF_SELINUX(, security_context_t scontext))
|
||||
{
|
||||
const struct statfs *statfsbuf = data;
|
||||
if (m == 'n') {
|
||||
@@ -203,7 +203,7 @@ static void print_statfs(char *pformat, const char m,
|
||||
/* print stat info */
|
||||
static void print_stat(char *pformat, const char m,
|
||||
const char *const filename, const void *data
|
||||
USE_SELINUX(, security_context_t scontext))
|
||||
IF_SELINUX(, security_context_t scontext))
|
||||
{
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
struct stat *statbuf = (struct stat *) data;
|
||||
@@ -306,9 +306,9 @@ static void print_stat(char *pformat, const char m,
|
||||
}
|
||||
|
||||
static void print_it(const char *masterformat, const char *filename,
|
||||
void (*print_func) (char*, char, const char*, const void* USE_SELINUX(, security_context_t scontext)),
|
||||
void (*print_func) (char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)),
|
||||
const void *data
|
||||
USE_SELINUX(, security_context_t scontext) )
|
||||
IF_SELINUX(, security_context_t scontext) )
|
||||
{
|
||||
/* Create a working copy of the format string */
|
||||
char *format = xstrdup(masterformat);
|
||||
@@ -347,7 +347,7 @@ static void print_it(const char *masterformat, const char *filename,
|
||||
break;
|
||||
default:
|
||||
/* Completes "%<modifiers>" with specifier and printfs */
|
||||
print_func(dest, *p, filename, data USE_SELINUX(,scontext));
|
||||
print_func(dest, *p, filename, data IF_SELINUX(,scontext));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ static bool do_statfs(const char *filename, const char *format)
|
||||
);
|
||||
#endif /* SELINUX */
|
||||
}
|
||||
print_it(format, filename, print_statfs, &statfsbuf USE_SELINUX(, scontext));
|
||||
print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext));
|
||||
#else /* FEATURE_STAT_FORMAT */
|
||||
format = (option_mask32 & OPT_TERSE
|
||||
? "%s %llx %lu "
|
||||
@@ -560,11 +560,11 @@ static bool do_stat(const char *filename, const char *format)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
print_it(format, filename, print_stat, &statbuf USE_SELINUX(, scontext));
|
||||
print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext));
|
||||
#else /* FEATURE_STAT_FORMAT */
|
||||
if (option_mask32 & OPT_TERSE) {
|
||||
printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu"
|
||||
SKIP_SELINUX("\n"),
|
||||
IF_NOT_SELINUX("\n"),
|
||||
filename,
|
||||
(uintmax_t) (statbuf.st_size),
|
||||
(uintmax_t) statbuf.st_blocks,
|
||||
@@ -642,14 +642,14 @@ static bool do_stat(const char *filename, const char *format)
|
||||
int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int stat_main(int argc, char **argv)
|
||||
{
|
||||
USE_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||
IF_FEATURE_STAT_FORMAT(char *format = NULL;)
|
||||
int i;
|
||||
int ok = 1;
|
||||
statfunc_ptr statfunc = do_stat;
|
||||
|
||||
getopt32(argv, "ftL"
|
||||
USE_SELINUX("Z")
|
||||
USE_FEATURE_STAT_FORMAT("c:", &format)
|
||||
IF_SELINUX("Z")
|
||||
IF_FEATURE_STAT_FORMAT("c:", &format)
|
||||
);
|
||||
|
||||
if (option_mask32 & OPT_FILESYS) /* -f */
|
||||
@@ -663,7 +663,7 @@ int stat_main(int argc, char **argv)
|
||||
}
|
||||
#endif /* ENABLE_SELINUX */
|
||||
for (i = optind; i < argc; ++i)
|
||||
ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format));
|
||||
ok &= statfunc(argv[i] IF_FEATURE_STAT_FORMAT(, format));
|
||||
|
||||
return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -110,9 +110,9 @@ int tail_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
USE_FEATURE_FANCY_TAIL(opt_complementary = "s+";) /* -s N */
|
||||
opt = getopt32(argv, "fc:n:" USE_FEATURE_FANCY_TAIL("qs:v"),
|
||||
&str_c, &str_n USE_FEATURE_FANCY_TAIL(,&sleep_period));
|
||||
IF_FEATURE_FANCY_TAIL(opt_complementary = "s+";) /* -s N */
|
||||
opt = getopt32(argv, "fc:n:" IF_FEATURE_FANCY_TAIL("qs:v"),
|
||||
&str_c, &str_n IF_FEATURE_FANCY_TAIL(,&sleep_period));
|
||||
#define FOLLOW (opt & 0x1)
|
||||
#define COUNT_BYTES (opt & 0x2)
|
||||
//if (opt & 0x1) // -f
|
||||
|
||||
@@ -63,9 +63,9 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
|
||||
applet_long_options = longopts;
|
||||
#endif
|
||||
#endif
|
||||
opts = getopt32(argv, "c" USE_DESKTOP("r:")
|
||||
opts = getopt32(argv, "c" IF_DESKTOP("r:")
|
||||
/*ignored:*/ "fma"
|
||||
USE_DESKTOP(, &reference_file));
|
||||
IF_DESKTOP(, &reference_file));
|
||||
|
||||
opts &= 1; /* only -c bit is left */
|
||||
argv += optind;
|
||||
|
||||
@@ -13,17 +13,17 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
int tty_main(int argc, char **argv IF_NOT_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
{
|
||||
const char *s;
|
||||
USE_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
|
||||
IF_INCLUDE_SUSv2(int silent;) /* Note: No longer relevant in SUSv3. */
|
||||
int retval;
|
||||
|
||||
xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */
|
||||
|
||||
USE_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
|
||||
USE_INCLUDE_SUSv2(argc -= optind;)
|
||||
SKIP_INCLUDE_SUSv2(argc -= 1;)
|
||||
IF_INCLUDE_SUSv2(silent = getopt32(argv, "s");)
|
||||
IF_INCLUDE_SUSv2(argc -= optind;)
|
||||
IF_NOT_INCLUDE_SUSv2(argc -= 1;)
|
||||
|
||||
/* gnu tty outputs a warning that it is ignoring all args. */
|
||||
bb_warn_ignoring_args(argc);
|
||||
@@ -37,8 +37,8 @@ int tty_main(int argc, char **argv SKIP_INCLUDE_SUSv2(UNUSED_PARAM))
|
||||
s = "not a tty";
|
||||
retval = 1;
|
||||
}
|
||||
USE_INCLUDE_SUSv2(if (!silent) puts(s);)
|
||||
SKIP_INCLUDE_SUSv2(puts(s);)
|
||||
IF_INCLUDE_SUSv2(if (!silent) puts(s);)
|
||||
IF_NOT_INCLUDE_SUSv2(puts(s);)
|
||||
|
||||
fflush_stdout_and_exit(retval);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
|
||||
const unsigned short *delta;
|
||||
unsigned toprint;
|
||||
|
||||
USE_GETOPT_LONG(applet_long_options = longopts);
|
||||
IF_GETOPT_LONG(applet_long_options = longopts);
|
||||
toprint = getopt32(argv, options);
|
||||
|
||||
if (argv[optind]) { /* coreutils-6.9 compat */
|
||||
|
||||
Reference in New Issue
Block a user