summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-06-25 22:39:24 +0000
committerRob Landley <rob@landley.net>2006-06-25 22:39:24 +0000
commit11c7a7bed60a55a670363bec3c07e8d88aa372b7 (patch)
tree809c167b4c007b334afcb34b4689841a029022ac /networking
parentf087798e8bf5857b679c369601426ca29334caee (diff)
downloadbusybox-w32-11c7a7bed60a55a670363bec3c07e8d88aa372b7.tar.gz
busybox-w32-11c7a7bed60a55a670363bec3c07e8d88aa372b7.tar.bz2
busybox-w32-11c7a7bed60a55a670363bec3c07e8d88aa372b7.zip
Various cleanups I made while going through Erik Hovland's patch submissions,
some of which are even from him. :)
Diffstat (limited to 'networking')
-rw-r--r--networking/udhcp/dhcpc.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index a1b6d4626..8c795bc62 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -61,41 +61,6 @@ struct client_config_t client_config = {
61 .arp = "\0\0\0\0\0\0", /* appease gcc-3.0 */ 61 .arp = "\0\0\0\0\0\0", /* appease gcc-3.0 */
62}; 62};
63 63
64#ifndef IN_BUSYBOX
65static void ATTRIBUTE_NORETURN show_usage(void)
66{
67 printf(
68"Usage: udhcpc [OPTIONS]\n\n"
69" -c, --clientid=CLIENTID Set client identifier - type is first char\n"
70" -C, --clientid-none Suppress default client identifier\n"
71" -V, --vendorclass=CLASSID Set vendor class identifier\n"
72" -H, --hostname=HOSTNAME Client hostname\n"
73" -h Alias for -H\n"
74" -F, --fqdn=FQDN Client fully qualified domain name\n"
75" -f, --foreground Do not fork after getting lease\n"
76" -b, --background Fork to background if lease cannot be\n"
77" immediately negotiated.\n"
78" -i, --interface=INTERFACE Interface to use (default: eth0)\n"
79" -n, --now Exit with failure if lease cannot be\n"
80" immediately negotiated.\n"
81" -p, --pidfile=file Store process ID of daemon in file\n"
82" -q, --quit Quit after obtaining lease\n"
83" -r, --request=IP IP address to request (default: none)\n"
84" -s, --script=file Run file at dhcp events (default:\n"
85" " DEFAULT_SCRIPT ")\n"
86" -T, --timeout=seconds Try to get the lease for the amount of\n"
87" seconds (default: 3)\n"
88" -t, --retries=NUM Send up to NUM request packets\n"
89" -v, --version Display version\n"
90 );
91 exit(0);
92}
93#else
94#define show_usage bb_show_usage
95extern void show_usage(void) ATTRIBUTE_NORETURN;
96#endif
97
98
99/* just a little helper */ 64/* just a little helper */
100static void change_mode(int new_mode) 65static void change_mode(int new_mode)
101{ 66{
@@ -169,11 +134,7 @@ static void client_background(void)
169} 134}
170 135
171 136
172#ifdef COMBINED_BINARY
173int udhcpc_main(int argc, char *argv[]) 137int udhcpc_main(int argc, char *argv[])
174#else
175int main(int argc, char *argv[])
176#endif
177{ 138{
178 uint8_t *temp, *message; 139 uint8_t *temp, *message;
179 unsigned long t1 = 0, t2 = 0, xid = 0; 140 unsigned long t1 = 0, t2 = 0, xid = 0;
@@ -218,7 +179,7 @@ int main(int argc, char *argv[])
218 179
219 switch (c) { 180 switch (c) {
220 case 'c': 181 case 'c':
221 if (no_clientid) show_usage(); 182 if (no_clientid) bb_show_usage();
222 len = strlen(optarg) > 255 ? 255 : strlen(optarg); 183 len = strlen(optarg) > 255 ? 255 : strlen(optarg);
223 free(client_config.clientid); 184 free(client_config.clientid);
224 client_config.clientid = xmalloc(len + 2); 185 client_config.clientid = xmalloc(len + 2);
@@ -228,7 +189,7 @@ int main(int argc, char *argv[])
228 strncpy((char*)client_config.clientid + OPT_DATA, optarg, len); 189 strncpy((char*)client_config.clientid + OPT_DATA, optarg, len);
229 break; 190 break;
230 case 'C': 191 case 'C':
231 if (client_config.clientid) show_usage(); 192 if (client_config.clientid) bb_show_usage();
232 no_clientid = 1; 193 no_clientid = 1;
233 break; 194 break;
234 case 'V': 195 case 'V':
@@ -300,7 +261,7 @@ int main(int argc, char *argv[])
300 return 0; 261 return 0;
301 break; 262 break;
302 default: 263 default:
303 show_usage(); 264 bb_show_usage();
304 } 265 }
305 } 266 }
306 267