aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /networking
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.bz2
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
Diffstat (limited to '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 1b5268947..57074cd73 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -99,20 +99,20 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
99{ 99{
100 static const char keywords[] ALIGN1 = 100 static const char keywords[] ALIGN1 =
101 "addbr\0" "delbr\0" "addif\0" "delif\0" 101 "addbr\0" "delbr\0" "addif\0" "delif\0"
102 USE_FEATURE_BRCTL_FANCY( 102 IF_FEATURE_BRCTL_FANCY(
103 "stp\0" 103 "stp\0"
104 "setageing\0" "setfd\0" "sethello\0" "setmaxage\0" 104 "setageing\0" "setfd\0" "sethello\0" "setmaxage\0"
105 "setpathcost\0" "setportprio\0" "setbridgeprio\0" 105 "setpathcost\0" "setportprio\0" "setbridgeprio\0"
106 ) 106 )
107 USE_FEATURE_BRCTL_SHOW("showmacs\0" "show\0"); 107 IF_FEATURE_BRCTL_SHOW("showmacs\0" "show\0");
108 108
109 enum { ARG_addbr = 0, ARG_delbr, ARG_addif, ARG_delif 109 enum { ARG_addbr = 0, ARG_delbr, ARG_addif, ARG_delif
110 USE_FEATURE_BRCTL_FANCY(, 110 IF_FEATURE_BRCTL_FANCY(,
111 ARG_stp, 111 ARG_stp,
112 ARG_setageing, ARG_setfd, ARG_sethello, ARG_setmaxage, 112 ARG_setageing, ARG_setfd, ARG_sethello, ARG_setmaxage,
113 ARG_setpathcost, ARG_setportprio, ARG_setbridgeprio 113 ARG_setpathcost, ARG_setportprio, ARG_setbridgeprio
114 ) 114 )
115 USE_FEATURE_BRCTL_SHOW(, ARG_showmacs, ARG_show) 115 IF_FEATURE_BRCTL_SHOW(, ARG_showmacs, ARG_show)
116 }; 116 };
117 117
118 int fd; 118 int fd;
diff --git a/networking/ftpd.c b/networking/ftpd.c
index ac6896117..2ec67df35 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -1103,9 +1103,9 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1103 G.timeout = 2 * 60; 1103 G.timeout = 2 * 60;
1104 opt_complementary = "t+:T+:vv"; 1104 opt_complementary = "t+:T+:vv";
1105#if BB_MMU 1105#if BB_MMU
1106 opts = getopt32(argv, "vS" USE_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose); 1106 opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
1107#else 1107#else
1108 opts = getopt32(argv, "l1vS" USE_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose); 1108 opts = getopt32(argv, "l1vS" IF_FEATURE_FTP_WRITE("w") "t:T:", &G.timeout, &abs_timeout, &G.verbose);
1109 if (opts & (OPT_l|OPT_1)) { 1109 if (opts & (OPT_l|OPT_1)) {
1110 /* Our secret backdoor to ls */ 1110 /* Our secret backdoor to ls */
1111/* TODO: pass -n too? */ 1111/* TODO: pass -n too? */
diff --git a/networking/httpd.c b/networking/httpd.c
index 6bf103c56..803a98b46 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -250,13 +250,13 @@ struct globals {
250 const char *found_moved_temporarily; 250 const char *found_moved_temporarily;
251 Htaccess_IP *ip_a_d; /* config allow/deny lines */ 251 Htaccess_IP *ip_a_d; /* config allow/deny lines */
252 252
253 USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;) 253 IF_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
254 USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;) 254 IF_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
255 USE_FEATURE_HTTPD_CGI(char *referer;) 255 IF_FEATURE_HTTPD_CGI(char *referer;)
256 USE_FEATURE_HTTPD_CGI(char *user_agent;) 256 IF_FEATURE_HTTPD_CGI(char *user_agent;)
257 USE_FEATURE_HTTPD_CGI(char *host;) 257 IF_FEATURE_HTTPD_CGI(char *host;)
258 USE_FEATURE_HTTPD_CGI(char *http_accept;) 258 IF_FEATURE_HTTPD_CGI(char *http_accept;)
259 USE_FEATURE_HTTPD_CGI(char *http_accept_language;) 259 IF_FEATURE_HTTPD_CGI(char *http_accept_language;)
260 260
261 off_t file_size; /* -1 - unknown */ 261 off_t file_size; /* -1 - unknown */
262#if ENABLE_FEATURE_HTTPD_RANGES 262#if ENABLE_FEATURE_HTTPD_RANGES
@@ -326,7 +326,7 @@ enum {
326#define proxy (G.proxy ) 326#define proxy (G.proxy )
327#define INIT_G() do { \ 327#define INIT_G() do { \
328 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ 328 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
329 USE_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ 329 IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
330 bind_addr_or_port = "80"; \ 330 bind_addr_or_port = "80"; \
331 index_page = "index.html"; \ 331 index_page = "index.html"; \
332 file_size = -1; \ 332 file_size = -1; \
@@ -1587,14 +1587,14 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
1587 while (1) { 1587 while (1) {
1588 /* sz is rounded down to 64k */ 1588 /* sz is rounded down to 64k */
1589 ssize_t sz = MAXINT(ssize_t) - 0xffff; 1589 ssize_t sz = MAXINT(ssize_t) - 0xffff;
1590 USE_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;) 1590 IF_FEATURE_HTTPD_RANGES(if (sz > range_len) sz = range_len;)
1591 count = sendfile(STDOUT_FILENO, fd, &offset, sz); 1591 count = sendfile(STDOUT_FILENO, fd, &offset, sz);
1592 if (count < 0) { 1592 if (count < 0) {
1593 if (offset == range_start) 1593 if (offset == range_start)
1594 break; /* fall back to read/write loop */ 1594 break; /* fall back to read/write loop */
1595 goto fin; 1595 goto fin;
1596 } 1596 }
1597 USE_FEATURE_HTTPD_RANGES(range_len -= sz;) 1597 IF_FEATURE_HTTPD_RANGES(range_len -= sz;)
1598 if (count == 0 || range_len == 0) 1598 if (count == 0 || range_len == 0)
1599 log_and_exit(); 1599 log_and_exit();
1600 } 1600 }
@@ -1602,16 +1602,16 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
1602#endif 1602#endif
1603 while ((count = safe_read(fd, iobuf, IOBUF_SIZE)) > 0) { 1603 while ((count = safe_read(fd, iobuf, IOBUF_SIZE)) > 0) {
1604 ssize_t n; 1604 ssize_t n;
1605 USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;) 1605 IF_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
1606 n = full_write(STDOUT_FILENO, iobuf, count); 1606 n = full_write(STDOUT_FILENO, iobuf, count);
1607 if (count != n) 1607 if (count != n)
1608 break; 1608 break;
1609 USE_FEATURE_HTTPD_RANGES(range_len -= count;) 1609 IF_FEATURE_HTTPD_RANGES(range_len -= count;)
1610 if (range_len == 0) 1610 if (range_len == 0)
1611 break; 1611 break;
1612 } 1612 }
1613 if (count < 0) { 1613 if (count < 0) {
1614 USE_FEATURE_HTTPD_USE_SENDFILE(fin:) 1614 IF_FEATURE_HTTPD_USE_SENDFILE(fin:)
1615 if (verbose > 1) 1615 if (verbose > 1)
1616 bb_perror_msg("error"); 1616 bb_perror_msg("error");
1617 } 1617 }
@@ -1839,12 +1839,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
1839 1839
1840 /* Find end of URL and parse HTTP version, if any */ 1840 /* Find end of URL and parse HTTP version, if any */
1841 http_major_version = '0'; 1841 http_major_version = '0';
1842 USE_FEATURE_HTTPD_PROXY(http_minor_version = '0';) 1842 IF_FEATURE_HTTPD_PROXY(http_minor_version = '0';)
1843 tptr = strchrnul(urlp, ' '); 1843 tptr = strchrnul(urlp, ' ');
1844 /* Is it " HTTP/"? */ 1844 /* Is it " HTTP/"? */
1845 if (tptr[0] && strncmp(tptr + 1, HTTP_200, 5) == 0) { 1845 if (tptr[0] && strncmp(tptr + 1, HTTP_200, 5) == 0) {
1846 http_major_version = tptr[6]; 1846 http_major_version = tptr[6];
1847 USE_FEATURE_HTTPD_PROXY(http_minor_version = tptr[8];) 1847 IF_FEATURE_HTTPD_PROXY(http_minor_version = tptr[8];)
1848 } 1848 }
1849 *tptr = '\0'; 1849 *tptr = '\0';
1850 1850
@@ -2252,10 +2252,10 @@ enum {
2252 c_opt_config_file = 0, 2252 c_opt_config_file = 0,
2253 d_opt_decode_url, 2253 d_opt_decode_url,
2254 h_opt_home_httpd, 2254 h_opt_home_httpd,
2255 USE_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,) 2255 IF_FEATURE_HTTPD_ENCODE_URL_STR(e_opt_encode_url,)
2256 USE_FEATURE_HTTPD_BASIC_AUTH( r_opt_realm ,) 2256 IF_FEATURE_HTTPD_BASIC_AUTH( r_opt_realm ,)
2257 USE_FEATURE_HTTPD_AUTH_MD5( m_opt_md5 ,) 2257 IF_FEATURE_HTTPD_AUTH_MD5( m_opt_md5 ,)
2258 USE_FEATURE_HTTPD_SETUID( u_opt_setuid ,) 2258 IF_FEATURE_HTTPD_SETUID( u_opt_setuid ,)
2259 p_opt_port , 2259 p_opt_port ,
2260 p_opt_inetd , 2260 p_opt_inetd ,
2261 p_opt_foreground, 2261 p_opt_foreground,
@@ -2263,10 +2263,10 @@ enum {
2263 OPT_CONFIG_FILE = 1 << c_opt_config_file, 2263 OPT_CONFIG_FILE = 1 << c_opt_config_file,
2264 OPT_DECODE_URL = 1 << d_opt_decode_url, 2264 OPT_DECODE_URL = 1 << d_opt_decode_url,
2265 OPT_HOME_HTTPD = 1 << h_opt_home_httpd, 2265 OPT_HOME_HTTPD = 1 << h_opt_home_httpd,
2266 OPT_ENCODE_URL = USE_FEATURE_HTTPD_ENCODE_URL_STR((1 << e_opt_encode_url)) + 0, 2266 OPT_ENCODE_URL = IF_FEATURE_HTTPD_ENCODE_URL_STR((1 << e_opt_encode_url)) + 0,
2267 OPT_REALM = USE_FEATURE_HTTPD_BASIC_AUTH( (1 << r_opt_realm )) + 0, 2267 OPT_REALM = IF_FEATURE_HTTPD_BASIC_AUTH( (1 << r_opt_realm )) + 0,
2268 OPT_MD5 = USE_FEATURE_HTTPD_AUTH_MD5( (1 << m_opt_md5 )) + 0, 2268 OPT_MD5 = IF_FEATURE_HTTPD_AUTH_MD5( (1 << m_opt_md5 )) + 0,
2269 OPT_SETUID = USE_FEATURE_HTTPD_SETUID( (1 << u_opt_setuid )) + 0, 2269 OPT_SETUID = IF_FEATURE_HTTPD_SETUID( (1 << u_opt_setuid )) + 0,
2270 OPT_PORT = 1 << p_opt_port, 2270 OPT_PORT = 1 << p_opt_port,
2271 OPT_INETD = 1 << p_opt_inetd, 2271 OPT_INETD = 1 << p_opt_inetd,
2272 OPT_FOREGROUND = 1 << p_opt_foreground, 2272 OPT_FOREGROUND = 1 << p_opt_foreground,
@@ -2280,10 +2280,10 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
2280 int server_socket = server_socket; /* for gcc */ 2280 int server_socket = server_socket; /* for gcc */
2281 unsigned opt; 2281 unsigned opt;
2282 char *url_for_decode; 2282 char *url_for_decode;
2283 USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) 2283 IF_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;)
2284 USE_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;) 2284 IF_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;)
2285 USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;) 2285 IF_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;)
2286 USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;) 2286 IF_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
2287 2287
2288 INIT_G(); 2288 INIT_G();
2289 2289
@@ -2299,16 +2299,16 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
2299 * If user gives relative path in -h, 2299 * If user gives relative path in -h,
2300 * $SCRIPT_FILENAME will not be set. */ 2300 * $SCRIPT_FILENAME will not be set. */
2301 opt = getopt32(argv, "c:d:h:" 2301 opt = getopt32(argv, "c:d:h:"
2302 USE_FEATURE_HTTPD_ENCODE_URL_STR("e:") 2302 IF_FEATURE_HTTPD_ENCODE_URL_STR("e:")
2303 USE_FEATURE_HTTPD_BASIC_AUTH("r:") 2303 IF_FEATURE_HTTPD_BASIC_AUTH("r:")
2304 USE_FEATURE_HTTPD_AUTH_MD5("m:") 2304 IF_FEATURE_HTTPD_AUTH_MD5("m:")
2305 USE_FEATURE_HTTPD_SETUID("u:") 2305 IF_FEATURE_HTTPD_SETUID("u:")
2306 "p:ifv", 2306 "p:ifv",
2307 &configFile, &url_for_decode, &home_httpd 2307 &configFile, &url_for_decode, &home_httpd
2308 USE_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode) 2308 IF_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode)
2309 USE_FEATURE_HTTPD_BASIC_AUTH(, &g_realm) 2309 IF_FEATURE_HTTPD_BASIC_AUTH(, &g_realm)
2310 USE_FEATURE_HTTPD_AUTH_MD5(, &pass) 2310 IF_FEATURE_HTTPD_AUTH_MD5(, &pass)
2311 USE_FEATURE_HTTPD_SETUID(, &s_ugid) 2311 IF_FEATURE_HTTPD_SETUID(, &s_ugid)
2312 , &bind_addr_or_port 2312 , &bind_addr_or_port
2313 , &verbose 2313 , &verbose
2314 ); 2314 );
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 22b1682bc..863d6e44a 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -424,7 +424,7 @@ int ifconfig_main(int argc, char **argv)
424 } else { /* A_CAST_HOST_COPY_IN_ETHER */ 424 } else { /* A_CAST_HOST_COPY_IN_ETHER */
425 /* This is the "hw" arg case. */ 425 /* This is the "hw" arg case. */
426 smalluint hw_class= index_in_substrings("ether\0" 426 smalluint hw_class= index_in_substrings("ether\0"
427 USE_FEATURE_HWIB("infiniband\0"), *argv) + 1; 427 IF_FEATURE_HWIB("infiniband\0"), *argv) + 1;
428 if (!hw_class || !*++argv) 428 if (!hw_class || !*++argv)
429 bb_show_usage(); 429 bb_show_usage();
430 /*safe_strncpy(host, *argv, sizeof(host));*/ 430 /*safe_strncpy(host, *argv, sizeof(host));*/
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index dc7ed490b..604a216d4 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -87,7 +87,7 @@ struct interfaces_file_t {
87 struct mapping_defn_t *mappings; 87 struct mapping_defn_t *mappings;
88}; 88};
89 89
90#define OPTION_STR "anvf" USE_FEATURE_IFUPDOWN_MAPPING("m") "i:" 90#define OPTION_STR "anvf" IF_FEATURE_IFUPDOWN_MAPPING("m") "i:"
91enum { 91enum {
92 OPT_do_all = 0x1, 92 OPT_do_all = 0x1,
93 OPT_no_act = 0x2, 93 OPT_no_act = 0x2,
diff --git a/networking/ip.c b/networking/ip.c
index 9903c6800..7a0f308f0 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -76,18 +76,18 @@ int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
76int ip_main(int argc UNUSED_PARAM, char **argv) 76int ip_main(int argc UNUSED_PARAM, char **argv)
77{ 77{
78 static const char keywords[] ALIGN1 = 78 static const char keywords[] ALIGN1 =
79 USE_FEATURE_IP_ADDRESS("address\0") 79 IF_FEATURE_IP_ADDRESS("address\0")
80 USE_FEATURE_IP_ROUTE("route\0") 80 IF_FEATURE_IP_ROUTE("route\0")
81 USE_FEATURE_IP_LINK("link\0") 81 IF_FEATURE_IP_LINK("link\0")
82 USE_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0") 82 IF_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0")
83 USE_FEATURE_IP_RULE("rule\0") 83 IF_FEATURE_IP_RULE("rule\0")
84 ; 84 ;
85 enum { 85 enum {
86 USE_FEATURE_IP_ADDRESS(IP_addr,) 86 IF_FEATURE_IP_ADDRESS(IP_addr,)
87 USE_FEATURE_IP_ROUTE(IP_route,) 87 IF_FEATURE_IP_ROUTE(IP_route,)
88 USE_FEATURE_IP_LINK(IP_link,) 88 IF_FEATURE_IP_LINK(IP_link,)
89 USE_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,) 89 IF_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,)
90 USE_FEATURE_IP_RULE(IP_rule,) 90 IF_FEATURE_IP_RULE(IP_rule,)
91 IP_none 91 IP_none
92 }; 92 };
93 int (*ip_func)(char**) = ip_print_help; 93 int (*ip_func)(char**) = ip_print_help;
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index d8fa5f3f2..b5cc3dec4 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -86,7 +86,7 @@ int ipcalc_main(int argc, char **argv)
86#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS 86#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
87 applet_long_options = ipcalc_longopts; 87 applet_long_options = ipcalc_longopts;
88#endif 88#endif
89 opt = getopt32(argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); 89 opt = getopt32(argv, "mbn" IF_FEATURE_IPCALC_FANCY("phs"));
90 argc -= optind; 90 argc -= optind;
91 argv += optind; 91 argv += optind;
92 if (opt & (BROADCAST | NETWORK | NETPREFIX)) { 92 if (opt & (BROADCAST | NETWORK | NETPREFIX)) {
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 66557d8fd..37859525d 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,
287static int iproute_modify(int cmd, unsigned flags, char **argv) 287static int iproute_modify(int cmd, unsigned flags, char **argv)
288{ 288{
289 static const char keywords[] ALIGN1 = 289 static const char keywords[] ALIGN1 =
290 "src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0") 290 "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0")
291 "dev\0""oif\0""to\0""metric\0"; 291 "dev\0""oif\0""to\0""metric\0";
292 enum { 292 enum {
293 ARG_src, 293 ARG_src,
294 ARG_via, 294 ARG_via,
295 ARG_mtu, PARM_lock, 295 ARG_mtu, PARM_lock,
296 ARG_protocol, 296 ARG_protocol,
297USE_FEATURE_IP_RULE(ARG_table,) 297IF_FEATURE_IP_RULE(ARG_table,)
298 ARG_dev, 298 ARG_dev,
299 ARG_oif, 299 ARG_oif,
300 ARG_to, 300 ARG_to,
diff --git a/networking/nc.c b/networking/nc.c
index fe845f582..857d63570 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -29,11 +29,11 @@ int nc_main(int argc, char **argv)
29 int sfd = sfd; /* for gcc */ 29 int sfd = sfd; /* for gcc */
30 int cfd = 0; 30 int cfd = 0;
31 unsigned lport = 0; 31 unsigned lport = 0;
32 SKIP_NC_SERVER(const) unsigned do_listen = 0; 32 IF_NOT_NC_SERVER(const) unsigned do_listen = 0;
33 SKIP_NC_EXTRA (const) unsigned wsecs = 0; 33 IF_NOT_NC_EXTRA (const) unsigned wsecs = 0;
34 SKIP_NC_EXTRA (const) unsigned delay = 0; 34 IF_NOT_NC_EXTRA (const) unsigned delay = 0;
35 SKIP_NC_EXTRA (const int execparam = 0;) 35 IF_NOT_NC_EXTRA (const int execparam = 0;)
36 USE_NC_EXTRA (char **execparam = NULL;) 36 IF_NC_EXTRA (char **execparam = NULL;)
37 len_and_sockaddr *lsa; 37 len_and_sockaddr *lsa;
38 fd_set readfds, testfds; 38 fd_set readfds, testfds;
39 int opt; /* must be signed (getopt returns -1) */ 39 int opt; /* must be signed (getopt returns -1) */
@@ -42,24 +42,24 @@ int nc_main(int argc, char **argv)
42 /* getopt32 is _almost_ usable: 42 /* getopt32 is _almost_ usable:
43 ** it cannot handle "... -e prog -prog-opt" */ 43 ** it cannot handle "... -e prog -prog-opt" */
44 while ((opt = getopt(argc, argv, 44 while ((opt = getopt(argc, argv,
45 "" USE_NC_SERVER("lp:") USE_NC_EXTRA("w:i:f:e:") )) > 0 45 "" IF_NC_SERVER("lp:") IF_NC_EXTRA("w:i:f:e:") )) > 0
46 ) { 46 ) {
47 if (ENABLE_NC_SERVER && opt=='l') 47 if (ENABLE_NC_SERVER && opt=='l')
48 USE_NC_SERVER(do_listen++); 48 IF_NC_SERVER(do_listen++);
49 else if (ENABLE_NC_SERVER && opt=='p') 49 else if (ENABLE_NC_SERVER && opt=='p')
50 USE_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0)); 50 IF_NC_SERVER(lport = bb_lookup_port(optarg, "tcp", 0));
51 else if (ENABLE_NC_EXTRA && opt=='w') 51 else if (ENABLE_NC_EXTRA && opt=='w')
52 USE_NC_EXTRA( wsecs = xatou(optarg)); 52 IF_NC_EXTRA( wsecs = xatou(optarg));
53 else if (ENABLE_NC_EXTRA && opt=='i') 53 else if (ENABLE_NC_EXTRA && opt=='i')
54 USE_NC_EXTRA( delay = xatou(optarg)); 54 IF_NC_EXTRA( delay = xatou(optarg));
55 else if (ENABLE_NC_EXTRA && opt=='f') 55 else if (ENABLE_NC_EXTRA && opt=='f')
56 USE_NC_EXTRA( cfd = xopen(optarg, O_RDWR)); 56 IF_NC_EXTRA( cfd = xopen(optarg, O_RDWR));
57 else if (ENABLE_NC_EXTRA && opt=='e' && optind <= argc) { 57 else if (ENABLE_NC_EXTRA && opt=='e' && optind <= argc) {
58 /* We cannot just 'break'. We should let getopt finish. 58 /* We cannot just 'break'. We should let getopt finish.
59 ** Or else we won't be able to find where 59 ** Or else we won't be able to find where
60 ** 'host' and 'port' params are 60 ** 'host' and 'port' params are
61 ** (think "nc -w 60 host port -e prog"). */ 61 ** (think "nc -w 60 host port -e prog"). */
62 USE_NC_EXTRA( 62 IF_NC_EXTRA(
63 char **p; 63 char **p;
64 // +2: one for progname (optarg) and one for NULL 64 // +2: one for progname (optarg) and one for NULL
65 execparam = xzalloc(sizeof(char*) * (argc - optind + 2)); 65 execparam = xzalloc(sizeof(char*) * (argc - optind + 2));
@@ -154,7 +154,7 @@ int nc_main(int argc, char **argv)
154 xmove_fd(cfd, 0); 154 xmove_fd(cfd, 0);
155 xdup2(0, 1); 155 xdup2(0, 1);
156 xdup2(0, 2); 156 xdup2(0, 2);
157 USE_NC_EXTRA(BB_EXECVP(execparam[0], execparam);) 157 IF_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
158 /* Don't print stuff or it will go over the wire.... */ 158 /* Don't print stuff or it will go over the wire.... */
159 _exit(127); 159 _exit(127);
160 } 160 }
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index 41db94524..47940e9b3 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;
675int nc_main(int argc, char **argv) 675int nc_main(int argc, char **argv)
676{ 676{
677 char *str_p, *str_s; 677 char *str_p, *str_s;
678 USE_NC_EXTRA(char *str_i, *str_o;) 678 IF_NC_EXTRA(char *str_i, *str_o;)
679 char *themdotted = themdotted; /* gcc */ 679 char *themdotted = themdotted; /* gcc */
680 char **proggie; 680 char **proggie;
681 int x; 681 int x;
@@ -711,10 +711,10 @@ int nc_main(int argc, char **argv)
711 711
712 // -g -G -t -r deleted, unimplemented -a deleted too 712 // -g -G -t -r deleted, unimplemented -a deleted too
713 opt_complementary = "?2:vv:w+"; /* max 2 params; -v is a counter; -w N */ 713 opt_complementary = "?2:vv:w+"; /* max 2 params; -v is a counter; -w N */
714 getopt32(argv, "hnp:s:uvw:" USE_NC_SERVER("l") 714 getopt32(argv, "hnp:s:uvw:" IF_NC_SERVER("l")
715 USE_NC_EXTRA("i:o:z"), 715 IF_NC_EXTRA("i:o:z"),
716 &str_p, &str_s, &o_wait 716 &str_p, &str_s, &o_wait
717 USE_NC_EXTRA(, &str_i, &str_o, &o_verbose)); 717 IF_NC_EXTRA(, &str_i, &str_o, &o_verbose));
718 argv += optind; 718 argv += optind;
719#if ENABLE_NC_EXTRA 719#if ENABLE_NC_EXTRA
720 if (option_mask32 & OPT_i) /* line-interval time */ 720 if (option_mask32 & OPT_i) /* line-interval time */
diff --git a/networking/netstat.c b/networking/netstat.c
index b24628068..0c3f93191 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -18,15 +18,15 @@
18#include "inet_common.h" 18#include "inet_common.h"
19 19
20#define NETSTAT_OPTS "laentuwx" \ 20#define NETSTAT_OPTS "laentuwx" \
21 USE_ROUTE( "r") \ 21 IF_ROUTE( "r") \
22 USE_FEATURE_NETSTAT_WIDE("W") \ 22 IF_FEATURE_NETSTAT_WIDE("W") \
23 USE_FEATURE_NETSTAT_PRG( "p") 23 IF_FEATURE_NETSTAT_PRG( "p")
24 24
25enum { 25enum {
26 OPTBIT_KEEP_OLD = 7, 26 OPTBIT_KEEP_OLD = 7,
27 USE_ROUTE( OPTBIT_ROUTE,) 27 IF_ROUTE( OPTBIT_ROUTE,)
28 USE_FEATURE_NETSTAT_WIDE(OPTBIT_WIDE ,) 28 IF_FEATURE_NETSTAT_WIDE(OPTBIT_WIDE ,)
29 USE_FEATURE_NETSTAT_PRG( OPTBIT_PRG ,) 29 IF_FEATURE_NETSTAT_PRG( OPTBIT_PRG ,)
30 OPT_sock_listen = 1 << 0, // l 30 OPT_sock_listen = 1 << 0, // l
31 OPT_sock_all = 1 << 1, // a 31 OPT_sock_all = 1 << 1, // a
32 OPT_extended = 1 << 2, // e 32 OPT_extended = 1 << 2, // e
@@ -35,9 +35,9 @@ enum {
35 OPT_sock_udp = 1 << 5, // u 35 OPT_sock_udp = 1 << 5, // u
36 OPT_sock_raw = 1 << 6, // w 36 OPT_sock_raw = 1 << 6, // w
37 OPT_sock_unix = 1 << 7, // x 37 OPT_sock_unix = 1 << 7, // x
38 OPT_route = USE_ROUTE( (1 << OPTBIT_ROUTE)) + 0, // r 38 OPT_route = IF_ROUTE( (1 << OPTBIT_ROUTE)) + 0, // r
39 OPT_wide = USE_FEATURE_NETSTAT_WIDE((1 << OPTBIT_WIDE )) + 0, // W 39 OPT_wide = IF_FEATURE_NETSTAT_WIDE((1 << OPTBIT_WIDE )) + 0, // W
40 OPT_prg = USE_FEATURE_NETSTAT_PRG( (1 << OPTBIT_PRG )) + 0, // p 40 OPT_prg = IF_FEATURE_NETSTAT_PRG( (1 << OPTBIT_PRG )) + 0, // p
41}; 41};
42 42
43#define NETSTAT_CONNECTED 0x01 43#define NETSTAT_CONNECTED 0x01
diff --git a/networking/ping.c b/networking/ping.c
index f2a612fde..71b2a4be8 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -224,7 +224,7 @@ int ping_main(int argc UNUSED_PARAM, char **argv)
224 224
225/* full(er) version */ 225/* full(er) version */
226 226
227#define OPT_STRING ("qvc:s:w:W:I:4" USE_PING6("6")) 227#define OPT_STRING ("qvc:s:w:W:I:4" IF_PING6("6"))
228enum { 228enum {
229 OPT_QUIET = 1 << 0, 229 OPT_QUIET = 1 << 0,
230 OPT_VERBOSE = 1 << 1, 230 OPT_VERBOSE = 1 << 1,
diff --git a/networking/telnetd.c b/networking/telnetd.c
index ccf328925..b7162ad36 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)
201 201
202static struct tsession * 202static struct tsession *
203make_new_session( 203make_new_session(
204 USE_FEATURE_TELNETD_STANDALONE(int sock) 204 IF_FEATURE_TELNETD_STANDALONE(int sock)
205 SKIP_FEATURE_TELNETD_STANDALONE(void) 205 IF_NOT_FEATURE_TELNETD_STANDALONE(void)
206) { 206) {
207 const char *login_argv[2]; 207 const char *login_argv[2];
208 struct termios termbuf; 208 struct termios termbuf;
@@ -437,9 +437,9 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
437#endif 437#endif
438 /* Even if !STANDALONE, we accept (and ignore) -i, thus people 438 /* Even if !STANDALONE, we accept (and ignore) -i, thus people
439 * don't need to guess whether it's ok to pass -i to us */ 439 * don't need to guess whether it's ok to pass -i to us */
440 opt = getopt32(argv, "f:l:Ki" USE_FEATURE_TELNETD_STANDALONE("p:b:F"), 440 opt = getopt32(argv, "f:l:Ki" IF_FEATURE_TELNETD_STANDALONE("p:b:F"),
441 &issuefile, &loginpath 441 &issuefile, &loginpath
442 USE_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr)); 442 IF_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr));
443 if (!IS_INETD /*&& !re_execed*/) { 443 if (!IS_INETD /*&& !re_execed*/) {
444 /* inform that we start in standalone mode? 444 /* inform that we start in standalone mode?
445 * May be useful when people forget to give -i */ 445 * May be useful when people forget to give -i */
@@ -455,7 +455,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
455 openlog(applet_name, LOG_PID, LOG_DAEMON); 455 openlog(applet_name, LOG_PID, LOG_DAEMON);
456 logmode = LOGMODE_SYSLOG; 456 logmode = LOGMODE_SYSLOG;
457 } 457 }
458 USE_FEATURE_TELNETD_STANDALONE( 458 IF_FEATURE_TELNETD_STANDALONE(
459 if (opt & OPT_PORT) 459 if (opt & OPT_PORT)
460 portnbr = xatou16(opt_portnbr); 460 portnbr = xatou16(opt_portnbr);
461 ); 461 );
diff --git a/networking/telnetd.ctrlSQ.patch b/networking/telnetd.ctrlSQ.patch
index 885e10523..7060e1c6e 100644
--- a/networking/telnetd.ctrlSQ.patch
+++ b/networking/telnetd.ctrlSQ.patch
@@ -104,7 +104,7 @@ exceptional conditions.
104+#endif 104+#endif
105 /* Even if !STANDALONE, we accept (and ignore) -i, thus people 105 /* Even if !STANDALONE, we accept (and ignore) -i, thus people
106 * don't need to guess whether it's ok to pass -i to us */ 106 * don't need to guess whether it's ok to pass -i to us */
107 opt = getopt32(argv, "f:l:Ki" USE_FEATURE_TELNETD_STANDALONE("p:b:F"), 107 opt = getopt32(argv, "f:l:Ki" IF_FEATURE_TELNETD_STANDALONE("p:b:F"),
108@@ -475,7 +495,7 @@ 108@@ -475,7 +495,7 @@
109 FD_SET(ts->sockfd_read, &rdfdset); 109 FD_SET(ts->sockfd_read, &rdfdset);
110 if (ts->size2 > 0) /* can write to socket */ 110 if (ts->size2 > 0) /* can write to socket */
diff --git a/networking/tftp.c b/networking/tftp.c
index 9c78b6e14..352037f1b 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -64,15 +64,15 @@ enum {
64}; 64};
65 65
66#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT 66#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT
67#define USE_GETPUT(...) 67#define IF_GETPUT(...)
68#define CMD_GET(cmd) 1 68#define CMD_GET(cmd) 1
69#define CMD_PUT(cmd) 0 69#define CMD_PUT(cmd) 0
70#elif !ENABLE_FEATURE_TFTP_GET && ENABLE_FEATURE_TFTP_PUT 70#elif !ENABLE_FEATURE_TFTP_GET && ENABLE_FEATURE_TFTP_PUT
71#define USE_GETPUT(...) 71#define IF_GETPUT(...)
72#define CMD_GET(cmd) 0 72#define CMD_GET(cmd) 0
73#define CMD_PUT(cmd) 1 73#define CMD_PUT(cmd) 1
74#else 74#else
75#define USE_GETPUT(...) __VA_ARGS__ 75#define IF_GETPUT(...) __VA_ARGS__
76#define CMD_GET(cmd) ((cmd) & TFTP_OPT_GET) 76#define CMD_GET(cmd) ((cmd) & TFTP_OPT_GET)
77#define CMD_PUT(cmd) ((cmd) & TFTP_OPT_PUT) 77#define CMD_PUT(cmd) ((cmd) & TFTP_OPT_PUT)
78#endif 78#endif
@@ -160,9 +160,9 @@ static int tftp_protocol(
160 len_and_sockaddr *our_lsa, 160 len_and_sockaddr *our_lsa,
161 len_and_sockaddr *peer_lsa, 161 len_and_sockaddr *peer_lsa,
162 const char *local_file 162 const char *local_file
163 USE_TFTP(, const char *remote_file) 163 IF_TFTP(, const char *remote_file)
164 USE_FEATURE_TFTP_BLOCKSIZE(USE_TFTPD(, void *tsize)) 164 IF_FEATURE_TFTP_BLOCKSIZE(IF_TFTPD(, void *tsize))
165 USE_FEATURE_TFTP_BLOCKSIZE(, int blksize)) 165 IF_FEATURE_TFTP_BLOCKSIZE(, int blksize))
166{ 166{
167#if !ENABLE_TFTP 167#if !ENABLE_TFTP
168#define remote_file NULL 168#define remote_file NULL
@@ -178,7 +178,7 @@ static int tftp_protocol(
178#define socket_fd (pfd[0].fd) 178#define socket_fd (pfd[0].fd)
179 int len; 179 int len;
180 int send_len; 180 int send_len;
181 USE_FEATURE_TFTP_BLOCKSIZE(smallint want_option_ack = 0;) 181 IF_FEATURE_TFTP_BLOCKSIZE(smallint want_option_ack = 0;)
182 smallint finished = 0; 182 smallint finished = 0;
183 uint16_t opcode; 183 uint16_t opcode;
184 uint16_t block_nr; 184 uint16_t block_nr;
@@ -564,19 +564,19 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
564#endif 564#endif
565 int result; 565 int result;
566 int port; 566 int port;
567 USE_GETPUT(int opt;) 567 IF_GETPUT(int opt;)
568 568
569 INIT_G(); 569 INIT_G();
570 570
571 /* -p or -g is mandatory, and they are mutually exclusive */ 571 /* -p or -g is mandatory, and they are mutually exclusive */
572 opt_complementary = "" USE_FEATURE_TFTP_GET("g:") USE_FEATURE_TFTP_PUT("p:") 572 opt_complementary = "" IF_FEATURE_TFTP_GET("g:") IF_FEATURE_TFTP_PUT("p:")
573 USE_GETPUT("g--p:p--g:"); 573 IF_GETPUT("g--p:p--g:");
574 574
575 USE_GETPUT(opt =) getopt32(argv, 575 IF_GETPUT(opt =) getopt32(argv,
576 USE_FEATURE_TFTP_GET("g") USE_FEATURE_TFTP_PUT("p") 576 IF_FEATURE_TFTP_GET("g") IF_FEATURE_TFTP_PUT("p")
577 "l:r:" USE_FEATURE_TFTP_BLOCKSIZE("b:"), 577 "l:r:" IF_FEATURE_TFTP_BLOCKSIZE("b:"),
578 &local_file, &remote_file 578 &local_file, &remote_file
579 USE_FEATURE_TFTP_BLOCKSIZE(, &blksize_str)); 579 IF_FEATURE_TFTP_BLOCKSIZE(, &blksize_str));
580 argv += optind; 580 argv += optind;
581 581
582#if ENABLE_FEATURE_TFTP_BLOCKSIZE 582#if ENABLE_FEATURE_TFTP_BLOCKSIZE
@@ -614,8 +614,8 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
614 result = tftp_protocol( 614 result = tftp_protocol(
615 NULL /*our_lsa*/, peer_lsa, 615 NULL /*our_lsa*/, peer_lsa,
616 local_file, remote_file 616 local_file, remote_file
617 USE_FEATURE_TFTP_BLOCKSIZE(USE_TFTPD(, NULL /*tsize*/)) 617 IF_FEATURE_TFTP_BLOCKSIZE(IF_TFTPD(, NULL /*tsize*/))
618 USE_FEATURE_TFTP_BLOCKSIZE(, blksize) 618 IF_FEATURE_TFTP_BLOCKSIZE(, blksize)
619 ); 619 );
620 620
621 if (result != EXIT_SUCCESS && NOT_LONE_DASH(local_file) && CMD_GET(opt)) { 621 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)
635 char *local_file, *mode; 635 char *local_file, *mode;
636 const char *error_msg; 636 const char *error_msg;
637 int opt, result, opcode; 637 int opt, result, opcode;
638 USE_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;) 638 IF_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;)
639 USE_FEATURE_TFTP_BLOCKSIZE(char *tsize = NULL;) 639 IF_FEATURE_TFTP_BLOCKSIZE(char *tsize = NULL;)
640 640
641 INIT_G(); 641 INIT_G();
642 642
@@ -667,9 +667,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
667 opcode = ntohs(*(uint16_t*)block_buf); 667 opcode = ntohs(*(uint16_t*)block_buf);
668 if (result < 4 || result >= sizeof(block_buf) 668 if (result < 4 || result >= sizeof(block_buf)
669 || block_buf[result-1] != '\0' 669 || block_buf[result-1] != '\0'
670 || (USE_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */ 670 || (IF_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */
671 USE_GETPUT(&&) 671 IF_GETPUT(&&)
672 USE_FEATURE_TFTP_GET(opcode != TFTP_WRQ) /* not upload */ 672 IF_FEATURE_TFTP_GET(opcode != TFTP_WRQ) /* not upload */
673 ) 673 )
674 ) { 674 ) {
675 goto err; 675 goto err;
@@ -711,9 +711,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
711 error_msg = bb_msg_write_error; 711 error_msg = bb_msg_write_error;
712 goto err; 712 goto err;
713 } 713 }
714 USE_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */ 714 IF_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */
715 } else { 715 } else {
716 USE_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */ 716 IF_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */
717 } 717 }
718 718
719 /* NB: if error_pkt_str or error_pkt_reason is set up, 719 /* 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)
724 /* tftp_protocol() will create new one, bound to particular local IP */ 724 /* tftp_protocol() will create new one, bound to particular local IP */
725 result = tftp_protocol( 725 result = tftp_protocol(
726 our_lsa, peer_lsa, 726 our_lsa, peer_lsa,
727 local_file USE_TFTP(, NULL /*remote_file*/) 727 local_file IF_TFTP(, NULL /*remote_file*/)
728 USE_FEATURE_TFTP_BLOCKSIZE(, tsize) 728 IF_FEATURE_TFTP_BLOCKSIZE(, tsize)
729 USE_FEATURE_TFTP_BLOCKSIZE(, blksize) 729 IF_FEATURE_TFTP_BLOCKSIZE(, blksize)
730 ); 730 );
731 731
732 return result; 732 return result;
diff --git a/networking/tunctl.c b/networking/tunctl.c
index a8e5270ad..02ff71dce 100644
--- a/networking/tunctl.c
+++ b/networking/tunctl.c
@@ -48,9 +48,9 @@ int tunctl_main(int argc UNUSED_PARAM, char **argv)
48 }; 48 };
49 49
50 opt_complementary = "=0:t--d:d--t"; // no arguments; t ^ d 50 opt_complementary = "=0:t--d:d--t"; // no arguments; t ^ d
51 opts = getopt32(argv, "f:t:d:" USE_FEATURE_TUNCTL_UG("u:g:b"), 51 opts = getopt32(argv, "f:t:d:" IF_FEATURE_TUNCTL_UG("u:g:b"),
52 &opt_device, &opt_name, &opt_name 52 &opt_device, &opt_name, &opt_name
53 USE_FEATURE_TUNCTL_UG(, &opt_user, &opt_group)); 53 IF_FEATURE_TUNCTL_UG(, &opt_user, &opt_group));
54 54
55 // select device 55 // select device
56 memset(&ifr, 0, sizeof(ifr)); 56 memset(&ifr, 0, sizeof(ifr));
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index e9f99e39c..2dd3cd077 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -133,7 +133,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
133{ 133{
134 uint8_t *temp, *message; 134 uint8_t *temp, *message;
135 char *str_c, *str_V, *str_h, *str_F, *str_r; 135 char *str_c, *str_V, *str_h, *str_F, *str_r;
136 USE_FEATURE_UDHCP_PORT(char *str_P;) 136 IF_FEATURE_UDHCP_PORT(char *str_P;)
137 llist_t *list_O = NULL; 137 llist_t *list_O = NULL;
138 int tryagain_timeout = 20; 138 int tryagain_timeout = 20;
139 int discover_timeout = 3; 139 int discover_timeout = 3;
@@ -175,8 +175,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
175 "no-default-options\0" No_argument "o" 175 "no-default-options\0" No_argument "o"
176 "foreground\0" No_argument "f" 176 "foreground\0" No_argument "f"
177 "background\0" No_argument "b" 177 "background\0" No_argument "b"
178 USE_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a") 178 IF_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
179 USE_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P") 179 IF_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
180 ; 180 ;
181#endif 181#endif
182 enum { 182 enum {
@@ -204,33 +204,33 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
204/* The rest has variable bit positions, need to be clever */ 204/* The rest has variable bit positions, need to be clever */
205 OPTBIT_f = 20, 205 OPTBIT_f = 20,
206 USE_FOR_MMU( OPTBIT_b,) 206 USE_FOR_MMU( OPTBIT_b,)
207 USE_FEATURE_UDHCPC_ARPING(OPTBIT_a,) 207 IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
208 USE_FEATURE_UDHCP_PORT( OPTBIT_P,) 208 IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
209 USE_FOR_MMU( OPT_b = 1 << OPTBIT_b,) 209 USE_FOR_MMU( OPT_b = 1 << OPTBIT_b,)
210 USE_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,) 210 IF_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
211 USE_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,) 211 IF_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
212 }; 212 };
213 213
214 /* Default options. */ 214 /* Default options. */
215 USE_FEATURE_UDHCP_PORT(SERVER_PORT = 67;) 215 IF_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
216 USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;) 216 IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
217 client_config.interface = "eth0"; 217 client_config.interface = "eth0";
218 client_config.script = DEFAULT_SCRIPT; 218 client_config.script = DEFAULT_SCRIPT;
219 219
220 /* Parse command line */ 220 /* Parse command line */
221 /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */ 221 /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */
222 opt_complementary = "c--C:C--c:O::T+:t+:A+"; 222 opt_complementary = "c--C:C--c:O::T+:t+:A+";
223 USE_GETOPT_LONG(applet_long_options = udhcpc_longopts;) 223 IF_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
224 opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of" 224 opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
225 USE_FOR_MMU("b") 225 USE_FOR_MMU("b")
226 USE_FEATURE_UDHCPC_ARPING("a") 226 IF_FEATURE_UDHCPC_ARPING("a")
227 USE_FEATURE_UDHCP_PORT("P:") 227 IF_FEATURE_UDHCP_PORT("P:")
228 , &str_c, &str_V, &str_h, &str_h, &str_F 228 , &str_c, &str_V, &str_h, &str_h, &str_F
229 , &client_config.interface, &client_config.pidfile, &str_r /* i,p */ 229 , &client_config.interface, &client_config.pidfile, &str_r /* i,p */
230 , &client_config.script /* s */ 230 , &client_config.script /* s */
231 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */ 231 , &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
232 , &list_O 232 , &list_O
233 USE_FEATURE_UDHCP_PORT(, &str_P) 233 IF_FEATURE_UDHCP_PORT(, &str_P)
234 ); 234 );
235 if (opt & OPT_c) 235 if (opt & OPT_c)
236 client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0); 236 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 7b7794266..361624f17 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -10,7 +10,7 @@ struct client_config_t {
10 /* TODO: combine flag fields into single "unsigned opt" */ 10 /* TODO: combine flag fields into single "unsigned opt" */
11 /* (can be set directly to the result of getopt32) */ 11 /* (can be set directly to the result of getopt32) */
12 char no_default_options; /* Do not include default optins in request */ 12 char no_default_options; /* Do not include default optins in request */
13 USE_FEATURE_UDHCP_PORT(uint16_t port;) 13 IF_FEATURE_UDHCP_PORT(uint16_t port;)
14 int ifindex; /* Index number of the interface to use */ 14 int ifindex; /* Index number of the interface to use */
15 uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */ 15 uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
16 const char *interface; /* The name of the interface to use */ 16 const char *interface; /* The name of the interface to use */
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index a82fd8c47..ccdfd362b 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -37,14 +37,14 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
37 unsigned opt; 37 unsigned opt;
38 struct option_set *option; 38 struct option_set *option;
39 struct dhcpOfferedAddr *lease, static_lease; 39 struct dhcpOfferedAddr *lease, static_lease;
40 USE_FEATURE_UDHCP_PORT(char *str_P;) 40 IF_FEATURE_UDHCP_PORT(char *str_P;)
41 41
42#if ENABLE_FEATURE_UDHCP_PORT 42#if ENABLE_FEATURE_UDHCP_PORT
43 SERVER_PORT = 67; 43 SERVER_PORT = 67;
44 CLIENT_PORT = 68; 44 CLIENT_PORT = 68;
45#endif 45#endif
46 46
47 opt = getopt32(argv, "fS" USE_FEATURE_UDHCP_PORT("P:", &str_P)); 47 opt = getopt32(argv, "fS" IF_FEATURE_UDHCP_PORT("P:", &str_P));
48 argv += optind; 48 argv += optind;
49 if (!(opt & 1)) { /* no -f */ 49 if (!(opt & 1)) { /* no -f */
50 bb_daemonize_or_rexec(0, argv); 50 bb_daemonize_or_rexec(0, argv);
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index a061a9c9b..b13897608 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -394,7 +394,7 @@ void FAST_FUNC read_leases(const char *file)
394 struct dhcpOfferedAddr lease; 394 struct dhcpOfferedAddr lease;
395 int64_t written_at, time_passed; 395 int64_t written_at, time_passed;
396 int fd; 396 int fd;
397 USE_UDHCP_DEBUG(unsigned i;) 397 IF_UDHCP_DEBUG(unsigned i;)
398 398
399 fd = open_or_warn(file, O_RDONLY); 399 fd = open_or_warn(file, O_RDONLY);
400 if (fd < 0) 400 if (fd < 0)
@@ -410,7 +410,7 @@ void FAST_FUNC read_leases(const char *file)
410 if ((uint64_t)time_passed > 12 * 60 * 60) 410 if ((uint64_t)time_passed > 12 * 60 * 60)
411 goto ret; 411 goto ret;
412 412
413 USE_UDHCP_DEBUG(i = 0;) 413 IF_UDHCP_DEBUG(i = 0;)
414 while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) { 414 while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) {
415 /* ADDME: what if it matches some static lease? */ 415 /* ADDME: what if it matches some static lease? */
416 uint32_t y = ntohl(lease.yiaddr); 416 uint32_t y = ntohl(lease.yiaddr);
@@ -424,7 +424,7 @@ void FAST_FUNC read_leases(const char *file)
424 bb_error_msg("too many leases while loading %s", file); 424 bb_error_msg("too many leases while loading %s", file);
425 break; 425 break;
426 } 426 }
427 USE_UDHCP_DEBUG(i++;) 427 IF_UDHCP_DEBUG(i++;)
428 } 428 }
429 } 429 }
430 DEBUG("Read %d leases", i); 430 DEBUG("Read %d leases", i);
diff --git a/networking/wget.c b/networking/wget.c
index 48759049d..ca3acd085 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -497,14 +497,14 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
497 applet_long_options = wget_longopts; 497 applet_long_options = wget_longopts;
498#endif 498#endif
499 /* server.allocated = target.allocated = NULL; */ 499 /* server.allocated = target.allocated = NULL; */
500 opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); 500 opt_complementary = "-1" IF_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
501 opt = getopt32(argv, "csqO:P:Y:U:" /*ignored:*/ "t:T:", 501 opt = getopt32(argv, "csqO:P:Y:U:" /*ignored:*/ "t:T:",
502 &fname_out, &dir_prefix, 502 &fname_out, &dir_prefix,
503 &proxy_flag, &user_agent, 503 &proxy_flag, &user_agent,
504 NULL, /* -t RETRIES */ 504 NULL, /* -t RETRIES */
505 NULL /* -T NETWORK_READ_TIMEOUT */ 505 NULL /* -T NETWORK_READ_TIMEOUT */
506 USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) 506 IF_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
507 USE_FEATURE_WGET_LONG_OPTIONS(, &post_data) 507 IF_FEATURE_WGET_LONG_OPTIONS(, &post_data)
508 ); 508 );
509 if (strcmp(proxy_flag, "off") == 0) { 509 if (strcmp(proxy_flag, "off") == 0) {
510 /* Use the proxy if necessary */ 510 /* Use the proxy if necessary */