*: 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:
Denis Vlasenko 2009-04-21 11:09:40 +00:00
parent 8b814b4a34
commit 5e34ff29bc
102 changed files with 1312 additions and 1308 deletions

View File

@ -30,11 +30,11 @@ int open_to_or_warn(int to_fd, const char *filename, int flags, int mode)
int FAST_FUNC bbunpack(char **argv,
char* (*make_new_name)(char *filename),
USE_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)
IF_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)
)
{
struct stat stat_buf;
USE_DESKTOP(long long) int status;
IF_DESKTOP(long long) int status;
char *filename, *new_name;
smallint exitcode = 0;
unpack_info_t info;
@ -175,7 +175,7 @@ char* make_new_name_bunzip2(char *filename)
}
static
USE_DESKTOP(long long) int unpack_bunzip2(unpack_info_t *info UNUSED_PARAM)
IF_DESKTOP(long long) int unpack_bunzip2(unpack_info_t *info UNUSED_PARAM)
{
return unpack_bz2_stream_prime(STDIN_FILENO, STDOUT_FILENO);
}
@ -251,9 +251,9 @@ char* make_new_name_gunzip(char *filename)
}
static
USE_DESKTOP(long long) int unpack_gunzip(unpack_info_t *info)
IF_DESKTOP(long long) int unpack_gunzip(unpack_info_t *info)
{
USE_DESKTOP(long long) int status = -1;
IF_DESKTOP(long long) int status = -1;
/* do the decompression, and cleanup */
if (xread_char(STDIN_FILENO) == 0x1f) {
@ -325,7 +325,7 @@ char* make_new_name_unlzma(char *filename)
}
static
USE_DESKTOP(long long) int unpack_unlzma(unpack_info_t *info UNUSED_PARAM)
IF_DESKTOP(long long) int unpack_unlzma(unpack_info_t *info UNUSED_PARAM)
{
return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO);
}
@ -360,9 +360,9 @@ char* make_new_name_uncompress(char *filename)
}
static
USE_DESKTOP(long long) int unpack_uncompress(unpack_info_t *info UNUSED_PARAM)
IF_DESKTOP(long long) int unpack_uncompress(unpack_info_t *info UNUSED_PARAM)
{
USE_DESKTOP(long long) int status = -1;
IF_DESKTOP(long long) int status = -1;
if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) {
bb_error_msg("invalid magic");

View File

@ -64,7 +64,7 @@ static uint8_t level;
* total written bytes so far otherwise
*/
static
USE_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
{
int n, n2, ret;
@ -98,13 +98,13 @@ USE_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, v
if (rlen && strm->avail_in == 0)
break;
}
return 0 USE_DESKTOP( + strm->total_out );
return 0 IF_DESKTOP( + strm->total_out );
}
static
USE_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
IF_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
{
USE_DESKTOP(long long) int total;
IF_DESKTOP(long long) int total;
ssize_t count;
bz_stream bzs; /* it's small */
#define strm (&bzs)
@ -163,7 +163,7 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
opt_complementary = "s2"; /* -s means -2 (compatibility) */
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
opt = getopt32(argv, "cfv" USE_BUNZIP2("dt") "123456789qzs");
opt = getopt32(argv, "cfv" IF_BUNZIP2("dt") "123456789qzs");
#if ENABLE_BUNZIP2 /* bunzip2_main may not be visible... */
if (opt & 0x18) // -d and/or -t
return bunzip2_main(argc, argv);

View File

@ -270,7 +270,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
{
archive_handle_t *archive_handle;
char *cpio_filename;
USE_FEATURE_CPIO_O(const char *cpio_fmt = "";)
IF_FEATURE_CPIO_O(const char *cpio_fmt = "";)
unsigned opt;
#if ENABLE_GETOPT_LONG
@ -295,7 +295,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
#if !ENABLE_FEATURE_CPIO_O
opt = getopt32(argv, OPTION_STR, &cpio_filename);
#else
opt = getopt32(argv, OPTION_STR "oH:" USE_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
if (opt & CPIO_OPT_PASSTHROUGH) {
pid_t pid;
struct fd_pair pp;

View File

@ -2015,7 +2015,7 @@ char* make_new_name_gzip(char *filename)
}
static
USE_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM)
IF_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM)
{
struct stat s;
@ -2050,7 +2050,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
opt = getopt32(argv, "cfv" USE_GUNZIP("dt") "q123456789n");
opt = getopt32(argv, "cfv" IF_GUNZIP("dt") "q123456789n");
#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
if (opt & 0x18) // -d and/or -t
return gunzip_main(argc, argv);

View File

@ -648,10 +648,10 @@ void FAST_FUNC dealloc_bunzip(bunzip_data *bd)
/* Decompress src_fd to dst_fd. Stops at end of bzip data, not end of file. */
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_bz2_stream(int src_fd, int dst_fd)
{
USE_DESKTOP(long long total_written = 0;)
IF_DESKTOP(long long total_written = 0;)
char *outbuf;
bunzip_data *bd;
int i;
@ -666,7 +666,7 @@ unpack_bz2_stream(int src_fd, int dst_fd)
i = RETVAL_SHORT_WRITE;
break;
}
USE_DESKTOP(total_written += i;)
IF_DESKTOP(total_written += i;)
}
}
@ -686,10 +686,10 @@ unpack_bz2_stream(int src_fd, int dst_fd)
dealloc_bunzip(bd);
free(outbuf);
return i ? i : USE_DESKTOP(total_written) + 0;
return i ? i : IF_DESKTOP(total_written) + 0;
}
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_bz2_stream_prime(int src_fd, int dst_fd)
{
unsigned char magic[2];

View File

@ -72,11 +72,11 @@
* be stored in the compressed file.
*/
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_Z_stream(int fd_in, int fd_out)
{
USE_DESKTOP(long long total_written = 0;)
USE_DESKTOP(long long) int retval = -1;
IF_DESKTOP(long long total_written = 0;)
IF_DESKTOP(long long) int retval = -1;
unsigned char *stackp;
long code;
int finchar;
@ -265,7 +265,7 @@ unpack_Z_stream(int fd_in, int fd_out)
if (outpos >= OBUFSIZ) {
full_write(fd_out, outbuf, outpos);
//error check??
USE_DESKTOP(total_written += outpos;)
IF_DESKTOP(total_written += outpos;)
outpos = 0;
}
stackp += i;
@ -294,10 +294,10 @@ unpack_Z_stream(int fd_in, int fd_out)
if (outpos > 0) {
full_write(fd_out, outbuf, outpos);
//error check??
USE_DESKTOP(total_written += outpos;)
IF_DESKTOP(total_written += outpos;)
}
retval = USE_DESKTOP(total_written) + 0;
retval = IF_DESKTOP(total_written) + 0;
err:
free(inbuf);
free(outbuf);

View File

@ -228,10 +228,10 @@ enum {
};
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_lzma_stream(int src_fd, int dst_fd)
{
USE_DESKTOP(long long total_written = 0;)
IF_DESKTOP(long long total_written = 0;)
lzma_header_t header;
int lc, pb, lp;
uint32_t pos_state_mask;
@ -330,7 +330,7 @@ unpack_lzma_stream(int src_fd, int dst_fd)
global_pos += header.dict_size;
if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
goto bad;
USE_DESKTOP(total_written += header.dict_size;)
IF_DESKTOP(total_written += header.dict_size;)
}
#else
len = 1;
@ -468,20 +468,20 @@ unpack_lzma_stream(int src_fd, int dst_fd)
}
len += LZMA_MATCH_MIN_LEN;
SKIP_FEATURE_LZMA_FAST(string:)
IF_NOT_FEATURE_LZMA_FAST(string:)
do {
pos = buffer_pos - rep0;
while (pos >= header.dict_size)
pos += header.dict_size;
previous_byte = buffer[pos];
SKIP_FEATURE_LZMA_FAST(one_byte2:)
IF_NOT_FEATURE_LZMA_FAST(one_byte2:)
buffer[buffer_pos++] = previous_byte;
if (buffer_pos == header.dict_size) {
buffer_pos = 0;
global_pos += header.dict_size;
if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
goto bad;
USE_DESKTOP(total_written += header.dict_size;)
IF_DESKTOP(total_written += header.dict_size;)
}
len--;
} while (len != 0 && buffer_pos < header.dst_size);
@ -489,8 +489,8 @@ unpack_lzma_stream(int src_fd, int dst_fd)
}
{
SKIP_DESKTOP(int total_written = 0; /* success */)
USE_DESKTOP(total_written += buffer_pos;)
IF_NOT_DESKTOP(int total_written = 0; /* success */)
IF_DESKTOP(total_written += buffer_pos;)
if (full_write(dst_fd, buffer, buffer_pos) != (ssize_t)buffer_pos) {
bad:
total_written = -1; /* failure */

View File

@ -970,10 +970,10 @@ static int inflate_get_next_window(STATE_PARAM_ONLY)
/* Called from unpack_gz_stream() and inflate_unzip() */
static USE_DESKTOP(long long) int
static IF_DESKTOP(long long) int
inflate_unzip_internal(STATE_PARAM int in, int out)
{
USE_DESKTOP(long long) int n = 0;
IF_DESKTOP(long long) int n = 0;
ssize_t nwrote;
/* Allocate all global buffers (for DYN_ALLOC option) */
@ -1008,7 +1008,7 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
n = -1;
goto ret;
}
USE_DESKTOP(n += nwrote;)
IF_DESKTOP(n += nwrote;)
if (r == 0) break;
}
@ -1033,10 +1033,10 @@ inflate_unzip_internal(STATE_PARAM int in, int out)
/* For unzip */
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
inflate_unzip(inflate_unzip_result *res, off_t compr_size, int in, int out)
{
USE_DESKTOP(long long) int n;
IF_DESKTOP(long long) int n;
DECLARE_STATE;
ALLOC_STATE;
@ -1181,11 +1181,11 @@ static int check_header_gzip(STATE_PARAM unpack_info_t *info)
return 1;
}
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_gz_stream_with_info(int in, int out, unpack_info_t *info)
{
uint32_t v32;
USE_DESKTOP(long long) int n;
IF_DESKTOP(long long) int n;
DECLARE_STATE;
n = 0;
@ -1245,7 +1245,7 @@ unpack_gz_stream_with_info(int in, int out, unpack_info_t *info)
return n;
}
USE_DESKTOP(long long) int FAST_FUNC
IF_DESKTOP(long long) int FAST_FUNC
unpack_gz_stream(int in, int out)
{
return unpack_gz_stream_with_info(in, out, NULL);

View File

@ -144,8 +144,8 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
// if (!archive_handle->ah_priv_inited) {
// archive_handle->ah_priv_inited = 1;
// p_end = 0;
// USE_FEATURE_TAR_GNU_EXTENSIONS(p_longname = NULL;)
// USE_FEATURE_TAR_GNU_EXTENSIONS(p_linkname = NULL;)
// IF_FEATURE_TAR_GNU_EXTENSIONS(p_longname = NULL;)
// IF_FEATURE_TAR_GNU_EXTENSIONS(p_linkname = NULL;)
// }
if (sizeof(tar) != 512)
@ -176,7 +176,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
bb_error_msg_and_die("short read");
}
if (i != 512) {
USE_FEATURE_TAR_AUTODETECT(goto autodetect;)
IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
goto short_read;
}
@ -265,14 +265,14 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
#if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
sum = strtoul(tar.chksum, &cp, 8);
if ((*cp && *cp != ' ')
|| (sum_u != sum USE_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum))
|| (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum))
) {
bb_error_msg_and_die("invalid tar header checksum");
}
#else
/* This field does not need special treatment (getOctal) */
sum = xstrtoul(tar.chksum, 8);
if (sum_u != sum USE_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
bb_error_msg_and_die("invalid tar header checksum");
}
#endif
@ -356,7 +356,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
file_header->mode |= S_IFBLK;
goto size0;
case '5':
USE_FEATURE_TAR_OLDGNU_COMPATIBILITY(set_dir:)
IF_FEATURE_TAR_OLDGNU_COMPATIBILITY(set_dir:)
file_header->mode |= S_IFDIR;
goto size0;
case '6':

View File

@ -12,7 +12,7 @@
* in include/unarchive.h. On NOMMU, transformer is removed.
*/
void FAST_FUNC open_transformer(int fd,
USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd),
IF_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd),
const char *transform_prog)
{
struct fd_pair fd_pipe;

View File

@ -190,7 +190,7 @@ static void extract_cpio_gz(int fd)
archive_handle_t *archive_handle;
unsigned char magic[2];
#if BB_MMU
USE_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
enum { xformer_prog = 0 };
#else
enum { xformer = 0 };
@ -224,7 +224,7 @@ static void extract_cpio_gz(int fd)
|| magic[0] != 'B' || magic[1] != 'Z'
) {
bb_error_msg_and_die("no gzip"
USE_FEATURE_SEAMLESS_BZ2("/bzip2")
IF_FEATURE_SEAMLESS_BZ2("/bzip2")
" magic");
}
#if BB_MMU

View File

@ -728,14 +728,14 @@ static void handle_SIGCHLD(int status)
enum {
OPTBIT_KEEP_OLD = 7,
USE_FEATURE_TAR_CREATE( OPTBIT_CREATE ,)
USE_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,)
USE_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,)
USE_FEATURE_SEAMLESS_LZMA(OPTBIT_LZMA ,)
USE_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
USE_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
USE_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
USE_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,)
IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,)
IF_FEATURE_TAR_CREATE( OPTBIT_DEREFERENCE ,)
IF_FEATURE_SEAMLESS_BZ2( OPTBIT_BZIP2 ,)
IF_FEATURE_SEAMLESS_LZMA(OPTBIT_LZMA ,)
IF_FEATURE_TAR_FROM( OPTBIT_INCLUDE_FROM,)
IF_FEATURE_TAR_FROM( OPTBIT_EXCLUDE_FROM,)
IF_FEATURE_SEAMLESS_GZ( OPTBIT_GZIP ,)
IF_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,)
OPTBIT_NOPRESERVE_OWN,
OPTBIT_NOPRESERVE_PERM,
OPTBIT_NUMERIC_OWNER,
@ -747,14 +747,14 @@ enum {
OPT_P = 1 << 5, // p
OPT_VERBOSE = 1 << 6, // v
OPT_KEEP_OLD = 1 << 7, // k
OPT_CREATE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c
OPT_DEREFERENCE = USE_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h
OPT_BZIP2 = USE_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j
OPT_LZMA = USE_FEATURE_SEAMLESS_LZMA((1 << OPTBIT_LZMA )) + 0, // a
OPT_INCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T
OPT_EXCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
OPT_GZIP = USE_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
OPT_COMPRESS = USE_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
OPT_CREATE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_CREATE )) + 0, // c
OPT_DEREFERENCE = IF_FEATURE_TAR_CREATE( (1 << OPTBIT_DEREFERENCE )) + 0, // h
OPT_BZIP2 = IF_FEATURE_SEAMLESS_BZ2( (1 << OPTBIT_BZIP2 )) + 0, // j
OPT_LZMA = IF_FEATURE_SEAMLESS_LZMA((1 << OPTBIT_LZMA )) + 0, // a
OPT_INCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_INCLUDE_FROM)) + 0, // T
OPT_EXCLUDE_FROM = IF_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X
OPT_GZIP = IF_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z
OPT_COMPRESS = IF_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z
OPT_NOPRESERVE_OWN = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner
OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER,
@ -832,24 +832,24 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
"\xff::" // cumulative lists for --exclude
#endif
USE_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
IF_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
IF_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
IF_NOT_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
applet_long_options = tar_longopts;
#endif
opt = getopt32(argv,
"txC:f:Opvk"
USE_FEATURE_TAR_CREATE( "ch" )
USE_FEATURE_SEAMLESS_BZ2( "j" )
USE_FEATURE_SEAMLESS_LZMA("a" )
USE_FEATURE_TAR_FROM( "T:X:")
USE_FEATURE_SEAMLESS_GZ( "z" )
USE_FEATURE_SEAMLESS_Z( "Z" )
IF_FEATURE_TAR_CREATE( "ch" )
IF_FEATURE_SEAMLESS_BZ2( "j" )
IF_FEATURE_SEAMLESS_LZMA("a" )
IF_FEATURE_TAR_FROM( "T:X:")
IF_FEATURE_SEAMLESS_GZ( "z" )
IF_FEATURE_SEAMLESS_Z( "Z" )
, &base_dir // -C dir
, &tar_filename // -f filename
USE_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T
USE_FEATURE_TAR_FROM(, &(tar_handle->reject)) // X
IF_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T
IF_FEATURE_TAR_FROM(, &(tar_handle->reject)) // X
#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
, &excludes // --exclude
#endif

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)) {

View 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) {

View File

@ -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;

View File

@ -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);

View File

@ -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(&current_time_t);) \
IF_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
IF_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
IF_FEATURE_LS_TIMESTAMPS(time(&current_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)) {

View File

@ -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)) {

View File

@ -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];

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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 */

View File

@ -124,7 +124,7 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv)
/* We require exactly one argument: the directory name */
/* We require exactly one argument: the directory name */
opt_complementary = "=1:a::";
getopt32(argv, "ra:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
getopt32(argv, "ra:u:t"IF_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p);
umask(xstrtou_range(umask_p, 8, 0, 07777));

View File

@ -347,13 +347,13 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
/* -xa (at least one) is required if -S is given */
/* -q turns off -v */
opt_complementary = "K:S:K--S:S--K:m?p:K?xpun:S?xa"
USE_FEATURE_START_STOP_DAEMON_FANCY("q-v");
IF_FEATURE_START_STOP_DAEMON_FANCY("q-v");
opt = getopt32(argv, "KSbqtma:n:s:u:c:x:p:"
USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"),
IF_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"),
&startas, &cmdname, &signame, &userspec, &chuid, &execname, &pidfile
USE_FEATURE_START_STOP_DAEMON_FANCY(,&opt_N)
IF_FEATURE_START_STOP_DAEMON_FANCY(,&opt_N)
/* We accept and ignore -R <param> / --retry <param> */
USE_FEATURE_START_STOP_DAEMON_FANCY(,NULL)
IF_FEATURE_START_STOP_DAEMON_FANCY(,NULL)
);
if (opt & OPT_s) {
@ -366,7 +366,7 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
if (!execname) /* in case -a is given and -x is not */
execname = startas;
// USE_FEATURE_START_STOP_DAEMON_FANCY(
// IF_FEATURE_START_STOP_DAEMON_FANCY(
// if (retry_arg)
// retries = xatoi_u(retry_arg);
// )

View File

@ -15,13 +15,13 @@
int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int which_main(int argc UNUSED_PARAM, char **argv)
{
USE_DESKTOP(int opt;)
IF_DESKTOP(int opt;)
int status = EXIT_SUCCESS;
char *path;
char *p;
opt_complementary = "-1"; /* at least one argument */
USE_DESKTOP(opt =) getopt32(argv, "a");
IF_DESKTOP(opt =) getopt32(argv, "a");
argv += optind;
/* This matches what is seen on e.g. ubuntu.

View File

@ -24,8 +24,8 @@ sub beautify {
my $text = shift;
for (;;) {
my $text2 = $text;
$text =~ s/SKIP_\w+\(.*?"\s*\)//sxg;
$text =~ s/USE_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
$text =~ s/IF_NOT_\w+\(.*?"\s*\)//sxg;
$text =~ s/IF_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
$text =~ s/USAGE_\w+\(\s*?(.*?)"\s*\)/$1"/sxg;
last if ( $text2 eq $text );
}

View File

@ -162,7 +162,7 @@ algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily:
Be sure to read the top of applets.h before adding your applet.
/* all programs above here are alphabetically "less than" 'mu' */
USE_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
/* all programs below here are alphabetically "greater than" 'mu' */

View File

@ -37,7 +37,7 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
{
FILE *fp1, *fp2, *outfile = stdout;
const char *filename1, *filename2 = "-";
USE_DESKTOP(off_t skip1 = 0, skip2 = 0;)
IF_DESKTOP(off_t skip1 = 0, skip2 = 0;)
off_t char_pos = 0;
int line_pos = 1; /* Hopefully won't overflow... */
const char *fmt;
@ -48,8 +48,8 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
xfunc_error_retval = 2; /* 1 is returned if files are different. */
opt_complementary = "-1"
USE_DESKTOP(":?4")
SKIP_DESKTOP(":?2")
IF_DESKTOP(":?4")
IF_NOT_DESKTOP(":?2")
":l--s:s--l";
opt = getopt32(argv, opt_chars);
argv += optind;

View File

@ -103,8 +103,8 @@ struct globals {
smallint exit_status;
int opt_U_context;
size_t max_context; /* size of context_vec_start */
USE_FEATURE_DIFF_DIR(int dl_count;)
USE_FEATURE_DIFF_DIR(char **dl;)
IF_FEATURE_DIFF_DIR(int dl_count;)
IF_FEATURE_DIFF_DIR(char **dl;)
char *opt_S_start;
const char *label1;
const char *label2;

View File

@ -271,7 +271,7 @@ struct globals {
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
last_file_modified = -1; \
/* "" but has space for 2 chars: */ \
USE_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \
IF_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \
} while (0)
@ -426,7 +426,7 @@ int vi_main(int argc, char **argv)
initial_cmds[0] = xstrndup(p, MAX_INPUT_LEN);
}
#endif
while ((c = getopt(argc, argv, "hCRH" USE_FEATURE_VI_COLON("c:"))) != -1) {
while ((c = getopt(argc, argv, "hCRH" IF_FEATURE_VI_COLON("c:"))) != -1) {
switch (c) {
#if ENABLE_FEATURE_VI_CRASHME
case 'C':
@ -643,8 +643,8 @@ static char *get_one_address(char *p, int *addr) // get colon addr, if present
{
int st;
char *q;
USE_FEATURE_VI_YANKMARK(char c;)
USE_FEATURE_VI_SEARCH(char *pat;)
IF_FEATURE_VI_YANKMARK(char c;)
IF_FEATURE_VI_SEARCH(char *pat;)
*addr = -1; // assume no addr
if (*p == '.') { // the current line
@ -883,10 +883,10 @@ static void colon(char *buf)
// how many lines in text[]?
li = count_lines(text, end - 1);
status_line("\"%s\"%s"
USE_FEATURE_VI_READONLY("%s")
IF_FEATURE_VI_READONLY("%s")
" %dL, %dC", current_filename,
(file_size(fn) < 0 ? " [New file]" : ""),
USE_FEATURE_VI_READONLY(
IF_FEATURE_VI_READONLY(
((readonly_mode) ? " [Readonly]" : ""),
)
li, ch);
@ -992,9 +992,9 @@ static void colon(char *buf)
// how many lines in text[]?
li = count_lines(q, q + ch - 1);
status_line("\"%s\""
USE_FEATURE_VI_READONLY("%s")
IF_FEATURE_VI_READONLY("%s")
" %dL, %dC", fn,
USE_FEATURE_VI_READONLY((readonly_mode ? " [Readonly]" : ""),)
IF_FEATURE_VI_READONLY((readonly_mode ? " [Readonly]" : ""),)
li, ch);
if (ch > 0) {
// if the insert is before "dot" then we need to update

View File

@ -62,8 +62,8 @@
/* This is a NOEXEC applet. Be very careful! */
USE_FEATURE_FIND_XDEV(static dev_t *xdev_dev;)
USE_FEATURE_FIND_XDEV(static int xdev_count;)
IF_FEATURE_FIND_XDEV(static dev_t *xdev_dev;)
IF_FEATURE_FIND_XDEV(static int xdev_count;)
typedef int (*action_fp)(const char *fileName, struct stat *statbuf, void *);
@ -79,23 +79,23 @@ typedef struct {
action_##name* ap UNUSED_PARAM)
ACTS(print)
ACTS(name, const char *pattern; bool iname;)
USE_FEATURE_FIND_PATH( ACTS(path, const char *pattern;))
USE_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;))
USE_FEATURE_FIND_PRINT0( ACTS(print0))
USE_FEATURE_FIND_TYPE( ACTS(type, int type_mask;))
USE_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;))
USE_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;))
USE_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;))
USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;))
USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;))
USE_FEATURE_FIND_USER( ACTS(user, uid_t uid;))
USE_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;))
USE_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;))
USE_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;))
USE_FEATURE_FIND_PRUNE( ACTS(prune))
USE_FEATURE_FIND_DELETE( ACTS(delete))
USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;))
USE_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;))
IF_FEATURE_FIND_PATH( ACTS(path, const char *pattern;))
IF_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;))
IF_FEATURE_FIND_PRINT0( ACTS(print0))
IF_FEATURE_FIND_TYPE( ACTS(type, int type_mask;))
IF_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;))
IF_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;))
IF_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;))
IF_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;))
IF_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;))
IF_FEATURE_FIND_USER( ACTS(user, uid_t uid;))
IF_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;))
IF_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;))
IF_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;))
IF_FEATURE_FIND_PRUNE( ACTS(prune))
IF_FEATURE_FIND_DELETE( ACTS(delete))
IF_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;))
IF_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;))
static action ***actions;
static bool need_print = 1;
@ -376,8 +376,8 @@ ACTF(context)
static int FAST_FUNC fileAction(const char *fileName,
struct stat *statbuf,
void *userData SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM),
int depth SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM))
void *userData IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM),
int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM))
{
int i;
#if ENABLE_FEATURE_FIND_MAXDEPTH
@ -451,73 +451,73 @@ static action*** parse_params(char **argv)
enum {
PARM_a ,
PARM_o ,
USE_FEATURE_FIND_NOT( PARM_char_not ,)
IF_FEATURE_FIND_NOT( PARM_char_not ,)
#if ENABLE_DESKTOP
PARM_and ,
PARM_or ,
USE_FEATURE_FIND_NOT( PARM_not ,)
IF_FEATURE_FIND_NOT( PARM_not ,)
#endif
PARM_print ,
USE_FEATURE_FIND_PRINT0( PARM_print0 ,)
USE_FEATURE_FIND_DEPTH( PARM_depth ,)
USE_FEATURE_FIND_PRUNE( PARM_prune ,)
USE_FEATURE_FIND_DELETE( PARM_delete ,)
USE_FEATURE_FIND_EXEC( PARM_exec ,)
USE_FEATURE_FIND_PAREN( PARM_char_brace,)
IF_FEATURE_FIND_PRINT0( PARM_print0 ,)
IF_FEATURE_FIND_DEPTH( PARM_depth ,)
IF_FEATURE_FIND_PRUNE( PARM_prune ,)
IF_FEATURE_FIND_DELETE( PARM_delete ,)
IF_FEATURE_FIND_EXEC( PARM_exec ,)
IF_FEATURE_FIND_PAREN( PARM_char_brace,)
/* All options starting from here require argument */
PARM_name ,
PARM_iname ,
USE_FEATURE_FIND_PATH( PARM_path ,)
USE_FEATURE_FIND_REGEX( PARM_regex ,)
USE_FEATURE_FIND_TYPE( PARM_type ,)
USE_FEATURE_FIND_PERM( PARM_perm ,)
USE_FEATURE_FIND_MTIME( PARM_mtime ,)
USE_FEATURE_FIND_MMIN( PARM_mmin ,)
USE_FEATURE_FIND_NEWER( PARM_newer ,)
USE_FEATURE_FIND_INUM( PARM_inum ,)
USE_FEATURE_FIND_USER( PARM_user ,)
USE_FEATURE_FIND_GROUP( PARM_group ,)
USE_FEATURE_FIND_SIZE( PARM_size ,)
USE_FEATURE_FIND_CONTEXT(PARM_context ,)
IF_FEATURE_FIND_PATH( PARM_path ,)
IF_FEATURE_FIND_REGEX( PARM_regex ,)
IF_FEATURE_FIND_TYPE( PARM_type ,)
IF_FEATURE_FIND_PERM( PARM_perm ,)
IF_FEATURE_FIND_MTIME( PARM_mtime ,)
IF_FEATURE_FIND_MMIN( PARM_mmin ,)
IF_FEATURE_FIND_NEWER( PARM_newer ,)
IF_FEATURE_FIND_INUM( PARM_inum ,)
IF_FEATURE_FIND_USER( PARM_user ,)
IF_FEATURE_FIND_GROUP( PARM_group ,)
IF_FEATURE_FIND_SIZE( PARM_size ,)
IF_FEATURE_FIND_CONTEXT(PARM_context ,)
};
static const char params[] ALIGN1 =
"-a\0"
"-o\0"
USE_FEATURE_FIND_NOT( "!\0" )
IF_FEATURE_FIND_NOT( "!\0" )
#if ENABLE_DESKTOP
"-and\0"
"-or\0"
USE_FEATURE_FIND_NOT( "-not\0" )
IF_FEATURE_FIND_NOT( "-not\0" )
#endif
"-print\0"
USE_FEATURE_FIND_PRINT0( "-print0\0" )
USE_FEATURE_FIND_DEPTH( "-depth\0" )
USE_FEATURE_FIND_PRUNE( "-prune\0" )
USE_FEATURE_FIND_DELETE( "-delete\0" )
USE_FEATURE_FIND_EXEC( "-exec\0" )
USE_FEATURE_FIND_PAREN( "(\0" )
IF_FEATURE_FIND_PRINT0( "-print0\0" )
IF_FEATURE_FIND_DEPTH( "-depth\0" )
IF_FEATURE_FIND_PRUNE( "-prune\0" )
IF_FEATURE_FIND_DELETE( "-delete\0" )
IF_FEATURE_FIND_EXEC( "-exec\0" )
IF_FEATURE_FIND_PAREN( "(\0" )
/* All options starting from here require argument */
"-name\0"
"-iname\0"
USE_FEATURE_FIND_PATH( "-path\0" )
USE_FEATURE_FIND_REGEX( "-regex\0" )
USE_FEATURE_FIND_TYPE( "-type\0" )
USE_FEATURE_FIND_PERM( "-perm\0" )
USE_FEATURE_FIND_MTIME( "-mtime\0" )
USE_FEATURE_FIND_MMIN( "-mmin\0" )
USE_FEATURE_FIND_NEWER( "-newer\0" )
USE_FEATURE_FIND_INUM( "-inum\0" )
USE_FEATURE_FIND_USER( "-user\0" )
USE_FEATURE_FIND_GROUP( "-group\0" )
USE_FEATURE_FIND_SIZE( "-size\0" )
USE_FEATURE_FIND_CONTEXT("-context\0")
IF_FEATURE_FIND_PATH( "-path\0" )
IF_FEATURE_FIND_REGEX( "-regex\0" )
IF_FEATURE_FIND_TYPE( "-type\0" )
IF_FEATURE_FIND_PERM( "-perm\0" )
IF_FEATURE_FIND_MTIME( "-mtime\0" )
IF_FEATURE_FIND_MMIN( "-mmin\0" )
IF_FEATURE_FIND_NEWER( "-newer\0" )
IF_FEATURE_FIND_INUM( "-inum\0" )
IF_FEATURE_FIND_USER( "-user\0" )
IF_FEATURE_FIND_GROUP( "-group\0" )
IF_FEATURE_FIND_SIZE( "-size\0" )
IF_FEATURE_FIND_CONTEXT("-context\0")
;
action*** appp;
unsigned cur_group = 0;
unsigned cur_action = 0;
USE_FEATURE_FIND_NOT( bool invert_flag = 0; )
IF_FEATURE_FIND_NOT( bool invert_flag = 0; )
/* This is the only place in busybox where we use nested function.
* So far more standard alternatives were bigger. */
@ -530,8 +530,8 @@ static action*** parse_params(char **argv)
appp[cur_group][cur_action++] = ap = xmalloc(sizeof_struct);
appp[cur_group][cur_action] = NULL;
ap->f = f;
USE_FEATURE_FIND_NOT( ap->invert = invert_flag; )
USE_FEATURE_FIND_NOT( invert_flag = 0; )
IF_FEATURE_FIND_NOT( ap->invert = invert_flag; )
IF_FEATURE_FIND_NOT( invert_flag = 0; )
return ap;
}
@ -569,10 +569,10 @@ static action*** parse_params(char **argv)
* it doesn't give smaller code. Other arches? */
/* --- Operators --- */
if (parm == PARM_a USE_DESKTOP(|| parm == PARM_and)) {
if (parm == PARM_a IF_DESKTOP(|| parm == PARM_and)) {
/* no further special handling required */
}
else if (parm == PARM_o USE_DESKTOP(|| parm == PARM_or)) {
else if (parm == PARM_o IF_DESKTOP(|| parm == PARM_or)) {
/* start new OR group */
cur_group++;
appp = xrealloc(appp, (cur_group+2) * sizeof(*appp));
@ -581,7 +581,7 @@ static action*** parse_params(char **argv)
cur_action = 0;
}
#if ENABLE_FEATURE_FIND_NOT
else if (parm == PARM_char_not USE_DESKTOP(|| parm == PARM_not)) {
else if (parm == PARM_char_not IF_DESKTOP(|| parm == PARM_not)) {
/* also handles "find ! ! -name 'foo*'" */
invert_flag ^= 1;
}
@ -591,13 +591,13 @@ static action*** parse_params(char **argv)
else if (parm == PARM_print) {
need_print = 0;
/* GNU find ignores '!' here: "find ! -print" */
USE_FEATURE_FIND_NOT( invert_flag = 0; )
IF_FEATURE_FIND_NOT( invert_flag = 0; )
(void) ALLOC_ACTION(print);
}
#if ENABLE_FEATURE_FIND_PRINT0
else if (parm == PARM_print0) {
need_print = 0;
USE_FEATURE_FIND_NOT( invert_flag = 0; )
IF_FEATURE_FIND_NOT( invert_flag = 0; )
(void) ALLOC_ACTION(print0);
}
#endif
@ -608,7 +608,7 @@ static action*** parse_params(char **argv)
#endif
#if ENABLE_FEATURE_FIND_PRUNE
else if (parm == PARM_prune) {
USE_FEATURE_FIND_NOT( invert_flag = 0; )
IF_FEATURE_FIND_NOT( invert_flag = 0; )
(void) ALLOC_ACTION(prune);
}
#endif
@ -624,7 +624,7 @@ static action*** parse_params(char **argv)
int i;
action_exec *ap;
need_print = 0;
USE_FEATURE_FIND_NOT( invert_flag = 0; )
IF_FEATURE_FIND_NOT( invert_flag = 0; )
ap = ALLOC_ACTION(exec);
ap->exec_argv = ++argv; /* first arg after -exec */
ap->exec_argc = 0;
@ -813,13 +813,13 @@ int find_main(int argc, char **argv)
{
static const char options[] ALIGN1 =
"-follow\0"
USE_FEATURE_FIND_XDEV( "-xdev\0" )
USE_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0")
IF_FEATURE_FIND_XDEV( "-xdev\0" )
IF_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0")
;
enum {
OPT_FOLLOW,
USE_FEATURE_FIND_XDEV( OPT_XDEV ,)
USE_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,)
IF_FEATURE_FIND_XDEV( OPT_XDEV ,)
IF_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,)
};
char *arg;

View File

@ -25,10 +25,10 @@
/* options */
#define OPTSTR_GREP \
"lnqvscFiHhe:f:Lorm:" \
USE_FEATURE_GREP_CONTEXT("A:B:C:") \
USE_FEATURE_GREP_EGREP_ALIAS("E") \
USE_DESKTOP("w") \
USE_EXTRA_COMPAT("z") \
IF_FEATURE_GREP_CONTEXT("A:B:C:") \
IF_FEATURE_GREP_EGREP_ALIAS("E") \
IF_DESKTOP("w") \
IF_EXTRA_COMPAT("z") \
"aI"
/* ignored: -a "assume all files to be text" */
@ -51,12 +51,12 @@ enum {
OPTBIT_o, /* show only matching parts of lines */
OPTBIT_r, /* recurse dirs */
OPTBIT_m, /* -m MAX_MATCHES */
USE_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
USE_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
USE_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
USE_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */
USE_DESKTOP( OPTBIT_w ,) /* whole word match */
USE_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */
IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */
IF_DESKTOP( OPTBIT_w ,) /* whole word match */
IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */
OPT_l = 1 << OPTBIT_l,
OPT_n = 1 << OPTBIT_n,
OPT_q = 1 << OPTBIT_q,
@ -73,12 +73,12 @@ enum {
OPT_o = 1 << OPTBIT_o,
OPT_r = 1 << OPTBIT_r,
OPT_m = 1 << OPTBIT_m,
OPT_A = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
OPT_B = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
OPT_C = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
OPT_E = USE_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0,
OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0,
OPT_z = USE_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0,
OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0,
OPT_w = IF_DESKTOP( (1 << OPTBIT_w)) + 0,
OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0,
};
#define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l)
@ -105,7 +105,7 @@ struct globals {
int lines_before;
int lines_after;
char **before_buf;
USE_EXTRA_COMPAT(size_t *before_buf_size;)
IF_EXTRA_COMPAT(size_t *before_buf_size;)
int last_line_printed;
#endif
/* globals used internally */
@ -400,7 +400,7 @@ static int grep_file(FILE *file)
/* Add the line to the circular 'before' buffer */
free(before_buf[curpos]);
before_buf[curpos] = line;
USE_EXTRA_COMPAT(before_buf_size[curpos] = line_len;)
IF_EXTRA_COMPAT(before_buf_size[curpos] = line_len;)
curpos = (curpos + 1) % lines_before;
/* avoid free(line) - we took the line */
line = NULL;
@ -544,7 +544,7 @@ int grep_main(int argc, char **argv)
lines_after = 0;
} else if (lines_before > 0) {
before_buf = xzalloc(lines_before * sizeof(before_buf[0]));
USE_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));)
IF_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));)
}
#else
/* with auto sanity checks */

View File

@ -356,9 +356,9 @@ enum {
OPTBIT_UPTO_SIZE,
OPTBIT_EOF_STRING,
OPTBIT_EOF_STRING1,
USE_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,)
USE_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,)
USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,)
IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,)
IF_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,)
IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,)
OPT_VERBOSE = 1 << OPTBIT_VERBOSE ,
OPT_NO_EMPTY = 1 << OPTBIT_NO_EMPTY ,
@ -366,14 +366,14 @@ enum {
OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE ,
OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */
OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */
OPT_INTERACTIVE = USE_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0,
OPT_TERMINATE = USE_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0,
OPT_ZEROTERM = USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0,
OPT_INTERACTIVE = IF_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0,
OPT_TERMINATE = IF_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0,
OPT_ZEROTERM = IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0,
};
#define OPTION_STR "+trn:s:e::E:" \
USE_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \
USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \
USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0")
IF_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \
IF_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \
IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0")
int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int xargs_main(int argc, char **argv)
@ -405,7 +405,7 @@ int xargs_main(int argc, char **argv)
eof_str = NULL;
if (opt & OPT_ZEROTERM)
USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin);
IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin);
argv += optind;
argc -= optind;

View File

@ -67,358 +67,358 @@ s - suid type:
#endif
USE_TEST(APPLET_NOFORK([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
USE_TEST(APPLET_NOFORK([[, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
USE_ACPID(APPLET(acpid, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_ADDGROUP(APPLET(addgroup, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_ADDUSER(APPLET(adduser, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk))
USE_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename))
USE_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER))
//USE_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_BRCTL(APPLET(brctl, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER, bzcat))
USE_BZIP2(APPLET(bzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat))
USE_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CHAT(APPLET(chat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CHGRP(APPLET_NOEXEC(chgrp, chgrp, _BB_DIR_BIN, _BB_SUID_NEVER, chgrp))
USE_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod))
USE_CHOWN(APPLET_NOEXEC(chown, chown, _BB_DIR_BIN, _BB_SUID_NEVER, chown))
USE_CHPASSWD(APPLET(chpasswd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_CHPST(APPLET(chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CHROOT(APPLET(chroot, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_CHRT(APPLET(chrt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CHVT(APPLET(chvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CKSUM(APPLET(cksum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CLEAR(APPLET(clear, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CMP(APPLET(cmp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_COMM(APPLET(comm, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CP(APPLET_NOEXEC(cp, cp, _BB_DIR_BIN, _BB_SUID_NEVER, cp))
USE_CPIO(APPLET(cpio, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CROND(APPLET(crond, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_CRONTAB(APPLET(crontab, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_CRYPTPW(APPLET(cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_CTTYHACK(APPLET(cttyhack, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CUT(APPLET_NOEXEC(cut, cut, _BB_DIR_USR_BIN, _BB_SUID_NEVER, cut))
USE_DATE(APPLET(date, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_DC(APPLET(dc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DD(APPLET_NOEXEC(dd, dd, _BB_DIR_BIN, _BB_SUID_NEVER, dd))
USE_DEALLOCVT(APPLET(deallocvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DELGROUP(APPLET_ODDNAME(delgroup, deluser, _BB_DIR_BIN, _BB_SUID_NEVER, delgroup))
USE_DELUSER(APPLET(deluser, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_DEPMOD(APPLET(depmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
USE_DEVFSD(APPLET(devfsd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_DEVMEM(APPLET(devmem, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname))
USE_DMESG(APPLET(dmesg, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_DNSD(APPLET(dnsd, _BB_DIR_USR_SBIN, _BB_SUID_ALWAYS))
USE_DOS2UNIX(APPLET(dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DPKG(APPLET(dpkg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dpkg_deb))
USE_DU(APPLET(du, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_DUMPKMAP(APPLET(dumpkmap, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_APP_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//USE_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
//USE_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, e2label))
USE_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_NEVER, echo))
USE_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, egrep))
USE_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_ENV(APPLET_NOEXEC(env, env, _BB_DIR_USR_BIN, _BB_SUID_NEVER, env))
USE_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envdir))
USE_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envuidgid))
USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake))
USE_EXPAND(APPLET(expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_EXPR(APPLET(expr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false))
USE_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FBSPLASH(APPLET(fbsplash, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush))
USE_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, fgrep))
USE_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_NEVER, find))
USE_FINDFS(APPLET(findfs, _BB_DIR_SBIN, _BB_SUID_MAYBE))
//USE_FLASH_ERASEALL(APPLET_ODDNAME(flash_eraseall, flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER, flash_eraseall))
USE_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
//USE_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext2))
//USE_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext3))
USE_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix))
USE_FTPD(APPLET(ftpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpget))
USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpput))
USE_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_HD(APPLET_NOEXEC(hd, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hd))
USE_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump))
USE_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hostid))
USE_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_HUSH(APPLET(hush, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_HWCLOCK(APPLET(hwclock, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_ID(APPLET(id, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_IFCONFIG(APPLET(ifconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, _BB_DIR_SBIN, _BB_SUID_NEVER, ifdown))
USE_IFENSLAVE(APPLET(ifenslave, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, _BB_DIR_SBIN, _BB_SUID_NEVER, ifup))
USE_INETD(APPLET(inetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_INIT(APPLET(init, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_INOTIFYD(APPLET(inotifyd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
USE_INSTALL(APPLET(install, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_IONICE(APPLET(ionice, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_TEST(APPLET_NOFORK([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
IF_TEST(APPLET_NOFORK([[, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
IF_ACPID(APPLET(acpid, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_ADDGROUP(APPLET(addgroup, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_ADDUSER(APPLET(adduser, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk))
IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename))
IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER))
//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_BRCTL(APPLET(brctl, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER, bzcat))
IF_BZIP2(APPLET(bzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat))
IF_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_CHAT(APPLET(chat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, _BB_DIR_BIN, _BB_SUID_NEVER, chgrp))
IF_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod))
IF_CHOWN(APPLET_NOEXEC(chown, chown, _BB_DIR_BIN, _BB_SUID_NEVER, chown))
IF_CHPASSWD(APPLET(chpasswd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_CHPST(APPLET(chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CHROOT(APPLET(chroot, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_CHRT(APPLET(chrt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CHVT(APPLET(chvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CKSUM(APPLET(cksum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CLEAR(APPLET(clear, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CMP(APPLET(cmp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_COMM(APPLET(comm, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CP(APPLET_NOEXEC(cp, cp, _BB_DIR_BIN, _BB_SUID_NEVER, cp))
IF_CPIO(APPLET(cpio, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_CROND(APPLET(crond, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_CRONTAB(APPLET(crontab, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
IF_CRYPTPW(APPLET(cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_CTTYHACK(APPLET(cttyhack, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_CUT(APPLET_NOEXEC(cut, cut, _BB_DIR_USR_BIN, _BB_SUID_NEVER, cut))
IF_DATE(APPLET(date, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_DC(APPLET(dc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DD(APPLET_NOEXEC(dd, dd, _BB_DIR_BIN, _BB_SUID_NEVER, dd))
IF_DEALLOCVT(APPLET(deallocvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DELGROUP(APPLET_ODDNAME(delgroup, deluser, _BB_DIR_BIN, _BB_SUID_NEVER, delgroup))
IF_DELUSER(APPLET(deluser, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_DEPMOD(APPLET(depmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
IF_DEVFSD(APPLET(devfsd, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_DEVMEM(APPLET(devmem, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname))
IF_DMESG(APPLET(dmesg, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_DNSD(APPLET(dnsd, _BB_DIR_USR_SBIN, _BB_SUID_ALWAYS))
IF_DOS2UNIX(APPLET(dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DPKG(APPLET(dpkg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dpkg_deb))
IF_DU(APPLET(du, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_DUMPKMAP(APPLET(dumpkmap, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_APP_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//IF_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, e2label))
IF_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_NEVER, echo))
IF_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, egrep))
IF_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_ENV(APPLET_NOEXEC(env, env, _BB_DIR_USR_BIN, _BB_SUID_NEVER, env))
IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envdir))
IF_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envuidgid))
IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake))
IF_EXPAND(APPLET(expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_EXPR(APPLET(expr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false))
IF_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_FBSPLASH(APPLET(fbsplash, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush))
IF_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER, fgrep))
IF_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_NEVER, find))
IF_FINDFS(APPLET(findfs, _BB_DIR_SBIN, _BB_SUID_MAYBE))
//IF_FLASH_ERASEALL(APPLET_ODDNAME(flash_eraseall, flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER, flash_eraseall))
IF_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext2))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_ext3))
IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix))
IF_FTPD(APPLET(ftpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpget))
IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpput))
IF_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_HD(APPLET_NOEXEC(hd, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hd))
IF_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump))
IF_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hostid))
IF_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_HUSH(APPLET(hush, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_HWCLOCK(APPLET(hwclock, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_ID(APPLET(id, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_IFCONFIG(APPLET(ifconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, _BB_DIR_SBIN, _BB_SUID_NEVER, ifdown))
IF_IFENSLAVE(APPLET(ifenslave, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, _BB_DIR_SBIN, _BB_SUID_NEVER, ifup))
IF_INETD(APPLET(inetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_INIT(APPLET(init, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_INOTIFYD(APPLET(inotifyd, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
IF_INSTALL(APPLET(install, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_IONICE(APPLET(ionice, _BB_DIR_BIN, _BB_SUID_NEVER))
#if ENABLE_FEATURE_IP_ADDRESS \
|| ENABLE_FEATURE_IP_ROUTE \
|| ENABLE_FEATURE_IP_LINK \
|| ENABLE_FEATURE_IP_TUNNEL \
|| ENABLE_FEATURE_IP_RULE
USE_IP(APPLET(ip, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IP(APPLET(ip, _BB_DIR_BIN, _BB_SUID_NEVER))
#endif
USE_IPADDR(APPLET(ipaddr, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_IPCRM(APPLET(ipcrm, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_IPCS(APPLET(ipcs, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_IPRULE(APPLET(iprule, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KBD_MODE(APPLET(kbd_mode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall))
USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5))
USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_NEVER, length))
USE_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SETARCH(APPLET_ODDNAME(linux32, setarch, _BB_DIR_BIN, _BB_SUID_NEVER, linux32))
USE_SETARCH(APPLET_ODDNAME(linux64, setarch, _BB_DIR_BIN, _BB_SUID_NEVER, linux64))
USE_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, _BB_DIR_ROOT, _BB_SUID_NEVER, linuxrc))
USE_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN, _BB_SUID_NEVER, ln))
USE_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS))
USE_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname))
USE_LOGREAD(APPLET(logread, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LOSETUP(APPLET(losetup, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LPD(APPLET(lpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_LPQ(APPLET_ODDNAME(lpq, lpqr, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lpq))
USE_LPR(APPLET_ODDNAME(lpr, lpqr, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lpr))
USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls))
USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat))
USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MAKEMIME(APPLET(makemime, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MAN(APPLET(man, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MICROCOM(APPLET(microcom, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
USE_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
//USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//USE_MKE2FS(APPLET_ODDNAME(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext2))
//USE_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext3))
USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
USE_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER, mkpasswd))
USE_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MKTEMP(APPLET(mktemp, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MODPROBE(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MORE(APPLET(more, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MOUNT(APPLET(mount, _BB_DIR_BIN, USE_DESKTOP(_BB_SUID_MAYBE) SKIP_DESKTOP(_BB_SUID_NEVER)))
USE_MOUNTPOINT(APPLET(mountpoint, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MSH(APPLET(msh, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_OD(APPLET(od, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_OPENVT(APPLET(openvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//USE_PARSE(APPLET(parse, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_PASSWD(APPLET(passwd, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_PATCH(APPLET(patch, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_PGREP(APPLET(pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_PIDOF(APPLET(pidof, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_PING(APPLET(ping, _BB_DIR_BIN, _BB_SUID_MAYBE))
USE_PING6(APPLET(ping6, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_PIPE_PROGRESS(APPLET(pipe_progress, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_PIVOT_ROOT(APPLET(pivot_root, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_PKILL(APPLET_ODDNAME(pkill, pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER, pkill))
USE_POPMAILDIR(APPLET(popmaildir, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, poweroff))
USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_PRINTF(APPLET_NOFORK(printf, printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER, printf))
USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_PSCAN(APPLET(pscan, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd))
USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_RDEV(APPLET(rdev, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_READLINK(APPLET(readlink, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_READPROFILE(APPLET(readprofile, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_REALPATH(APPLET(realpath, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, reboot))
USE_REFORMIME(APPLET(reformime, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER, restorecon))
USE_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm))
USE_RMDIR(APPLET_NOFORK(rmdir, rmdir, _BB_DIR_BIN, _BB_SUID_NEVER, rmdir))
USE_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
USE_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RTCWAKE(APPLET(rtcwake, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts))
USE_RUNCON(APPLET(runcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_RUNSV(APPLET(runsv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RUNSVDIR(APPLET(runsvdir, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SCRIPT(APPLET(script, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_SELINUXENABLED(APPLET(selinuxenabled, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SENDMAIL(APPLET(sendmail, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SEQ(APPLET_NOFORK(seq, seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER, seq))
USE_SESTATUS(APPLET(sestatus, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SETARCH(APPLET(setarch, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SETFILES(APPLET(setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SETFONT(APPLET(setfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SETKEYCODES(APPLET(setkeycodes, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, setuidgid))
USE_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum))
USE_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha256sum))
USE_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha512sum))
USE_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep))
USE_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, softlimit))
USE_SORT(APPLET_NOEXEC(sort, sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sort))
USE_SPLIT(APPLET(split, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, _BB_DIR_SBIN, _BB_SUID_NEVER, start_stop_daemon))
USE_STAT(APPLET(stat, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_STRINGS(APPLET(strings, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_STTY(APPLET(stty, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_SU(APPLET(su, _BB_DIR_BIN, _BB_SUID_ALWAYS))
USE_SULOGIN(APPLET(sulogin, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SUM(APPLET(sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SV(APPLET(sv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_SVLOGD(APPLET(svlogd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff))
USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon))
USE_SWITCH_ROOT(APPLET(switch_root, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SYNC(APPLET_NOFORK(sync, sync, _BB_DIR_BIN, _BB_SUID_NEVER, sync))
USE_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_TAC(APPLET_NOEXEC(tac, tac, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tac))
USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_TASKSET(APPLET(taskset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
/* USE_TC(APPLET(tc, _BB_DIR_SBIN, _BB_SUID_NEVER)) */
USE_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tcpsvd))
USE_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_TEST(APPLET_NOFORK(test, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
IF_IPADDR(APPLET(ipaddr, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IPCRM(APPLET(ipcrm, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
IF_IPCS(APPLET(ipcs, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
IF_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IPRULE(APPLET(iprule, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_KBD_MODE(APPLET(kbd_mode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall))
IF_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5))
IF_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_NEVER, length))
IF_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SETARCH(APPLET_ODDNAME(linux32, setarch, _BB_DIR_BIN, _BB_SUID_NEVER, linux32))
IF_SETARCH(APPLET_ODDNAME(linux64, setarch, _BB_DIR_BIN, _BB_SUID_NEVER, linux64))
IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, _BB_DIR_ROOT, _BB_SUID_NEVER, linuxrc))
IF_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN, _BB_SUID_NEVER, ln))
IF_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_LOADFONT(APPLET(loadfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS))
IF_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname))
IF_LOGREAD(APPLET(logread, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_LOSETUP(APPLET(losetup, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_LPD(APPLET(lpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_LPQ(APPLET_ODDNAME(lpq, lpqr, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lpq))
IF_LPR(APPLET_ODDNAME(lpr, lpqr, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lpr))
IF_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls))
IF_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
IF_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat))
IF_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MAKEMIME(APPLET(makemime, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MAN(APPLET(man, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
IF_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_MICROCOM(APPLET(microcom, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
//IF_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//IF_MKE2FS(APPLET_ODDNAME(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext2))
//IF_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext3))
IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_vfat))
IF_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER, mkpasswd))
IF_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MKTEMP(APPLET(mktemp, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MODPROBE(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MODPROBE_SMALL(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MORE(APPLET(more, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MOUNT(APPLET(mount, _BB_DIR_BIN, IF_DESKTOP(_BB_SUID_MAYBE) IF_NOT_DESKTOP(_BB_SUID_NEVER)))
IF_MOUNTPOINT(APPLET(mountpoint, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MSH(APPLET(msh, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MT(APPLET(mt, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_MV(APPLET(mv, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_OD(APPLET(od, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_OPENVT(APPLET(openvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//IF_PARSE(APPLET(parse, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_PASSWD(APPLET(passwd, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
IF_PATCH(APPLET(patch, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_PGREP(APPLET(pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_PIDOF(APPLET(pidof, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_PING(APPLET(ping, _BB_DIR_BIN, _BB_SUID_MAYBE))
IF_PING6(APPLET(ping6, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_PIPE_PROGRESS(APPLET(pipe_progress, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_PIVOT_ROOT(APPLET(pivot_root, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_PKILL(APPLET_ODDNAME(pkill, pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER, pkill))
IF_POPMAILDIR(APPLET(popmaildir, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, poweroff))
IF_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_PRINTF(APPLET_NOFORK(printf, printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER, printf))
IF_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_PSCAN(APPLET(pscan, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd))
IF_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_RDEV(APPLET(rdev, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_READLINK(APPLET(readlink, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_READPROFILE(APPLET(readprofile, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_REALPATH(APPLET(realpath, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, reboot))
IF_REFORMIME(APPLET(reformime, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER, restorecon))
IF_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm))
IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, _BB_DIR_BIN, _BB_SUID_NEVER, rmdir))
IF_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER, modprobe))
IF_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RTCWAKE(APPLET(rtcwake, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts))
IF_RUNCON(APPLET(runcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_RUNSV(APPLET(runsv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RUNSVDIR(APPLET(runsvdir, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SCRIPT(APPLET(script, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_SELINUXENABLED(APPLET(selinuxenabled, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SENDMAIL(APPLET(sendmail, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SEQ(APPLET_NOFORK(seq, seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER, seq))
IF_SESTATUS(APPLET(sestatus, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SETARCH(APPLET(setarch, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SETFILES(APPLET(setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SETFONT(APPLET(setfont, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SETKEYCODES(APPLET(setkeycodes, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, setuidgid))
IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
IF_FEATURE_SH_IS_MSH(APPLET_ODDNAME(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER, sh))
IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum))
IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha256sum))
IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha512sum))
IF_SHOWKEY(APPLET(showkey, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep))
IF_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, softlimit))
IF_SORT(APPLET_NOEXEC(sort, sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sort))
IF_SPLIT(APPLET(split, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, _BB_DIR_SBIN, _BB_SUID_NEVER, start_stop_daemon))
IF_STAT(APPLET(stat, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_STRINGS(APPLET(strings, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_STTY(APPLET(stty, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_SU(APPLET(su, _BB_DIR_BIN, _BB_SUID_ALWAYS))
IF_SULOGIN(APPLET(sulogin, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SUM(APPLET(sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SV(APPLET(sv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_SVLOGD(APPLET(svlogd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff))
IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon))
IF_SWITCH_ROOT(APPLET(switch_root, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SYNC(APPLET_NOFORK(sync, sync, _BB_DIR_BIN, _BB_SUID_NEVER, sync))
IF_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_TAC(APPLET_NOEXEC(tac, tac, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tac))
IF_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_TASKSET(APPLET(taskset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
/* IF_TC(APPLET(tc, _BB_DIR_SBIN, _BB_SUID_NEVER)) */
IF_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tcpsvd))
IF_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_TEST(APPLET_NOFORK(test, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT
USE_TFTP(APPLET(tftp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TFTPD(APPLET(tftpd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TFTP(APPLET(tftp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TFTPD(APPLET(tftpd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
#endif
USE_TIME(APPLET(time, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TIMEOUT(APPLET(timeout, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TOP(APPLET(top, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch))
USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE))
USE_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true))
USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TTYSIZE(APPLET(ttysize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_TUNCTL(APPLET(tunctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
//USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, udpsvd))
USE_UMOUNT(APPLET(umount, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_UNAME(APPLET(uname, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_UNCOMPRESS(APPLET(uncompress, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_UNEXPAND(APPLET_ODDNAME(unexpand, expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unexpand))
USE_UNIQ(APPLET(uniq, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UNIX2DOS(APPLET_ODDNAME(unix2dos, dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unix2dos))
USE_UNLZMA(APPLET(unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UNZIP(APPLET(unzip, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UPTIME(APPLET(uptime, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_USLEEP(APPLET_NOFORK(usleep, usleep, _BB_DIR_BIN, _BB_SUID_NEVER, usleep))
USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_WC(APPLET(wc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER, whoami))
USE_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER, xargs))
USE_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes))
USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat))
USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_TIME(APPLET(time, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TIMEOUT(APPLET(timeout, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TOP(APPLET(top, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch))
IF_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE))
IF_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true))
IF_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TTYSIZE(APPLET(ttysize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_TUNCTL(APPLET(tunctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
//IF_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
IF_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, udpsvd))
IF_UMOUNT(APPLET(umount, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_UNAME(APPLET(uname, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_UNCOMPRESS(APPLET(uncompress, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unexpand))
IF_UNIQ(APPLET(uniq, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_UNIX2DOS(APPLET_ODDNAME(unix2dos, dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unix2dos))
IF_UNLZMA(APPLET(unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_UNZIP(APPLET(unzip, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_UPTIME(APPLET(uptime, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_USLEEP(APPLET_NOFORK(usleep, usleep, _BB_DIR_BIN, _BB_SUID_NEVER, usleep))
IF_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
IF_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
IF_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_NEVER))
IF_WC(APPLET(wc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
IF_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER, whoami))
IF_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER, xargs))
IF_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes))
IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat))
IF_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER))
#if !defined(PROTOTYPES) && !defined(NAME_MAIN_CNAME) && !defined(MAKE_USAGE)
};

View File

@ -260,7 +260,7 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
FILEUTILS_SET_SECURITY_CONTEXT = 0x200
#endif
};
#define FILEUTILS_CP_OPTSTR "pdRfilsL" USE_SELINUX("c")
#define FILEUTILS_CP_OPTSTR "pdRfilsL" IF_SELINUX("c")
extern int remove_file(const char *path, int flags) FAST_FUNC;
/* NB: without FILEUTILS_RECUR in flags, it will basically "cat"
* the source, not copy (unless "source" is a directory).
@ -916,15 +916,15 @@ extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUN
/* Applets which are useful from another applets */
int bb_cat(char** argv);
/* If shell needs them, they exist even if not enabled as applets */
int echo_main(int argc, char** argv) USE_ECHO(MAIN_EXTERNALLY_VISIBLE);
int printf_main(int argc, char **argv) USE_PRINTF(MAIN_EXTERNALLY_VISIBLE);
int test_main(int argc, char **argv) USE_TEST(MAIN_EXTERNALLY_VISIBLE);
int kill_main(int argc, char **argv) USE_KILL(MAIN_EXTERNALLY_VISIBLE);
int echo_main(int argc, char** argv) IF_ECHO(MAIN_EXTERNALLY_VISIBLE);
int printf_main(int argc, char **argv) IF_PRINTF(MAIN_EXTERNALLY_VISIBLE);
int test_main(int argc, char **argv) IF_TEST(MAIN_EXTERNALLY_VISIBLE);
int kill_main(int argc, char **argv) IF_KILL(MAIN_EXTERNALLY_VISIBLE);
/* Similar, but used by chgrp, not shell */
int chown_main(int argc, char **argv) USE_CHOWN(MAIN_EXTERNALLY_VISIBLE);
int chown_main(int argc, char **argv) IF_CHOWN(MAIN_EXTERNALLY_VISIBLE);
/* Used by ftpd */
int ls_main(int argc, char **argv) USE_LS(MAIN_EXTERNALLY_VISIBLE);
/* Don't need USE_xxx() guard for these */
int ls_main(int argc, char **argv) IF_LS(MAIN_EXTERNALLY_VISIBLE);
/* Don't need IF_xxx() guard for these */
int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@ -1253,7 +1253,7 @@ typedef struct procps_status_t {
/* Fields are set to 0/NULL if failed to determine (or not requested) */
uint16_t argv_len;
char *argv0;
USE_SELINUX(char *context;)
IF_SELINUX(char *context;)
/* Everything below must contain no ptrs to malloc'ed data:
* it is memset(0) for each process in procps_scan() */
unsigned long vsz, rss; /* we round it to kbytes */
@ -1309,7 +1309,7 @@ enum {
|| ENABLE_PIDOF
|| ENABLE_SESTATUS
),
USE_SELINUX(PSSCAN_CONTEXT = 1 << 17,)
IF_SELINUX(PSSCAN_CONTEXT = 1 << 17,)
PSSCAN_START_TIME = 1 << 18,
PSSCAN_CPU = 1 << 19,
/* These are all retrieved from proc/NN/stat in one go: */

View File

@ -125,24 +125,24 @@ typedef struct inflate_unzip_result {
uint32_t crc;
} inflate_unzip_result;
USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC;
IF_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC;
/* lzma unpacker takes .lzma stream from offset 0 */
USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC;
IF_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC;
/* the rest wants 2 first bytes already skipped by the caller */
USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC;
USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC;
USE_DESKTOP(long long) int unpack_gz_stream_with_info(int src_fd, int dst_fd, unpack_info_t *info) FAST_FUNC;
USE_DESKTOP(long long) int unpack_Z_stream(int fd_in, int fd_out) FAST_FUNC;
IF_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC;
IF_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC;
IF_DESKTOP(long long) int unpack_gz_stream_with_info(int src_fd, int dst_fd, unpack_info_t *info) FAST_FUNC;
IF_DESKTOP(long long) int unpack_Z_stream(int fd_in, int fd_out) FAST_FUNC;
/* wrapper which checks first two bytes to be "BZ" */
USE_DESKTOP(long long) int unpack_bz2_stream_prime(int src_fd, int dst_fd) FAST_FUNC;
IF_DESKTOP(long long) int unpack_bz2_stream_prime(int src_fd, int dst_fd) FAST_FUNC;
int bbunpack(char **argv,
char* (*make_new_name)(char *filename),
USE_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)) FAST_FUNC;
IF_DESKTOP(long long) int (*unpacker)(unpack_info_t *info)) FAST_FUNC;
#if BB_MMU
void open_transformer(int fd,
USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC;
IF_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC;
#define open_transformer(fd, transformer, transform_prog) open_transformer(fd, transformer)
#else
void open_transformer(int src_fd, const char *transform_prog) FAST_FUNC;

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,8 @@ static const char usage_messages[] ALIGN1 = ""
#ifdef SINGLE_APPLET_MAIN
#undef ENABLE_FEATURE_INDIVIDUAL
#define ENABLE_FEATURE_INDIVIDUAL 1
#undef USE_FEATURE_INDIVIDUAL
#define USE_FEATURE_INDIVIDUAL(...) __VA_ARGS__
#undef IF_FEATURE_INDIVIDUAL
#define IF_FEATURE_INDIVIDUAL(...) __VA_ARGS__
#endif
@ -179,10 +179,10 @@ int FAST_FUNC find_applet_by_name(const char *name)
void lbb_prepare(const char *applet
USE_FEATURE_INDIVIDUAL(, char **argv))
IF_FEATURE_INDIVIDUAL(, char **argv))
MAIN_EXTERNALLY_VISIBLE;
void lbb_prepare(const char *applet
USE_FEATURE_INDIVIDUAL(, char **argv))
IF_FEATURE_INDIVIDUAL(, char **argv))
{
#ifdef __GLIBC__
(*(int **)&bb_errno) = __errno_location();
@ -224,7 +224,7 @@ bool re_execed;
/* If not built as a single-applet executable... */
#if !defined(SINGLE_APPLET_MAIN)
USE_FEATURE_SUID(static uid_t ruid;) /* real uid */
IF_FEATURE_SUID(static uid_t ruid;) /* real uid */
#if ENABLE_FEATURE_SUID_CONFIG
@ -500,7 +500,7 @@ static void parse_config_file(void)
#else
static inline void parse_config_file(void)
{
USE_FEATURE_SUID(ruid = getuid();)
IF_FEATURE_SUID(ruid = getuid();)
}
#endif /* FEATURE_SUID_CONFIG */
@ -754,10 +754,10 @@ int main(int argc UNUSED_PARAM, char **argv)
#if defined(SINGLE_APPLET_MAIN)
/* Only one applet is selected by the user! */
/* applet_names in this case is just "applet\0\0" */
lbb_prepare(applet_names USE_FEATURE_INDIVIDUAL(, argv));
lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv));
return SINGLE_APPLET_MAIN(argc, argv);
#else
lbb_prepare("busybox" USE_FEATURE_INDIVIDUAL(, argv));
lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
#if !BB_MMU
/* NOMMU re-exec trick sets high-order bit in first byte of name */

View File

@ -62,10 +62,10 @@
#define ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR \
(ENABLE_FEATURE_USERNAME_COMPLETION || ENABLE_FEATURE_EDITING_FANCY_PROMPT)
#define USE_FEATURE_GETUSERNAME_AND_HOMEDIR(...)
#define IF_FEATURE_GETUSERNAME_AND_HOMEDIR(...)
#if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR
#undef USE_FEATURE_GETUSERNAME_AND_HOMEDIR
#define USE_FEATURE_GETUSERNAME_AND_HOMEDIR(...) __VA_ARGS__
#undef IF_FEATURE_GETUSERNAME_AND_HOMEDIR
#define IF_FEATURE_GETUSERNAME_AND_HOMEDIR(...) __VA_ARGS__
#endif
enum {
@ -152,8 +152,8 @@ extern struct lineedit_statics *const lineedit_ptr_to_statics;
(*(struct lineedit_statics**)&lineedit_ptr_to_statics) = xzalloc(sizeof(S)); \
barrier(); \
cmdedit_termw = 80; \
USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
USE_FEATURE_GETUSERNAME_AND_HOMEDIR(home_pwd_buf = (char*)null_str;) \
IF_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
IF_FEATURE_GETUSERNAME_AND_HOMEDIR(home_pwd_buf = (char*)null_str;) \
} while (0)
static void deinit_S(void)
{
@ -1160,7 +1160,7 @@ static void remember_in_history(char *str)
if ((state->flags & SAVE_HISTORY) && state->hist_file)
save_history(str);
#endif
USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines++;)
IF_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines++;)
}
#else /* MAX_HISTORY == 0 */
@ -1442,7 +1442,7 @@ static void win_changed(int nsig)
/* leave out the "vi-mode"-only case labels if vi editing isn't
* configured. */
#define vi_case(caselabel) USE_FEATURE_EDITING(case caselabel)
#define vi_case(caselabel) IF_FEATURE_EDITING(case caselabel)
/* convert uppercase ascii to equivalent control char, for readability */
#undef CTRL

View File

@ -12,4 +12,4 @@
/* Busybox mount uses either /proc/mounts or /etc/mtab to
* get the list of currently mounted filesystems */
const char bb_path_mtab_file[] ALIGN1 =
USE_FEATURE_MTAB_SUPPORT("/etc/mtab")SKIP_FEATURE_MTAB_SUPPORT("/proc/mounts");
IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts");

View File

@ -111,7 +111,7 @@ void FAST_FUNC free_procps_scan(procps_status_t* sp)
{
closedir(sp->dir);
free(sp->argv0);
USE_SELINUX(free(sp->context);)
IF_SELINUX(free(sp->context);)
free(sp);
}

View File

@ -315,7 +315,7 @@ int FAST_FUNC open_zipped(const char *fname)
char *sfx;
int fd;
#if BB_MMU
USE_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
enum { xformer_prog = 0 };
#else
enum { xformer = 0 };
@ -352,7 +352,7 @@ int FAST_FUNC open_zipped(const char *fname)
|| magic[0] != 'B' || magic[1] != 'Z'
) {
bb_error_msg_and_die("no gzip"
USE_FEATURE_SEAMLESS_BZ2("/bzip2")
IF_FEATURE_SEAMLESS_BZ2("/bzip2")
" magic");
}
#if BB_MMU

View File

@ -151,7 +151,7 @@ void FAST_FUNC set_nport(len_and_sockaddr *lsa, unsigned port)
* port: if neither of above specifies port # */
static len_and_sockaddr* str2sockaddr(
const char *host, int port,
USE_FEATURE_IPV6(sa_family_t af,)
IF_FEATURE_IPV6(sa_family_t af,)
int ai_flags)
{
int rc;
@ -269,9 +269,9 @@ len_and_sockaddr* FAST_FUNC xdotted2sockaddr(const char *host, int port)
}
#undef xsocket_type
int FAST_FUNC xsocket_type(len_and_sockaddr **lsap, USE_FEATURE_IPV6(int family,) int sock_type)
int FAST_FUNC xsocket_type(len_and_sockaddr **lsap, IF_FEATURE_IPV6(int family,) int sock_type)
{
SKIP_FEATURE_IPV6(enum { family = AF_INET };)
IF_NOT_FEATURE_IPV6(enum { family = AF_INET };)
len_and_sockaddr *lsa;
int fd;
int len;
@ -303,7 +303,7 @@ int FAST_FUNC xsocket_type(len_and_sockaddr **lsap, USE_FEATURE_IPV6(int family,
int FAST_FUNC xsocket_stream(len_and_sockaddr **lsap)
{
return xsocket_type(lsap, USE_FEATURE_IPV6(AF_UNSPEC,) SOCK_STREAM);
return xsocket_type(lsap, IF_FEATURE_IPV6(AF_UNSPEC,) SOCK_STREAM);
}
static int create_and_bind_or_die(const char *bindaddr, int port, int sock_type)
@ -316,7 +316,7 @@ static int create_and_bind_or_die(const char *bindaddr, int port, int sock_type)
/* user specified bind addr dictates family */
fd = xsocket(lsa->u.sa.sa_family, sock_type, 0);
} else {
fd = xsocket_type(&lsa, USE_FEATURE_IPV6(AF_UNSPEC,) sock_type);
fd = xsocket_type(&lsa, IF_FEATURE_IPV6(AF_UNSPEC,) sock_type);
set_nport(lsa, htons(port));
}
setsockopt_reuseaddr(fd);

View File

@ -420,7 +420,7 @@ int FAST_FUNC xsocket(int domain, int type, int protocol)
const char *s = "INET";
if (domain == AF_PACKET) s = "PACKET";
if (domain == AF_NETLINK) s = "NETLINK";
USE_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
IF_FEATURE_IPV6(if (domain == AF_INET6) s = "INET6";)
bb_perror_msg_and_die("socket(AF_%s)", s);
#else
bb_perror_msg_and_die("socket");

View File

@ -29,7 +29,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv)
bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
opt_complementary = "m--e:e--m";
USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;)
IF_GETOPT_LONG(applet_long_options = chpasswd_longopts;)
opt = getopt32(argv, "em");
while ((name = xmalloc_fgetline(stdin)) != NULL) {

View File

@ -285,8 +285,8 @@ int login_main(int argc UNUSED_PARAM, char **argv)
char *opt_host = opt_host; /* for compiler */
char *opt_user = opt_user; /* for compiler */
char *full_tty;
USE_SELINUX(security_context_t user_sid = NULL;)
USE_FEATURE_UTMP(struct utmp utent;)
IF_SELINUX(security_context_t user_sid = NULL;)
IF_FEATURE_UTMP(struct utmp utent;)
#if ENABLE_PAM
int pamret;
pam_handle_t *pamh;
@ -333,7 +333,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
read_or_build_utent(&utent, run_by_root);
if (opt & LOGIN_OPT_h) {
USE_FEATURE_UTMP(safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host));)
IF_FEATURE_UTMP(safe_strncpy(utent.ut_host, opt_host, sizeof(utent.ut_host));)
fromhost = xasprintf(" on '%s' from '%s'", short_tty, opt_host);
} else {
fromhost = xasprintf(" on '%s'", short_tty);
@ -457,7 +457,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
write_utent(&utent, username);
USE_SELINUX(initselinux(username, full_tty, &user_sid));
IF_SELINUX(initselinux(username, full_tty, &user_sid));
/* Try these, but don't complain if they fail.
* _f_chown is safe wrt race t=ttyname(0);...;chown(t); */
@ -482,7 +482,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
/* well, a simple setexeccon() here would do the job as well,
* but let's play the game for now */
USE_SELINUX(set_current_security_context(user_sid);)
IF_SELINUX(set_current_security_context(user_sid);)
// util-linux login also does:
// /* start new session */

View File

@ -43,7 +43,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
the user, especially if someone su's from a su-shell.
But getlogin can fail -- usually due to lack of utmp entry.
in this case resort to getpwuid. */
old_user = xstrdup(USE_FEATURE_UTMP(getlogin() ? : ) (pw = getpwuid(cur_uid)) ? pw->pw_name : "");
old_user = xstrdup(IF_FEATURE_UTMP(getlogin() ? : ) (pw = getpwuid(cur_uid)) ? pw->pw_name : "");
tty = xmalloc_ttyname(2) ? : "none";
openlog(applet_name, 0, LOG_AUTH);
}
@ -91,7 +91,7 @@ int su_main(int argc UNUSED_PARAM, char **argv)
change_identity(pw);
/* setup_environment params: shell, clear_env, change_env, pw */
setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_mp), pw);
USE_SELINUX(set_current_security_context(NULL);)
IF_SELINUX(set_current_security_context(NULL);)
/* Never returns */
run_shell(opt_shell, flags & SU_OPT_l, opt_command, (const char**)argv);

View File

@ -99,7 +99,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
bb_info_msg("System Maintenance Mode");
USE_SELINUX(renew_current_security_context());
IF_SELINUX(renew_current_security_context());
shell = getenv("SUSHELL");
if (!shell)

View File

@ -341,11 +341,11 @@ int reformime_main(int argc UNUSED_PARAM, char **argv)
// parse options
// N.B. only -x and -X are supported so far
opt_complementary = "x--X:X--x" USE_FEATURE_REFORMIME_COMPAT(":m::");
opt_complementary = "x--X:X--x" IF_FEATURE_REFORMIME_COMPAT(":m::");
opts = getopt32(argv,
"x:X" USE_FEATURE_REFORMIME_COMPAT("deis:r:c:m:h:o:O:"),
"x:X" IF_FEATURE_REFORMIME_COMPAT("deis:r:c:m:h:o:O:"),
&opt_prefix
USE_FEATURE_REFORMIME_COMPAT(, NULL, NULL, &G.opt_charset, NULL, NULL, NULL, NULL)
IF_FEATURE_REFORMIME_COMPAT(, NULL, NULL, &G.opt_charset, NULL, NULL, NULL, NULL)
);
//argc -= optind;
argv += optind;

View File

@ -73,9 +73,9 @@ int popmaildir_main(int argc UNUSED_PARAM, char **argv)
// parse options
opt_complementary = "-1:dd:t+:R+:L+:H+";
opts = getopt32(argv,
"bdmVcasTkt:" "R:Z:L:H:" USE_FEATURE_POPMAILDIR_DELIVERY("M:F:"),
"bdmVcasTkt:" "R:Z:L:H:" IF_FEATURE_POPMAILDIR_DELIVERY("M:F:"),
&timeout, NULL, NULL, NULL, &opt_nlines
USE_FEATURE_POPMAILDIR_DELIVERY(, &delivery, &delivery) // we treat -M and -F the same
IF_FEATURE_POPMAILDIR_DELIVERY(, &delivery, &delivery) // we treat -M and -F the same
);
//argc -= optind;
argv += optind;

View File

@ -162,11 +162,11 @@ int crond_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
/* "-b after -f is ignored", and so on for every pair a-b */
opt_complementary = "f-b:b-f:S-L:L-S" USE_FEATURE_CROND_D(":d-l")
opt_complementary = "f-b:b-f:S-L:L-S" IF_FEATURE_CROND_D(":d-l")
":l+:d+"; /* -l and -d have numeric param */
opt = getopt32(argv, "l:L:fbSc:" USE_FEATURE_CROND_D("d:"),
opt = getopt32(argv, "l:L:fbSc:" IF_FEATURE_CROND_D("d:"),
&LogLevel, &LogFile, &CDir
USE_FEATURE_CROND_D(,&LogLevel));
IF_FEATURE_CROND_D(,&LogLevel));
/* both -d N and -l N set the same variable: LogLevel */
if (!(opt & OPT_f)) {

View File

@ -89,7 +89,7 @@ int eject_main(int argc UNUSED_PARAM, char **argv)
const char *device;
opt_complementary = "?1:t--T:T--t";
flags = getopt32(argv, "tT" USE_FEATURE_EJECT_SCSI("s"));
flags = getopt32(argv, "tT" IF_FEATURE_EJECT_SCSI("s"));
device = argv[optind] ? argv[optind] : "/dev/cdrom";
/* We used to do "umount <device>" here, but it was buggy

View File

@ -293,15 +293,15 @@ struct globals {
unsigned long doorlock;
unsigned long apmmode;
#endif
USE_FEATURE_HDPARM_GET_IDENTITY( smallint get_IDentity;)
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( smallint set_busstate, get_busstate;)
USE_FEATURE_HDPARM_HDIO_DRIVE_RESET( smallint perform_reset;)
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( smallint perform_tristate;)
USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(smallint unregister_hwif;)
USE_FEATURE_HDPARM_HDIO_SCAN_HWIF( smallint scan_hwif;)
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( unsigned long busstate;)
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( unsigned long tristate;)
USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(unsigned long hwif;)
IF_FEATURE_HDPARM_GET_IDENTITY( smallint get_IDentity;)
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( smallint set_busstate, get_busstate;)
IF_FEATURE_HDPARM_HDIO_DRIVE_RESET( smallint perform_reset;)
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( smallint perform_tristate;)
IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(smallint unregister_hwif;)
IF_FEATURE_HDPARM_HDIO_SCAN_HWIF( smallint scan_hwif;)
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( unsigned long busstate;)
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( unsigned long tristate;)
IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(unsigned long hwif;)
#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
unsigned long hwif_data;
unsigned long hwif_ctrl;
@ -1960,12 +1960,12 @@ static void parse_xfermode(int flag, smallint *get, smallint *set, int *value)
/*------- getopt short options --------*/
static const char hdparm_options[] ALIGN1 =
"gfu::n::p:r::m::c::k::a::B:tT"
USE_FEATURE_HDPARM_GET_IDENTITY("iI")
USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
IF_FEATURE_HDPARM_GET_IDENTITY("iI")
IF_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
#ifdef HDIO_DRIVE_CMD
"S:D:P:X:K:A:L:W:CyYzZ"
#endif
USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("U:")
IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("U:")
#ifdef HDIO_GET_QDMA
#ifdef HDIO_SET_QDMA
"Q:"
@ -1973,9 +1973,9 @@ static const char hdparm_options[] ALIGN1 =
"Q"
#endif
#endif
USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("w")
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF("x::b:")
USE_FEATURE_HDPARM_HDIO_SCAN_HWIF("R:");
IF_FEATURE_HDPARM_HDIO_DRIVE_RESET("w")
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF("x::b:")
IF_FEATURE_HDPARM_HDIO_SCAN_HWIF("R:");
/*-------------------------------------*/
/* our main() routine: */
@ -1987,12 +1987,12 @@ int hdparm_main(int argc, char **argv)
while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
flagcount++;
USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I'));
USE_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i'));
IF_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I'));
IF_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i'));
get_geom |= (c == 'g');
do_flush |= (c == 'f');
if (c == 'u') parse_opts(&get_unmask, &set_unmask, &unmask, 0, 1);
USE_FEATURE_HDPARM_HDIO_GETSET_DMA(if (c == 'd') parse_opts(&get_dma, &set_dma, &dma, 0, 9));
IF_FEATURE_HDPARM_HDIO_GETSET_DMA(if (c == 'd') parse_opts(&get_dma, &set_dma, &dma, 0, 9));
if (c == 'n') parse_opts(&get_nowerr, &set_nowerr, &nowerr, 0, 1);
parse_xfermode((c == 'p'), &noisy_piomode, &set_piomode, &piomode);
if (c == 'r') parse_opts(&get_readonly, &set_readonly, &readonly, 0, 1);
@ -2018,7 +2018,7 @@ int hdparm_main(int argc, char **argv)
reread_partn |= (c == 'z');
get_seagate = set_seagate |= (c == 'Z');
#endif
USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(if (c == 'U') parse_opts(NULL, &unregister_hwif, &hwif, 0, INT_MAX));
IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(if (c == 'U') parse_opts(NULL, &unregister_hwif, &hwif, 0, INT_MAX));
#ifdef HDIO_GET_QDMA
if (c == 'Q') {
#ifdef HDIO_SET_QDMA
@ -2028,9 +2028,9 @@ int hdparm_main(int argc, char **argv)
#endif
}
#endif
USE_FEATURE_HDPARM_HDIO_DRIVE_RESET(perform_reset = (c == 'r'));
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'x') parse_opts(NULL, &perform_tristate, &tristate, 0, 1));
USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'b') parse_opts(&get_busstate, &set_busstate, &busstate, 0, 2));
IF_FEATURE_HDPARM_HDIO_DRIVE_RESET(perform_reset = (c == 'r'));
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'x') parse_opts(NULL, &perform_tristate, &tristate, 0, 1));
IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'b') parse_opts(&get_busstate, &set_busstate, &busstate, 0, 2));
#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
if (c == 'R') {
parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX);
@ -2045,7 +2045,7 @@ int hdparm_main(int argc, char **argv)
/* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */
if (!flagcount) {
get_mult = get_io32bit = get_unmask = get_keep = get_readonly = get_readahead = get_geom = 1;
USE_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1);
IF_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1);
}
argv += optind;

View File

@ -145,7 +145,7 @@ struct globals {
current_file = 1; \
eof_error = 1; \
terminated = 1; \
USE_FEATURE_LESS_REGEXP(wanted_match = -1;) \
IF_FEATURE_LESS_REGEXP(wanted_match = -1;) \
} while (0)
/* flines[] are lines read from stdin, each in malloc'ed buffer.
@ -326,7 +326,7 @@ static void read_lines(void)
if (option_mask32 & FLAG_N)
w -= 8;
USE_FEATURE_LESS_REGEXP(again0:)
IF_FEATURE_LESS_REGEXP(again0:)
p = current_line = ((char*)xmalloc(w + 4)) + 4;
max_fline += last_terminated;
@ -1509,7 +1509,7 @@ int less_main(int argc, char **argv)
/* TODO: -x: do not interpret backspace, -xx: tab also */
/* -xxx: newline also */
/* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */
getopt32(argv, "EMmN~I" USE_FEATURE_LESS_DASHCMD("S"));
getopt32(argv, "EMmN~I" IF_FEATURE_LESS_DASHCMD("S"));
argc -= optind;
argv += optind;
num_files = argc;

View File

@ -24,7 +24,7 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
* or in $MODPATH.
*/
USE_FEATURE_2_4_MODULES(
IF_FEATURE_2_4_MODULES(
getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
argv += optind - 1;
);

View File

@ -679,7 +679,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
{
struct utsname uts;
char applet0 = applet_name[0];
USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options;)
IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(char *options;)
/* are we lsmod? -> just dump /proc/modules */
if ('l' == applet0) {
@ -773,8 +773,8 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
len = MAXINT(ssize_t);
map = xmalloc_xopen_read_close(*argv, &len);
if (init_module(map, len,
USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
IF_NOT_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
) != 0)
bb_error_msg_and_die("can't insert '%s': %s",
*argv, moderror(errno));
@ -791,7 +791,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
} while (*argv);
if (ENABLE_FEATURE_CLEAN_UP) {
USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);)
IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(free(options);)
}
return EXIT_SUCCESS;
}

View File

@ -33,7 +33,7 @@ struct module_entry { /* I'll call it ME. */
llist_t *deps; /* strings. modules we depend on */
};
#define MODPROBE_OPTS "acdlnrt:VC:" USE_FEATURE_MODPROBE_BLACKLIST("b")
#define MODPROBE_OPTS "acdlnrt:VC:" IF_FEATURE_MODPROBE_BLACKLIST("b")
enum {
MODPROBE_OPT_INSERT_ALL = (INSMOD_OPT_UNUSED << 0), /* a */
MODPROBE_OPT_DUMP_ONLY = (INSMOD_OPT_UNUSED << 1), /* c */

View File

@ -26,10 +26,10 @@ char *parse_cmdline_module_options(char **argv) FAST_FUNC;
#define INSMOD_OPTS \
"vq" \
USE_FEATURE_2_4_MODULES("sLo:fkx") \
USE_FEATURE_INSMOD_LOAD_MAP("m")
IF_FEATURE_2_4_MODULES("sLo:fkx") \
IF_FEATURE_INSMOD_LOAD_MAP("m")
#define INSMOD_ARGS USE_FEATURE_2_4_MODULES(, NULL)
#define INSMOD_ARGS IF_FEATURE_2_4_MODULES(, NULL)
enum {
INSMOD_OPT_VERBOSE = 0x0001,

View File

@ -99,20 +99,20 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
{
static const char keywords[] ALIGN1 =
"addbr\0" "delbr\0" "addif\0" "delif\0"
USE_FEATURE_BRCTL_FANCY(
IF_FEATURE_BRCTL_FANCY(
"stp\0"
"setageing\0" "setfd\0" "sethello\0" "setmaxage\0"
"setpathcost\0" "setportprio\0" "setbridgeprio\0"
)
USE_FEATURE_BRCTL_SHOW("showmacs\0" "show\0");
IF_FEATURE_BRCTL_SHOW("showmacs\0" "show\0");
enum { ARG_addbr = 0, ARG_delbr, ARG_addif, ARG_delif
USE_FEATURE_BRCTL_FANCY(,
IF_FEATURE_BRCTL_FANCY(,
ARG_stp,
ARG_setageing, ARG_setfd, ARG_sethello, ARG_setmaxage,
ARG_setpathcost, ARG_setportprio, ARG_setbridgeprio
)
USE_FEATURE_BRCTL_SHOW(, ARG_showmacs, ARG_show)
IF_FEATURE_BRCTL_SHOW(, ARG_showmacs, ARG_show)
};
int fd;

View File

@ -1103,9 +1103,9 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
G.timeout = 2 * 60;
opt_complementary = "t+:T+:vv";
#if BB_MMU
opts = getopt32(argv, "vS" USE_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
#else
opts = getopt32(argv, "l1vS" USE_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
opts = getopt32(argv, "l1vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
if (opts & (OPT_l|OPT_1)) {
/* Our secret backdoor to ls */
/* TODO: pass -n too? */

View File

@ -250,13 +250,13 @@ struct globals {
const char *found_moved_temporarily;
Htaccess_IP *ip_a_d; /* config allow/deny lines */
USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
USE_FEATURE_HTTPD_CGI(char *referer;)
USE_FEATURE_HTTPD_CGI(char *user_agent;)
USE_FEATURE_HTTPD_CGI(char *host;)
USE_FEATURE_HTTPD_CGI(char *http_accept;)
USE_FEATURE_HTTPD_CGI(char *http_accept_language;)
IF_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
IF_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
IF_FEATURE_HTTPD_CGI(char *referer;)
IF_FEATURE_HTTPD_CGI(char *user_agent;)
IF_FEATURE_HTTPD_CGI(char *host;)
IF_FEATURE_HTTPD_CGI(char *http_accept;)
IF_FEATURE_HTTPD_CGI(char *http_accept_language;)
off_t file_size; /* -1 - unknown */
#if ENABLE_FEATURE_HTTPD_RANGES
@ -326,7 +326,7 @@ enum {
#define proxy (G.proxy )
#define INIT_G() do { \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
USE_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
bind_addr_or_port = "80"; \
index_page = "index.html"; \
file_size = -1; \
@ -1587,14 +1587,14 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
while (1) {
/* sz is rounded down to 64k */
ssize_t sz = MAXINT(ssize_t) - 0xffff;
USE_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;)
IF_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;)
count = sendfile(STDOUT_FILENO, fd, &offset, sz);
if (count < 0) {
if (offset == range_start)
break; /* fall back to read/write loop */
goto fin;
}
USE_FEATURE_HTTPD_RANGES(range_len -= sz;)
IF_FEATURE_HTTPD_RANGES(range_len -= sz;)
if (count == 0 || range_len == 0)
log_and_exit();
}
@ -1602,16 +1602,16 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
#endif
while ((count = safe_read(fd, iobuf, IOBUF_SIZE)) > 0) {
ssize_t n;
USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
IF_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
n = full_write(STDOUT_FILENO, iobuf, count);
if (count != n)
break;
USE_FEATURE_HTTPD_RANGES(range_len -= count;)
IF_FEATURE_HTTPD_RANGES(range_len -= count;)
if (range_len == 0)
break;
}
if (count < 0) {
USE_FEATURE_HTTPD_USE_SENDFILE(fin:)
IF_FEATURE_HTTPD_USE_SENDFILE(fin:)
if (verbose > 1)
bb_perror_msg("error");
}
@ -1839,12 +1839,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
/* Find end of URL and parse HTTP version, if any */
http_major_version = '0';
USE_FEATURE_HTTPD_PROXY(http_minor_version = '0';)
IF_FEATURE_HTTPD_PROXY(http_minor_version = '0';)
tptr = strchrnul(urlp, ' ');
/* Is it " HTTP/"? */
if (tptr[0] && strncmp(tptr + 1, HTTP_200, 5) == 0) {
http_major_version = tptr[6];
USE_FEATURE_HTTPD_PROXY(http_minor_version = tptr[8];)
IF_FEATURE_HTTPD_PROXY(http_minor_version = tptr[8];)
}
*tptr = '\0';
@ -2252,10 +2252,10 @@ enum {
c_opt_config_file = 0,
d_opt_decode_url,
h_opt_home_httpd,
USE_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,)
USE_FEATURE_HTTPD_BASIC_AUTH( r_opt_realm ,)
USE_FEATURE_HTTPD_AUTH_MD5( m_opt_md5 ,)
USE_FEATURE_HTTPD_SETUID( u_opt_setuid ,)
IF_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,)
IF_FEATURE_HTTPD_BASIC_AUTH( r_opt_realm ,)
IF_FEATURE_HTTPD_AUTH_MD5( m_opt_md5 ,)
IF_FEATURE_HTTPD_SETUID( u_opt_setuid ,)
p_opt_port ,
p_opt_inetd ,
p_opt_foreground,
@ -2263,10 +2263,10 @@ enum {
OPT_CONFIG_FILE = 1 << c_opt_config_file,
OPT_DECODE_URL = 1 << d_opt_decode_url,
OPT_HOME_HTTPD = 1 << h_opt_home_httpd,
OPT_ENCODE_URL = USE_FEATURE_HTTPD_ENCODE_URL_STR((1 << e_opt_encode_url)) + 0,
OPT_REALM = USE_FEATURE_HTTPD_BASIC_AUTH( (1 << r_opt_realm )) + 0,
OPT_MD5 = USE_FEATURE_HTTPD_AUTH_MD5( (1 << m_opt_md5 )) + 0,
OPT_SETUID = USE_FEATURE_HTTPD_SETUID( (1 << u_opt_setuid )) + 0,
OPT_ENCODE_URL = IF_FEATURE_HTTPD_ENCODE_URL_STR((1 << e_opt_encode_url)) + 0,
OPT_REALM = IF_FEATURE_HTTPD_BASIC_AUTH( (1 << r_opt_realm )) + 0,
OPT_MD5 = IF_FEATURE_HTTPD_AUTH_MD5( (1 << m_opt_md5 )) + 0,
OPT_SETUID = IF_FEATURE_HTTPD_SETUID( (1 << u_opt_setuid )) + 0,
OPT_PORT = 1 << p_opt_port,
OPT_INETD = 1 << p_opt_inetd,
OPT_FOREGROUND = 1 << p_opt_foreground,
@ -2280,10 +2280,10 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
int server_socket = server_socket; /* for gcc */
unsigned opt;
char *url_for_decode;
USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;)
USE_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;)
USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;)
USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
IF_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;)
IF_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;)
IF_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;)
IF_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
INIT_G();
@ -2299,16 +2299,16 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
* If user gives relative path in -h,
* $SCRIPT_FILENAME will not be set. */
opt = getopt32(argv, "c:d:h:"
USE_FEATURE_HTTPD_ENCODE_URL_STR("e:")
USE_FEATURE_HTTPD_BASIC_AUTH("r:")
USE_FEATURE_HTTPD_AUTH_MD5("m:")
USE_FEATURE_HTTPD_SETUID("u:")
IF_FEATURE_HTTPD_ENCODE_URL_STR("e:")
IF_FEATURE_HTTPD_BASIC_AUTH("r:")
IF_FEATURE_HTTPD_AUTH_MD5("m:")
IF_FEATURE_HTTPD_SETUID("u:")
"p:ifv",
&configFile, &url_for_decode, &home_httpd
USE_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode)
USE_FEATURE_HTTPD_BASIC_AUTH(, &g_realm)
USE_FEATURE_HTTPD_AUTH_MD5(, &pass)
USE_FEATURE_HTTPD_SETUID(, &s_ugid)
IF_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode)
IF_FEATURE_HTTPD_BASIC_AUTH(, &g_realm)
IF_FEATURE_HTTPD_AUTH_MD5(, &pass)
IF_FEATURE_HTTPD_SETUID(, &s_ugid)
, &bind_addr_or_port
, &verbose
);

View File

@ -424,7 +424,7 @@ int ifconfig_main(int argc, char **argv)
} else { /* A_CAST_HOST_COPY_IN_ETHER */
/* This is the "hw" arg case. */
smalluint hw_class= index_in_substrings("ether\0"
USE_FEATURE_HWIB("infiniband\0"), *argv) + 1;
IF_FEATURE_HWIB("infiniband\0"), *argv) + 1;
if (!hw_class || !*++argv)
bb_show_usage();
/*safe_strncpy(host, *argv, sizeof(host));*/

View File

@ -87,7 +87,7 @@ struct interfaces_file_t {
struct mapping_defn_t *mappings;
};
#define OPTION_STR "anvf" USE_FEATURE_IFUPDOWN_MAPPING("m") "i:"
#define OPTION_STR "anvf" IF_FEATURE_IFUPDOWN_MAPPING("m") "i:"
enum {
OPT_do_all = 0x1,
OPT_no_act = 0x2,

View File

@ -76,18 +76,18 @@ int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ip_main(int argc UNUSED_PARAM, char **argv)
{
static const char keywords[] ALIGN1 =
USE_FEATURE_IP_ADDRESS("address\0")
USE_FEATURE_IP_ROUTE("route\0")
USE_FEATURE_IP_LINK("link\0")
USE_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0")
USE_FEATURE_IP_RULE("rule\0")
IF_FEATURE_IP_ADDRESS("address\0")
IF_FEATURE_IP_ROUTE("route\0")
IF_FEATURE_IP_LINK("link\0")
IF_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0")
IF_FEATURE_IP_RULE("rule\0")
;
enum {
USE_FEATURE_IP_ADDRESS(IP_addr,)
USE_FEATURE_IP_ROUTE(IP_route,)
USE_FEATURE_IP_LINK(IP_link,)
USE_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,)
USE_FEATURE_IP_RULE(IP_rule,)
IF_FEATURE_IP_ADDRESS(IP_addr,)
IF_FEATURE_IP_ROUTE(IP_route,)
IF_FEATURE_IP_LINK(IP_link,)
IF_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,)
IF_FEATURE_IP_RULE(IP_rule,)
IP_none
};
int (*ip_func)(char**) = ip_print_help;

View File

@ -86,7 +86,7 @@ int ipcalc_main(int argc, char **argv)
#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
applet_long_options = ipcalc_longopts;
#endif
opt = getopt32(argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs"));
opt = getopt32(argv, "mbn" IF_FEATURE_IPCALC_FANCY("phs"));
argc -= optind;
argv += optind;
if (opt & (BROADCAST | NETWORK | NETPREFIX)) {

View File

@ -287,14 +287,14 @@ static int print_route(const struct sockaddr_nl *who UNUSED_PARAM,
static int iproute_modify(int cmd, unsigned flags, char **argv)
{
static const char keywords[] ALIGN1 =
"src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0")
"src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0")
"dev\0""oif\0""to\0""metric\0";
enum {
ARG_src,
ARG_via,
ARG_mtu, PARM_lock,
ARG_protocol,
USE_FEATURE_IP_RULE(ARG_table,)
IF_FEATURE_IP_RULE(ARG_table,)
ARG_dev,
ARG_oif,
ARG_to,

View File

@ -29,11 +29,11 @@ int nc_main(int argc, char **argv)
int sfd = sfd; /* for gcc */
int cfd = 0;
unsigned lport = 0;
SKIP_NC_SERVER(const) unsigned do_listen = 0;
SKIP_NC_EXTRA (const) unsigned wsecs = 0;
SKIP_NC_EXTRA (const) unsigned delay = 0;
SKIP_NC_EXTRA (const int execparam = 0;)
USE_NC_EXTRA (char **execparam = NULL;)
IF_NOT_NC_SERVER(const) unsigned do_listen = 0;
IF_NOT_NC_EXTRA (const) unsigned wsecs = 0;
IF_NOT_NC_EXTRA (const) unsigned delay = 0;
IF_NOT_NC_EXTRA (const int execparam = 0;)
IF_NC_EXTRA (char **execparam = NULL;)
len_and_sockaddr *lsa;
fd_set readfds, testfds;
int opt; /* must be signed (getopt returns -1) */
@ -42,24 +42,24 @@ int nc_main(int argc, char **argv)
/* getopt32 is _almost_ usable:
** it cannot handle "... -e prog -prog-opt" */
while ((opt = getopt(argc, argv,
"" USE_NC_SERVER("lp:") USE_NC_EXTRA("w:i:f:e:") )) > 0
"" IF_NC_SERVER("lp:") IF_NC_EXTRA("w:i:f:e:") )) > 0
) {
if (ENABLE_NC_SERVER && opt=='l')
USE_NC_SERVER(do_listen++);
IF_NC_SERVER(do_listen++);
else if (ENABLE_NC_SERVER && opt=='p')
USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0));
IF_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0));
else if (ENABLE_NC_EXTRA && opt=='w')
USE_NC_EXTRA( wsecs = xatou(optarg));
IF_NC_EXTRA( wsecs = xatou(optarg));
else if (ENABLE_NC_EXTRA && opt=='i')
USE_NC_EXTRA( delay = xatou(optarg));
IF_NC_EXTRA( delay = xatou(optarg));
else if (ENABLE_NC_EXTRA && opt=='f')
USE_NC_EXTRA( cfd = xopen(optarg, O_RDWR));
IF_NC_EXTRA( cfd = xopen(optarg, O_RDWR));
else if (ENABLE_NC_EXTRA && opt=='e' && optind <= argc) {
/* We cannot just 'break'. We should let getopt finish.
** Or else we won't be able to find where
** 'host' and 'port' params are
** (think "nc -w 60 host port -e prog"). */
USE_NC_EXTRA(
IF_NC_EXTRA(
char **p;
// +2: one for progname (optarg) and one for NULL
execparam = xzalloc(sizeof(char*) * (argc - optind + 2));
@ -154,7 +154,7 @@ int nc_main(int argc, char **argv)
xmove_fd(cfd, 0);
xdup2(0, 1);
xdup2(0, 2);
USE_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
IF_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
/* Don't print stuff or it will go over the wire.... */
_exit(127);
}

View File

@ -675,7 +675,7 @@ int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int nc_main(int argc, char **argv)
{
char *str_p, *str_s;
USE_NC_EXTRA(char *str_i, *str_o;)
IF_NC_EXTRA(char *str_i, *str_o;)
char *themdotted = themdotted; /* gcc */
char **proggie;
int x;
@ -711,10 +711,10 @@ int nc_main(int argc, char **argv)
// -g -G -t -r deleted, unimplemented -a deleted too
opt_complementary = "?2:vv:w+"; /* max 2 params; -v is a counter; -w N */
getopt32(argv, "hnp:s:uvw:" USE_NC_SERVER("l")
USE_NC_EXTRA("i:o:z"),
getopt32(argv, "hnp:s:uvw:" IF_NC_SERVER("l")
IF_NC_EXTRA("i:o:z"),
&str_p, &str_s, &o_wait
USE_NC_EXTRA(, &str_i, &str_o, &o_verbose));
IF_NC_EXTRA(, &str_i, &str_o, &o_verbose));
argv += optind;
#if ENABLE_NC_EXTRA
if (option_mask32 & OPT_i) /* line-interval time */

View File

@ -18,15 +18,15 @@
#include "inet_common.h"
#define NETSTAT_OPTS "laentuwx" \
USE_ROUTE( "r") \
USE_FEATURE_NETSTAT_WIDE("W") \
USE_FEATURE_NETSTAT_PRG( "p")
IF_ROUTE( "r") \
IF_FEATURE_NETSTAT_WIDE("W") \
IF_FEATURE_NETSTAT_PRG( "p")
enum {
OPTBIT_KEEP_OLD = 7,
USE_ROUTE( OPTBIT_ROUTE,)
USE_FEATURE_NETSTAT_WIDE(OPTBIT_WIDE ,)
USE_FEATURE_NETSTAT_PRG( OPTBIT_PRG ,)
IF_ROUTE( OPTBIT_ROUTE,)
IF_FEATURE_NETSTAT_WIDE(OPTBIT_WIDE ,)
IF_FEATURE_NETSTAT_PRG( OPTBIT_PRG ,)
OPT_sock_listen = 1 << 0, // l
OPT_sock_all = 1 << 1, // a
OPT_extended = 1 << 2, // e
@ -35,9 +35,9 @@ enum {
OPT_sock_udp = 1 << 5, // u
OPT_sock_raw = 1 << 6, // w
OPT_sock_unix = 1 << 7, // x
OPT_route = USE_ROUTE( (1 << OPTBIT_ROUTE)) + 0, // r
OPT_wide = USE_FEATURE_NETSTAT_WIDE((1 << OPTBIT_WIDE )) + 0, // W
OPT_prg = USE_FEATURE_NETSTAT_PRG( (1 << OPTBIT_PRG )) + 0, // p
OPT_route = IF_ROUTE( (1 << OPTBIT_ROUTE)) + 0, // r
OPT_wide = IF_FEATURE_NETSTAT_WIDE((1 << OPTBIT_WIDE )) + 0, // W
OPT_prg = IF_FEATURE_NETSTAT_PRG( (1 << OPTBIT_PRG )) + 0, // p
};
#define NETSTAT_CONNECTED 0x01

View File

@ -224,7 +224,7 @@ int ping_main(int argc UNUSED_PARAM, char **argv)
/* full(er) version */
#define OPT_STRING ("qvc:s:w:W:I:4" USE_PING6("6"))
#define OPT_STRING ("qvc:s:w:W:I:4" IF_PING6("6"))
enum {
OPT_QUIET = 1 << 0,
OPT_VERBOSE = 1 << 1,

View File

@ -201,8 +201,8 @@ static size_t iac_safe_write(int fd, const char *buf, size_t count)
static struct tsession *
make_new_session(
USE_FEATURE_TELNETD_STANDALONE(int sock)
SKIP_FEATURE_TELNETD_STANDALONE(void)
IF_FEATURE_TELNETD_STANDALONE(int sock)
IF_NOT_FEATURE_TELNETD_STANDALONE(void)
) {
const char *login_argv[2];
struct termios termbuf;
@ -437,9 +437,9 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
#endif
/* Even if !STANDALONE, we accept (and ignore) -i, thus people
* don't need to guess whether it's ok to pass -i to us */
opt = getopt32(argv, "f:l:Ki" USE_FEATURE_TELNETD_STANDALONE("p:b:F"),
opt = getopt32(argv, "f:l:Ki" IF_FEATURE_TELNETD_STANDALONE("p:b:F"),
&issuefile, &loginpath
USE_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr));
IF_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr));
if (!IS_INETD /*&& !re_execed*/) {
/* inform that we start in standalone mode?
* May be useful when people forget to give -i */
@ -455,7 +455,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;
}
USE_FEATURE_TELNETD_STANDALONE(
IF_FEATURE_TELNETD_STANDALONE(
if (opt & OPT_PORT)
portnbr = xatou16(opt_portnbr);
);

View File

@ -104,7 +104,7 @@ exceptional conditions.
+#endif
/* Even if !STANDALONE, we accept (and ignore) -i, thus people
* don't need to guess whether it's ok to pass -i to us */
opt = getopt32(argv, "f:l:Ki" USE_FEATURE_TELNETD_STANDALONE("p:b:F"),
opt = getopt32(argv, "f:l:Ki" IF_FEATURE_TELNETD_STANDALONE("p:b:F"),
@@ -475,7 +495,7 @@
FD_SET(ts->sockfd_read, &rdfdset);
if (ts->size2 > 0) /* can write to socket */

View File

@ -64,15 +64,15 @@ enum {
};
#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT
#define USE_GETPUT(...)
#define IF_GETPUT(...)
#define CMD_GET(cmd) 1
#define CMD_PUT(cmd) 0
#elif !ENABLE_FEATURE_TFTP_GET && ENABLE_FEATURE_TFTP_PUT
#define USE_GETPUT(...)
#define IF_GETPUT(...)
#define CMD_GET(cmd) 0
#define CMD_PUT(cmd) 1
#else
#define USE_GETPUT(...) __VA_ARGS__
#define IF_GETPUT(...) __VA_ARGS__
#define CMD_GET(cmd) ((cmd) & TFTP_OPT_GET)
#define CMD_PUT(cmd) ((cmd) & TFTP_OPT_PUT)
#endif
@ -160,9 +160,9 @@ static int tftp_protocol(
len_and_sockaddr *our_lsa,
len_and_sockaddr *peer_lsa,
const char *local_file
USE_TFTP(, const char *remote_file)
USE_FEATURE_TFTP_BLOCKSIZE(USE_TFTPD(, void *tsize))
USE_FEATURE_TFTP_BLOCKSIZE(, int blksize))
IF_TFTP(, const char *remote_file)
IF_FEATURE_TFTP_BLOCKSIZE(IF_TFTPD(, void *tsize))
IF_FEATURE_TFTP_BLOCKSIZE(, int blksize))
{
#if !ENABLE_TFTP
#define remote_file NULL
@ -178,7 +178,7 @@ static int tftp_protocol(
#define socket_fd (pfd[0].fd)
int len;
int send_len;
USE_FEATURE_TFTP_BLOCKSIZE(smallint want_option_ack = 0;)
IF_FEATURE_TFTP_BLOCKSIZE(smallint want_option_ack = 0;)
smallint finished = 0;
uint16_t opcode;
uint16_t block_nr;
@ -564,19 +564,19 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
#endif
int result;
int port;
USE_GETPUT(int opt;)
IF_GETPUT(int opt;)
INIT_G();
/* -p or -g is mandatory, and they are mutually exclusive */
opt_complementary = "" USE_FEATURE_TFTP_GET("g:") USE_FEATURE_TFTP_PUT("p:")
USE_GETPUT("g--p:p--g:");
opt_complementary = "" IF_FEATURE_TFTP_GET("g:") IF_FEATURE_TFTP_PUT("p:")
IF_GETPUT("g--p:p--g:");
USE_GETPUT(opt =) getopt32(argv,
USE_FEATURE_TFTP_GET("g") USE_FEATURE_TFTP_PUT("p")
"l:r:" USE_FEATURE_TFTP_BLOCKSIZE("b:"),
IF_GETPUT(opt =) getopt32(argv,
IF_FEATURE_TFTP_GET("g") IF_FEATURE_TFTP_PUT("p")
"l:r:" IF_FEATURE_TFTP_BLOCKSIZE("b:"),
&local_file, &remote_file
USE_FEATURE_TFTP_BLOCKSIZE(, &blksize_str));
IF_FEATURE_TFTP_BLOCKSIZE(, &blksize_str));
argv += optind;
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
@ -614,8 +614,8 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
result = tftp_protocol(
NULL /*our_lsa*/, peer_lsa,
local_file, remote_file
USE_FEATURE_TFTP_BLOCKSIZE(USE_TFTPD(, NULL /*tsize*/))
USE_FEATURE_TFTP_BLOCKSIZE(, blksize)
IF_FEATURE_TFTP_BLOCKSIZE(IF_TFTPD(, NULL /*tsize*/))
IF_FEATURE_TFTP_BLOCKSIZE(, blksize)
);
if (result != EXIT_SUCCESS && NOT_LONE_DASH(local_file) && CMD_GET(opt)) {
@ -635,8 +635,8 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
char *local_file, *mode;
const char *error_msg;
int opt, result, opcode;
USE_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;)
USE_FEATURE_TFTP_BLOCKSIZE(char *tsize = NULL;)
IF_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;)
IF_FEATURE_TFTP_BLOCKSIZE(char *tsize = NULL;)
INIT_G();
@ -667,9 +667,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
opcode = ntohs(*(uint16_t*)block_buf);
if (result < 4 || result >= sizeof(block_buf)
|| block_buf[result-1] != '\0'
|| (USE_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */
USE_GETPUT(&&)
USE_FEATURE_TFTP_GET(opcode != TFTP_WRQ) /* not upload */
|| (IF_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */
IF_GETPUT(&&)
IF_FEATURE_TFTP_GET(opcode != TFTP_WRQ) /* not upload */
)
) {
goto err;
@ -711,9 +711,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
error_msg = bb_msg_write_error;
goto err;
}
USE_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */
IF_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */
} else {
USE_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */
IF_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */
}
/* NB: if error_pkt_str or error_pkt_reason is set up,
@ -724,9 +724,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
/* tftp_protocol() will create new one, bound to particular local IP */
result = tftp_protocol(
our_lsa, peer_lsa,
local_file USE_TFTP(, NULL /*remote_file*/)
USE_FEATURE_TFTP_BLOCKSIZE(, tsize)
USE_FEATURE_TFTP_BLOCKSIZE(, blksize)
local_file IF_TFTP(, NULL /*remote_file*/)
IF_FEATURE_TFTP_BLOCKSIZE(, tsize)
IF_FEATURE_TFTP_BLOCKSIZE(, blksize)
);
return result;

View File

@ -48,9 +48,9 @@ int tunctl_main(int argc UNUSED_PARAM, char **argv)
};
opt_complementary = "=0:t--d:d--t"; // no arguments; t ^ d
opts = getopt32(argv, "f:t:d:" USE_FEATURE_TUNCTL_UG("u:g:b"),
opts = getopt32(argv, "f:t:d:" IF_FEATURE_TUNCTL_UG("u:g:b"),
&opt_device, &opt_name, &opt_name
USE_FEATURE_TUNCTL_UG(, &opt_user, &opt_group));
IF_FEATURE_TUNCTL_UG(, &opt_user, &opt_group));
// select device
memset(&ifr, 0, sizeof(ifr));

View File

@ -133,7 +133,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
{
uint8_t *temp, *message;
char *str_c, *str_V, *str_h, *str_F, *str_r;
USE_FEATURE_UDHCP_PORT(char *str_P;)
IF_FEATURE_UDHCP_PORT(char *str_P;)
llist_t *list_O = NULL;
int tryagain_timeout = 20;
int discover_timeout = 3;
@ -175,8 +175,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
"no-default-options\0" No_argument "o"
"foreground\0" No_argument "f"
"background\0" No_argument "b"
USE_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
USE_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
IF_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
IF_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
;
#endif
enum {
@ -204,33 +204,33 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
/* The rest has variable bit positions, need to be clever */
OPTBIT_f = 20,
USE_FOR_MMU( OPTBIT_b,)
USE_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
USE_FEATURE_UDHCP_PORT( OPTBIT_P,)
IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
USE_FOR_MMU( OPT_b = 1 << OPTBIT_b,)
USE_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
USE_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
IF_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
IF_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
};
/* Default options. */
USE_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
IF_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
client_config.interface = "eth0";
client_config.script = DEFAULT_SCRIPT;
/* Parse command line */
/* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */
opt_complementary = "c--C:C--c:O::T+:t+:A+";
USE_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
IF_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
USE_FOR_MMU("b")
USE_FEATURE_UDHCPC_ARPING("a")
USE_FEATURE_UDHCP_PORT("P:")
IF_FEATURE_UDHCPC_ARPING("a")
IF_FEATURE_UDHCP_PORT("P:")
, &str_c, &str_V, &str_h, &str_h, &str_F
, &client_config.interface, &client_config.pidfile, &str_r /* i,p */
, &client_config.script /* s */
, &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
, &list_O
USE_FEATURE_UDHCP_PORT(, &str_P)
IF_FEATURE_UDHCP_PORT(, &str_P)
);
if (opt & OPT_c)
client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0);

View File

@ -10,7 +10,7 @@ struct client_config_t {
/* TODO: combine flag fields into single "unsigned opt" */
/* (can be set directly to the result of getopt32) */
char no_default_options; /* Do not include default optins in request */
USE_FEATURE_UDHCP_PORT(uint16_t port;)
IF_FEATURE_UDHCP_PORT(uint16_t port;)
int ifindex; /* Index number of the interface to use */
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
const char *interface; /* The name of the interface to use */

View File

@ -37,14 +37,14 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
unsigned opt;
struct option_set *option;
struct dhcpOfferedAddr *lease, static_lease;
USE_FEATURE_UDHCP_PORT(char *str_P;)
IF_FEATURE_UDHCP_PORT(char *str_P;)
#if ENABLE_FEATURE_UDHCP_PORT
SERVER_PORT = 67;
CLIENT_PORT = 68;
#endif
opt = getopt32(argv, "fS" USE_FEATURE_UDHCP_PORT("P:", &str_P));
opt = getopt32(argv, "fS" IF_FEATURE_UDHCP_PORT("P:", &str_P));
argv += optind;
if (!(opt & 1)) { /* no -f */
bb_daemonize_or_rexec(0, argv);

View File

@ -394,7 +394,7 @@ void FAST_FUNC read_leases(const char *file)
struct dhcpOfferedAddr lease;
int64_t written_at, time_passed;
int fd;
USE_UDHCP_DEBUG(unsigned i;)
IF_UDHCP_DEBUG(unsigned i;)
fd = open_or_warn(file, O_RDONLY);
if (fd < 0)
@ -410,7 +410,7 @@ void FAST_FUNC read_leases(const char *file)
if ((uint64_t)time_passed > 12 * 60 * 60)
goto ret;
USE_UDHCP_DEBUG(i = 0;)
IF_UDHCP_DEBUG(i = 0;)
while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) {
/* ADDME: what if it matches some static lease? */
uint32_t y = ntohl(lease.yiaddr);
@ -424,7 +424,7 @@ void FAST_FUNC read_leases(const char *file)
bb_error_msg("too many leases while loading %s", file);
break;
}
USE_UDHCP_DEBUG(i++;)
IF_UDHCP_DEBUG(i++;)
}
}
DEBUG("Read %d leases", i);

View File

@ -497,14 +497,14 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
applet_long_options = wget_longopts;
#endif
/* server.allocated = target.allocated = NULL; */
opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
opt_complementary = "-1" IF_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
opt = getopt32(argv, "csqO:P:Y:U:" /*ignored:*/ "t:T:",
&fname_out, &dir_prefix,
&proxy_flag, &user_agent,
NULL, /* -t RETRIES */
NULL /* -T NETWORK_READ_TIMEOUT */
USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
USE_FEATURE_WGET_LONG_OPTIONS(, &post_data)
IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
IF_FEATURE_WGET_LONG_OPTIONS(, &post_data)
);
if (strcmp(proxy_flag, "off") == 0) {
/* Use the proxy if necessary */

View File

@ -10,10 +10,10 @@
#include "libbb.h"
enum {
USE_FEATURE_PIDOF_SINGLE(OPTBIT_SINGLE,)
USE_FEATURE_PIDOF_OMIT( OPTBIT_OMIT ,)
OPT_SINGLE = USE_FEATURE_PIDOF_SINGLE((1<<OPTBIT_SINGLE)) + 0,
OPT_OMIT = USE_FEATURE_PIDOF_OMIT( (1<<OPTBIT_OMIT )) + 0,
IF_FEATURE_PIDOF_SINGLE(OPTBIT_SINGLE,)
IF_FEATURE_PIDOF_OMIT( OPTBIT_OMIT ,)
OPT_SINGLE = IF_FEATURE_PIDOF_SINGLE((1<<OPTBIT_SINGLE)) + 0,
OPT_OMIT = IF_FEATURE_PIDOF_OMIT( (1<<OPTBIT_OMIT )) + 0,
};
int pidof_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@ -28,8 +28,8 @@ int pidof_main(int argc UNUSED_PARAM, char **argv)
/* do unconditional option parsing */
opt = getopt32(argv, ""
USE_FEATURE_PIDOF_SINGLE ("s")
USE_FEATURE_PIDOF_OMIT("o:", &omits));
IF_FEATURE_PIDOF_SINGLE ("s")
IF_FEATURE_PIDOF_OMIT("o:", &omits));
#if ENABLE_FEATURE_PIDOF_OMIT
/* fill omit list. */

View File

@ -25,9 +25,9 @@ enum { MAX_WIDTH = 2*1024 };
#if ENABLE_SELINUX
#define SELINUX_O_PREFIX "label,"
#define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" USE_FEATURE_PS_TIME(",time") ",args")
#define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args")
#else
#define DEFAULT_O_STR ("pid,user" USE_FEATURE_PS_TIME(",time") ",args")
#define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
#endif
typedef struct {
@ -425,7 +425,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv)
{
procps_status_t *p;
llist_t* opt_o = NULL;
USE_SELINUX(int opt;)
IF_SELINUX(int opt;)
// POSIX:
// -a Write information for all processes associated with terminals
@ -439,7 +439,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv)
// Select which columns to display
/* We allow (and ignore) most of the above. FIXME */
opt_complementary = "o::";
USE_SELINUX(opt =) getopt32(argv, "Zo:aAdefl", &opt_o);
IF_SELINUX(opt =) getopt32(argv, "Zo:aAdefl", &opt_o);
if (opt_o) {
do {
parse_o(llist_pop(&opt_o));
@ -486,8 +486,8 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
procps_status_t *p = NULL;
int len;
SKIP_SELINUX(const) int use_selinux = 0;
USE_SELINUX(int i;)
IF_NOT_SELINUX(const) int use_selinux = 0;
IF_SELINUX(int i;)
#if !ENABLE_FEATURE_PS_WIDE
enum { terminal_width = 79 };
#else
@ -498,7 +498,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX
#if ENABLE_FEATURE_PS_WIDE
opt_complementary = "-:ww";
USE_SELINUX(i =) getopt32(argv, USE_SELINUX("Z") "w", &w_count);
IF_SELINUX(i =) getopt32(argv, IF_SELINUX("Z") "w", &w_count);
/* if w is given once, GNU ps sets the width to 132,
* if w is given more than once, it is "unlimited"
*/

View File

@ -889,7 +889,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
int lines_rem;
unsigned interval;
char *str_interval, *str_iterations;
SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK;
IF_NOT_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK;
#if ENABLE_FEATURE_USE_TERMIOS
struct termios new_settings;
struct pollfd pfd[1];
@ -1054,11 +1054,11 @@ int top_main(int argc UNUSED_PARAM, char **argv)
if (c == 'q')
break;
if (c == 'n') {
USE_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
IF_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
sort_function[0] = pid_sort;
}
if (c == 'm') {
USE_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
IF_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
sort_function[0] = mem_sort;
#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
sort_function[1] = pcpu_sort;
@ -1067,13 +1067,13 @@ int top_main(int argc UNUSED_PARAM, char **argv)
}
#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
if (c == 'p') {
USE_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
IF_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
sort_function[0] = pcpu_sort;
sort_function[1] = mem_sort;
sort_function[2] = time_sort;
}
if (c == 't') {
USE_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
IF_FEATURE_TOPMEM(scan_mask = TOP_MASK;)
sort_function[0] = time_sort;
sort_function[1] = mem_sort;
sort_function[2] = pcpu_sort;

View File

@ -200,11 +200,11 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
// if yes -> getopt converts strings to numbers for us
opt_complementary = "-1:a+:c+:d+:f+:l+:m+:o+:p+:r+:s+:t+";
opt = getopt32(argv, "+a:c:d:f:l:m:o:p:r:s:t:u:U:e:"
USE_CHPST("/:n:vP012"),
IF_CHPST("/:n:vP012"),
&limita, &limitc, &limitd, &limitf, &limitl,
&limitm, &limito, &limitp, &limitr, &limits, &limitt,
&set_user, &env_user, &env_dir
USE_CHPST(, &root, &nicestr));
IF_CHPST(, &root, &nicestr));
argv += optind;
if (opt & OPT_m) { // -m means -asld
limita = limits = limitl = limitd = limitm;

View File

@ -225,32 +225,36 @@ void use_config(char *m, int slen)
void parse_config_file(char *map, size_t len)
{
/* modified for bbox */
char *end_4 = map + len - 4; /* 4 == length of "USE_" */
char *end_3 = map + len - 3; /* 3 == length of "IF_" */
char *end_7 = map + len - 7;
char *p = map;
char *q;
int off;
for (; p < end_4; p++) {
for (; p <= end_3; p++) {
/* Find next identifier's beginning */
if (!(isalnum(*p) || *p == '_'))
continue;
/* Check it */
if (p < end_7 && p[6] == '_') {
if (!memcmp(p, "CONFIG", 6)) goto conf7;
if (!memcmp(p, "ENABLE", 6)) goto conf7;
if (!memcmp(p, "IF_NOT", 6)) goto conf7;
}
/* We have at least 5 chars: for() has
* "p < end-4", not "p <= end-4"
* therefore we don't need to check p <= end-5 here */
if (p[4] == '_')
if (!memcmp(p, "SKIP", 4)) goto conf5;
/* Ehhh, gcc is too stupid to just compare it as 32bit int */
if (p[0] == 'U')
if (!memcmp(p, "USE_", 4)) goto conf4;
/* we have at least 3 chars because of p <= end_3 */
/*if (!memcmp(p, "IF_", 3)) goto conf3;*/
if (p[0] == 'I' && p[1] == 'F' && p[2] == '_') goto conf3;
/* This identifier is not interesting, skip it */
while (p <= end_3 && (isalnum(*p) || *p == '_'))
p++;
continue;
conf4: off = 4;
conf5: off = 5;
conf3: off = 3;
conf7: off = 7;
p += off;
for (q = p; q < end_4+4; q++) {
for (q = p; q < end_3+3; q++) {
if (!(isalnum(*q) || *q == '_'))
break;
}

View File

@ -458,8 +458,8 @@ int conf_write(const char *name)
fprintf(out_h, "#undef CONFIG_%s\n", sym->name);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 0\n", sym->name);
fprintf(out_h, "#define USE_%s(...)\n", sym->name);
fprintf(out_h, "#define SKIP_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define IF_%s(...)\n", sym->name);
fprintf(out_h, "#define IF_NOT_%s(...) __VA_ARGS__\n", sym->name);
}
break;
case mod:
@ -473,8 +473,8 @@ int conf_write(const char *name)
fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define SKIP_%s(...)\n", sym->name);
fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
}
@ -505,8 +505,8 @@ int conf_write(const char *name)
fputs("\"\n", out_h);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define SKIP_%s(...)\n", sym->name);
fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
case S_HEX:
@ -517,8 +517,8 @@ int conf_write(const char *name)
fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define SKIP_%s(...)\n", sym->name);
fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
}
@ -531,8 +531,8 @@ int conf_write(const char *name)
fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
/* bbox */
fprintf(out_h, "#define ENABLE_%s 1\n", sym->name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define SKIP_%s(...)\n", sym->name);
fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name);
fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
}
break;
}

View File

@ -544,9 +544,9 @@ int setfiles_main(int argc, char **argv)
&exclude_dir, &input_filename, &out_filename, &verbose);
} else { /* setfiles */
flags = getopt32(argv, "de:f:ilnpqr:svo:FW"
USE_FEATURE_SETFILES_CHECK_OPTION("c:"),
IF_FEATURE_SETFILES_CHECK_OPTION("c:"),
&exclude_dir, &input_filename, &rootpath, &out_filename,
USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
&verbose);
}

View File

@ -56,11 +56,11 @@
/* STANDALONE does not make sense, and won't compile */
#undef CONFIG_FEATURE_SH_STANDALONE
#undef ENABLE_FEATURE_SH_STANDALONE
#undef USE_FEATURE_SH_STANDALONE
#undef SKIP_FEATURE_SH_STANDALONE(...)
#undef IF_FEATURE_SH_STANDALONE
#undef IF_NOT_FEATURE_SH_STANDALONE(...)
#define ENABLE_FEATURE_SH_STANDALONE 0
#define USE_FEATURE_SH_STANDALONE(...)
#define SKIP_FEATURE_SH_STANDALONE(...) __VA_ARGS__
#define IF_FEATURE_SH_STANDALONE(...)
#define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
#endif
#ifndef PIPE_BUF
@ -349,7 +349,7 @@ raise_interrupt(void)
} while (0)
#endif
static USE_ASH_OPTIMIZE_FOR_SIZE(inline) void
static IF_ASH_OPTIMIZE_FOR_SIZE(inline) void
int_on(void)
{
xbarrier();
@ -358,7 +358,7 @@ int_on(void)
}
}
#define INT_ON int_on()
static USE_ASH_OPTIMIZE_FOR_SIZE(inline) void
static IF_ASH_OPTIMIZE_FOR_SIZE(inline) void
force_int_on(void)
{
xbarrier();
@ -4219,7 +4219,7 @@ cmdputs(const char *s)
static const char vstype[VSTYPE + 1][3] = {
"", "}", "-", "+", "?", "=",
"%", "%%", "#", "##"
USE_ASH_BASH_COMPAT(, ":", "/", "//")
IF_ASH_BASH_COMPAT(, ":", "/", "//")
};
const char *p, *str;
@ -6069,9 +6069,9 @@ subevalvar(char *p, char *str, int strloc, int subtype,
char *startp;
char *loc;
char *rmesc, *rmescend;
USE_ASH_BASH_COMPAT(char *repl = NULL;)
USE_ASH_BASH_COMPAT(char null = '\0';)
USE_ASH_BASH_COMPAT(int pos, len, orig_len;)
IF_ASH_BASH_COMPAT(char *repl = NULL;)
IF_ASH_BASH_COMPAT(char null = '\0';)
IF_ASH_BASH_COMPAT(int pos, len, orig_len;)
int saveherefd = herefd;
int amount, workloc, resetloc;
int zero;
@ -6157,7 +6157,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
* stack will need rebasing, and we'll need to remove our work
* areas each time
*/
USE_ASH_BASH_COMPAT(restart:)
IF_ASH_BASH_COMPAT(restart:)
amount = expdest - ((char *)stackblock() + resetloc);
STADJUST(-amount, expdest);
@ -7083,7 +7083,7 @@ static int builtinloc = -1; /* index in path of %builtin, or -1 */
static void
tryexec(USE_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **envp)
tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **envp)
{
int repeated = 0;
@ -7155,13 +7155,13 @@ shellexec(char **argv, const char *path, int idx)
|| (applet_no = find_applet_by_name(argv[0])) >= 0
#endif
) {
tryexec(USE_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
e = errno;
} else {
e = ENOENT;
while ((cmdname = padvance(&path, argv[0])) != NULL) {
if (--idx < 0 && pathopt == NULL) {
tryexec(USE_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
tryexec(IF_FEATURE_SH_STANDALONE(-1,) cmdname, argv, envp);
if (errno != ENOENT && errno != ENOTDIR)
e = errno;
}
@ -10789,7 +10789,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
int parenlevel; /* levels of parens in arithmetic */
int dqvarnest; /* levels of variables expansion within double quotes */
USE_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;)
IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;)
#if __GNUC__
/* Avoid longjmp clobbering */
@ -10895,7 +10895,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
dblquote = 1;
goto quotemark;
case CENDQUOTE:
USE_ASH_BASH_COMPAT(bash_dollar_squote = 0;)
IF_ASH_BASH_COMPAT(bash_dollar_squote = 0;)
if (eofmark != NULL && arinest == 0
&& varnest == 0
) {
@ -10994,7 +10994,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
len = out - (char *)stackblock();
out = stackblock();
if (eofmark == NULL) {
if ((c == '>' || c == '<' USE_ASH_BASH_COMPAT( || c == 0x100 + '>'))
if ((c == '>' || c == '<' IF_ASH_BASH_COMPAT( || c == 0x100 + '>'))
&& quotef == 0
) {
if (isdigit_str9(out)) {
@ -11488,7 +11488,7 @@ xxreadtoken(void)
startlinno = g_parsefile->linno;
for (;;) { /* until token or start of word found */
c = pgetc_fast();
if (c == ' ' || c == '\t' USE_ASH_ALIAS( || c == PEOA))
if (c == ' ' || c == '\t' IF_ASH_ALIAS( || c == PEOA))
continue;
if (c == '#') {
@ -12454,8 +12454,8 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
rflag = 0;
prompt = NULL;
while ((i = nextopt("p:u:r"
USE_ASH_READ_TIMEOUT("t:")
USE_ASH_READ_NCHARS("n:s")
IF_ASH_READ_TIMEOUT("t:")
IF_ASH_READ_NCHARS("n:s")
)) != '\0') {
switch (i) {
case 'p':

View File

@ -97,11 +97,11 @@
/* STANDALONE does not make sense, and won't compile */
# undef CONFIG_FEATURE_SH_STANDALONE
# undef ENABLE_FEATURE_SH_STANDALONE
# undef USE_FEATURE_SH_STANDALONE
# define SKIP_FEATURE_SH_STANDALONE(...) __VA_ARGS__
# undef IF_FEATURE_SH_STANDALONE
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
# define ENABLE_FEATURE_SH_STANDALONE 0
# define USE_FEATURE_SH_STANDALONE(...)
# define SKIP_FEATURE_SH_STANDALONE(...) __VA_ARGS__
# define IF_FEATURE_SH_STANDALONE(...)
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
#endif
#if !ENABLE_HUSH_INTERACTIVE
@ -2443,11 +2443,11 @@ static void re_execute_shell(char ***to_free, const char *s, char *g_argv0, char
goto do_exec;
}
sprintf(param_buf, "-$%x:%x:%x" USE_HUSH_LOOPS(":%x")
sprintf(param_buf, "-$%x:%x:%x" IF_HUSH_LOOPS(":%x")
, (unsigned) G.root_pid
, (unsigned) G.last_bg_pid
, (unsigned) G.last_exitcode
USE_HUSH_LOOPS(, G.depth_of_loop)
IF_HUSH_LOOPS(, G.depth_of_loop)
);
/* 1:hush 2:-$<pid>:<pid>:<exitcode>:<depth> <vars...> <funcs...>
* 3:-c 4:<cmd> 5:<arg0> <argN...> 6:NULL
@ -3386,7 +3386,7 @@ static int run_pipe(struct pipe *pi)
debug_printf_exec("run_pipe start: members:%d\n", pi->num_cmds);
debug_enter();
USE_HUSH_JOB(pi->pgrp = -1;)
IF_HUSH_JOB(pi->pgrp = -1;)
pi->stopped_cmds = 0;
command = &(pi->cmds[0]);
argv_expanded = NULL;
@ -3821,7 +3821,7 @@ static int run_list(struct pipe *pi)
rcode = G.last_exitcode;
/* Go through list of pipes, (maybe) executing them. */
for (; pi; pi = USE_HUSH_LOOPS(rword == RES_DONE ? loop_top : ) pi->next) {
for (; pi; pi = IF_HUSH_LOOPS(rword == RES_DONE ? loop_top : ) pi->next) {
if (G.flag_SIGINT)
break;
@ -4773,7 +4773,7 @@ static FILE *generate_stream_from_string(const char *s)
close(channel[0]); /* NB: close _first_, then move fd! */
xmove_fd(channel[1], 1);
/* Prevent it from trying to handle ctrl-z etc */
USE_HUSH_JOB(G.run_list_level = 1;)
IF_HUSH_JOB(G.run_list_level = 1;)
#if BB_MMU
reset_traps_to_defaults();
parse_and_run_string(s);
@ -5441,7 +5441,7 @@ static struct pipe *parse_stream(char **pstring,
nommu_addchr(&ctx.as_string, ch);
is_ifs = strchr(G.ifs, ch);
is_special = strchr("<>;&|(){}#'" /* special outside of "str" */
"\\$\"" USE_HUSH_TICK("`") /* always special */
"\\$\"" IF_HUSH_TICK("`") /* always special */
, ch);
if (!is_special && !is_ifs) { /* ordinary char */
@ -5832,7 +5832,7 @@ static struct pipe *parse_stream(char **pstring,
}
/* Discard cached input, force prompt */
input->p = NULL;
USE_HUSH_INTERACTIVE(input->promptme = 1;)
IF_HUSH_INTERACTIVE(input->promptme = 1;)
goto reset;
}
}

View File

@ -66,7 +66,7 @@ struct shbuf_ds {
/*int markInterval;*/ \
/* level of messages to be logged */ \
int logLevel; \
USE_FEATURE_ROTATE_LOGFILE( \
IF_FEATURE_ROTATE_LOGFILE( \
/* max size of file before rotation */ \
unsigned logFileSize; \
/* number of rotated message files */ \
@ -74,12 +74,12 @@ USE_FEATURE_ROTATE_LOGFILE( \
unsigned curFileSize; \
smallint isRegular; \
) \
USE_FEATURE_REMOTE_LOG( \
IF_FEATURE_REMOTE_LOG( \
/* udp socket for remote logging */ \
int remoteFD; \
len_and_sockaddr* remoteAddr; \
) \
USE_FEATURE_IPC_SYSLOG( \
IF_FEATURE_IPC_SYSLOG( \
int shmid; /* ipc shared memory id */ \
int s_semid; /* ipc semaphore id */ \
int shm_size; \
@ -153,41 +153,41 @@ enum {
OPTBIT_outfile, // -O
OPTBIT_loglevel, // -l
OPTBIT_small, // -S
USE_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
USE_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
USE_FEATURE_REMOTE_LOG( OPTBIT_remotelog ,) // -R
USE_FEATURE_REMOTE_LOG( OPTBIT_locallog ,) // -L
USE_FEATURE_IPC_SYSLOG( OPTBIT_circularlog,) // -C
USE_FEATURE_SYSLOGD_DUP( OPTBIT_dup ,) // -D
IF_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
IF_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
IF_FEATURE_REMOTE_LOG( OPTBIT_remotelog ,) // -R
IF_FEATURE_REMOTE_LOG( OPTBIT_locallog ,) // -L
IF_FEATURE_IPC_SYSLOG( OPTBIT_circularlog,) // -C
IF_FEATURE_SYSLOGD_DUP( OPTBIT_dup ,) // -D
OPT_mark = 1 << OPTBIT_mark ,
OPT_nofork = 1 << OPTBIT_nofork ,
OPT_outfile = 1 << OPTBIT_outfile ,
OPT_loglevel = 1 << OPTBIT_loglevel,
OPT_small = 1 << OPTBIT_small ,
OPT_filesize = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
OPT_rotatecnt = USE_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
OPT_remotelog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_remotelog )) + 0,
OPT_locallog = USE_FEATURE_REMOTE_LOG( (1 << OPTBIT_locallog )) + 0,
OPT_circularlog = USE_FEATURE_IPC_SYSLOG( (1 << OPTBIT_circularlog)) + 0,
OPT_dup = USE_FEATURE_SYSLOGD_DUP( (1 << OPTBIT_dup )) + 0,
OPT_filesize = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
OPT_rotatecnt = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
OPT_remotelog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_remotelog )) + 0,
OPT_locallog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_locallog )) + 0,
OPT_circularlog = IF_FEATURE_IPC_SYSLOG( (1 << OPTBIT_circularlog)) + 0,
OPT_dup = IF_FEATURE_SYSLOGD_DUP( (1 << OPTBIT_dup )) + 0,
};
#define OPTION_STR "m:nO:l:S" \
USE_FEATURE_ROTATE_LOGFILE("s:" ) \
USE_FEATURE_ROTATE_LOGFILE("b:" ) \
USE_FEATURE_REMOTE_LOG( "R:" ) \
USE_FEATURE_REMOTE_LOG( "L" ) \
USE_FEATURE_IPC_SYSLOG( "C::") \
USE_FEATURE_SYSLOGD_DUP( "D" )
IF_FEATURE_ROTATE_LOGFILE("s:" ) \
IF_FEATURE_ROTATE_LOGFILE("b:" ) \
IF_FEATURE_REMOTE_LOG( "R:" ) \
IF_FEATURE_REMOTE_LOG( "L" ) \
IF_FEATURE_IPC_SYSLOG( "C::") \
IF_FEATURE_SYSLOGD_DUP( "D" )
#define OPTION_DECL *opt_m, *opt_l \
USE_FEATURE_ROTATE_LOGFILE(,*opt_s) \
USE_FEATURE_ROTATE_LOGFILE(,*opt_b) \
USE_FEATURE_IPC_SYSLOG( ,*opt_C = NULL)
IF_FEATURE_ROTATE_LOGFILE(,*opt_s) \
IF_FEATURE_ROTATE_LOGFILE(,*opt_b) \
IF_FEATURE_IPC_SYSLOG( ,*opt_C = NULL)
#define OPTION_PARAM &opt_m, &G.logFilePath, &opt_l \
USE_FEATURE_ROTATE_LOGFILE(,&opt_s) \
USE_FEATURE_ROTATE_LOGFILE(,&opt_b) \
USE_FEATURE_REMOTE_LOG( ,&G.remoteAddrStr) \
USE_FEATURE_IPC_SYSLOG( ,&opt_C)
IF_FEATURE_ROTATE_LOGFILE(,&opt_s) \
IF_FEATURE_ROTATE_LOGFILE(,&opt_b) \
IF_FEATURE_REMOTE_LOG( ,&G.remoteAddrStr) \
IF_FEATURE_IPC_SYSLOG( ,&opt_C)
/* circular buffer variables/structures */

View File

@ -33,7 +33,7 @@ rm -f src.usage.escaped
# verify the applet order is correct in applets.h, otherwise
# applets won't be called properly.
#
sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
sed -n -e '/^IF_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
$srcdir/../include/applets.h > applet.order.current
LC_ALL=C sort applet.order.current > applet.order.correct
testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""

View File

@ -61,9 +61,9 @@ int acpid_main(int argc, char **argv)
const char *opt_logfile = "/var/log/acpid.log";
getopt32(argv, "c:e:l:d"
USE_FEATURE_ACPID_COMPAT("g:m:s:S:v"),
IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"),
&opt_conf, &opt_input, &opt_logfile
USE_FEATURE_ACPID_COMPAT(, NULL, NULL, NULL, NULL, NULL)
IF_FEATURE_ACPID_COMPAT(, NULL, NULL, NULL, NULL, NULL)
);
// daemonize unless -d given

View File

@ -17,7 +17,7 @@
/* Looks like someone forgot to add this to config system */
#ifndef ENABLE_FEATURE_FDISK_BLKSIZE
# define ENABLE_FEATURE_FDISK_BLKSIZE 0
# define USE_FEATURE_FDISK_BLKSIZE(a)
# define IF_FEATURE_FDISK_BLKSIZE(a)
#endif
#define DEFAULT_SECTOR_SIZE 512
@ -1302,7 +1302,7 @@ static int get_boot(void)
// or get_boot() [table is bad] -> create_sunlabel() -> get_boot(CREATE_EMPTY_SUN).
// (just factor out re-init of ptes[0,1,2,3] in a separate fn instead?)
// So skip opening device _again_...
if (what == CREATE_EMPTY_DOS USE_FEATURE_SUN_LABEL(|| what == CREATE_EMPTY_SUN))
if (what == CREATE_EMPTY_DOS IF_FEATURE_SUN_LABEL(|| what == CREATE_EMPTY_SUN))
goto created_table;
fd = open(disk_device, (option_mask32 & OPT_l) ? O_RDONLY : O_RDWR);
@ -1372,7 +1372,7 @@ static int get_boot(void)
"partition table, nor Sun, SGI or OSF "
"disklabel\n");
#ifdef __sparc__
USE_FEATURE_SUN_LABEL(create_sunlabel();)
IF_FEATURE_SUN_LABEL(create_sunlabel();)
#else
create_doslabel();
#endif
@ -1385,7 +1385,7 @@ static int get_boot(void)
#endif /* FEATURE_FDISK_WRITABLE */
USE_FEATURE_FDISK_WRITABLE(warn_cylinders();)
IF_FEATURE_FDISK_WRITABLE(warn_cylinders();)
warn_geometry();
for (i = 0; i < 4; i++) {
@ -1406,7 +1406,7 @@ static int get_boot(void)
pe->sectorbuffer[510],
pe->sectorbuffer[511],
i + 1);
USE_FEATURE_FDISK_WRITABLE(pe->changed = 1;)
IF_FEATURE_FDISK_WRITABLE(pe->changed = 1;)
}
}
@ -2797,7 +2797,7 @@ int fdisk_main(int argc, char **argv)
close_dev_fd(); /* needed: fd 3 must not stay closed */
opt_complementary = "b+:C+:H+:S+"; /* numeric params */
opt = getopt32(argv, "b:C:H:lS:u" USE_FEATURE_FDISK_BLKSIZE("s"),
opt = getopt32(argv, "b:C:H:lS:u" IF_FEATURE_FDISK_BLKSIZE("s"),
&sector_size, &user_cylinders, &user_heads, &user_sectors);
argc -= optind;
argv += optind;

View File

@ -151,7 +151,7 @@ struct globals {
char superblock_buffer[BLOCK_SIZE];
char add_zone_ind_blk[BLOCK_SIZE];
char add_zone_dind_blk[BLOCK_SIZE];
USE_FEATURE_MINIX2(char add_zone_tind_blk[BLOCK_SIZE];)
IF_FEATURE_MINIX2(char add_zone_tind_blk[BLOCK_SIZE];)
char check_file_blk[BLOCK_SIZE];
/* File-name data */

Some files were not shown because too many files have changed in this diff Show More