*: 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!
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 75489f2..d25f509 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -30,11 +30,11 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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");
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 8eb5ca9..bbaf566 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -64,7 +64,7 @@
* 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 @@
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 @@
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);
diff --git a/archival/cpio.c b/archival/cpio.c
index 11b22e4..4cf3c2c 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -270,7 +270,7 @@
{
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 @@
#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;
diff --git a/archival/gzip.c b/archival/gzip.c
index 43804b2..a8f8fa4 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -2015,7 +2015,7 @@
}
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 @@
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);
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index b53720f..cd8df08 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -648,10 +648,10 @@
/* 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 @@
i = RETVAL_SHORT_WRITE;
break;
}
- USE_DESKTOP(total_written += i;)
+ IF_DESKTOP(total_written += i;)
}
}
@@ -686,10 +686,10 @@
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];
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index fe1491e..2877c89 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -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 @@
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 @@
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);
diff --git a/archival/libunarchive/decompress_unlzma.c b/archival/libunarchive/decompress_unlzma.c
index 2cfcd9b..33e5cd6 100644
--- a/archival/libunarchive/decompress_unlzma.c
+++ b/archival/libunarchive/decompress_unlzma.c
@@ -228,10 +228,10 @@
};
-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 @@
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 @@
}
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 @@
}
{
- 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 */
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 8696925..b090f26 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -970,10 +970,10 @@
/* 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 @@
n = -1;
goto ret;
}
- USE_DESKTOP(n += nwrote;)
+ IF_DESKTOP(n += nwrote;)
if (r == 0) break;
}
@@ -1033,10 +1033,10 @@
/* 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 @@
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 @@
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);
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 443052f..16e2de4 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -144,8 +144,8 @@
// 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 @@
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 @@
#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 @@
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':
diff --git a/archival/libunarchive/open_transformer.c b/archival/libunarchive/open_transformer.c
index 42fdd96..fae589e 100644
--- a/archival/libunarchive/open_transformer.c
+++ b/archival/libunarchive/open_transformer.c
@@ -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;
diff --git a/archival/rpm.c b/archival/rpm.c
index 4c36067..569bcdd 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -190,7 +190,7 @@
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 @@
|| 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
diff --git a/archival/tar.c b/archival/tar.c
index 03d66a6..379028b 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -728,14 +728,14 @@
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 @@
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 @@
#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