summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-21 11:09:40 +0000
committerDenis Vlasenko2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /networking
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
busybox-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
Diffstat (limited to 'networking')
-rw-r--r--networking/brctl.c8
-rw-r--r--networking/ftpd.c4
-rw-r--r--networking/httpd.c70
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/ifupdown.c2
-rw-r--r--networking/ip.c20
-rw-r--r--networking/ipcalc.c2
-rw-r--r--networking/libiproute/iproute.c4
-rw-r--r--networking/nc.c26
-rw-r--r--networking/nc_bloaty.c8
-rw-r--r--networking/netstat.c18
-rw-r--r--networking/ping.c2
-rw-r--r--networking/telnetd.c10
-rw-r--r--networking/telnetd.ctrlSQ.patch2
-rw-r--r--networking/tftp.c52
-rw-r--r--networking/tunctl.c4
-rw-r--r--networking/udhcp/dhcpc.c26
-rw-r--r--networking/udhcp/dhcpc.h2
-rw-r--r--networking/udhcp/dhcpd.c4
-rw-r--r--networking/udhcp/files.c6
-rw-r--r--networking/wget.c6
21 files changed, 139 insertions, 139 deletions
diff --git a/networking/brctl.c b/networking/brctl.c
index 1b52689..57074cd 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -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;
diff --git a/networking/ftpd.c b/networking/ftpd.c
index ac68961..2ec67df 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -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? */
diff --git a/networking/httpd.c b/networking/httpd.c
index 6bf103c..803a98b 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -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
);
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 22b1682..863d6e4 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -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));*/
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index dc7ed49..604a216 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -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,
diff --git a/networking/ip.c b/networking/ip.c
index 9903c68..7a0f308 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -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;
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index d8fa5f3..b5cc3de 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -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)) {
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 66557d8..3785952 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -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,
diff --git a/networking/nc.c b/networking/nc.c
index fe845f5..857d635 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -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);
}
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 41db945..47940e9 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -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 */
diff --git a/networking/netstat.c b/networking/netstat.c
index b246280..0c3f931 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -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
diff --git a/networking/ping.c b/networking/ping.c
index f2a612f..71b2a4b 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -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,
diff --git a/networking/telnetd.c b/networking/telnetd.c
index ccf3289..b7162ad 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -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);
);
diff --git a/networking/telnetd.ctrlSQ.patch b/networking/telnetd.ctrlSQ.patch
index 885e105..7060e1c 100644
--- a/networking/telnetd.ctrlSQ.patch
+++ b/networking/telnetd.ctrlSQ.patch
@@ -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 */
diff --git a/networking/tftp.c b/networking/tftp.c
index 9c78b6e..352037f 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -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;
diff --git a/networking/tunctl.c b/networking/tunctl.c
index a8e5270..02ff71d 100644
--- a/networking/tunctl.c
+++ b/networking/tunctl.c
@@ -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));
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index e9f99e3..2dd3cd0 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -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);
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 7b77942..361624f 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -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 */
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index a82fd8c..ccdfd36 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -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);
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index a061a9c..b138976 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -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);
diff --git a/networking/wget.c b/networking/wget.c
index 4875904..ca3acd0 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -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 */