diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-21 11:09:40 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-21 11:09:40 +0000 |
commit | 5e34ff29bcc870936ab18172f438a34d042d4e03 (patch) | |
tree | a5e7a528f2f916eb883f1161eadceacdf2dca4be /networking/udhcp | |
parent | 8b814b4a349e2262c0ad25793b05206a14651ebb (diff) | |
download | busybox-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/udhcp')
-rw-r--r-- | networking/udhcp/dhcpc.c | 26 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.h | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcpd.c | 4 | ||||
-rw-r--r-- | networking/udhcp/files.c | 6 |
4 files changed, 19 insertions, 19 deletions
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); |