don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes text data bss dec hex filename 773469 1058 11092 785619 bfcd3 busybox_old 772644 1058 11092 784794 bf99a busybox_unstripped
This commit is contained in:
@@ -445,7 +445,7 @@ int arp_main(int argc, char **argv)
|
||||
if (!ap)
|
||||
bb_error_msg_and_die("%s: %s not supported", DFLT_AF, "address family");
|
||||
|
||||
getopt32(argc, argv, "A:p:H:t:i:adnDsv", &protocol, &protocol,
|
||||
getopt32(argv, "A:p:H:t:i:adnDsv", &protocol, &protocol,
|
||||
&hw_type, &hw_type, &device);
|
||||
argv += optind;
|
||||
if (option_mask32 & ARP_OPT_A || option_mask32 & ARP_OPT_p) {
|
||||
|
@@ -249,7 +249,7 @@ int arping_main(int argc, char **argv)
|
||||
* Advert also sets unsolicited.
|
||||
*/
|
||||
opt_complementary = "=1:Df:AU";
|
||||
opt = getopt32(argc, argv, "DUAqfbc:w:I:s:",
|
||||
opt = getopt32(argv, "DUAqfbc:w:I:s:",
|
||||
&str_count, &str_timeout, &device, &source);
|
||||
if (opt & 0x40) /* -c: count */
|
||||
count = xatou(str_count);
|
||||
|
@@ -338,7 +338,7 @@ int dnsd_main(int argc, char **argv)
|
||||
uint16_t port = 53;
|
||||
uint8_t buf[MAX_PACK_LEN];
|
||||
|
||||
getopt32(argc, argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport);
|
||||
getopt32(argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport);
|
||||
//if (option_mask32 & 0x1) // -i
|
||||
//if (option_mask32 & 0x2) // -c
|
||||
if (option_mask32 & 0x4) // -t
|
||||
|
@@ -195,7 +195,7 @@ int ether_wake_main(int argc, char **argv)
|
||||
|
||||
/* handle misc user options */
|
||||
opt_complementary = "=1";
|
||||
flags = getopt32(argc, argv, "bi:p:", &ifname, &pass);
|
||||
flags = getopt32(argv, "bi:p:", &ifname, &pass);
|
||||
if (flags & 4) /* -p */
|
||||
wol_passwd_sz = get_wol_pw(pass, wol_passwd);
|
||||
flags &= 1; /* we further interested only in -b [bcast] flag */
|
||||
|
@@ -331,7 +331,7 @@ int ftpgetput_main(int argc, char **argv)
|
||||
applet_long_options = ftpgetput_longopts;
|
||||
#endif
|
||||
opt_complementary = "=3"; /* must have 3 params */
|
||||
opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port);
|
||||
opt = getopt32(argv, "cvu:p:P:", &server->user, &server->password, &port);
|
||||
argv += optind;
|
||||
|
||||
/* Process the non-option command line arguments */
|
||||
|
@@ -60,7 +60,7 @@ int hostname_main(int argc, char **argv)
|
||||
if (argc < 1)
|
||||
bb_show_usage();
|
||||
|
||||
getopt32(argc, argv, "dfisF:", &hostname_str);
|
||||
getopt32(argv, "dfisF:", &hostname_str);
|
||||
|
||||
/* Output in desired format */
|
||||
if (option_mask32 & OPT_dfis) {
|
||||
|
@@ -1975,7 +1975,7 @@ int httpd_main(int argc, char **argv)
|
||||
/* We do not "absolutize" path given by -h (home) opt.
|
||||
* If user gives relative path in -h, $SCRIPT_FILENAME can end up
|
||||
* relative too. */
|
||||
opt = getopt32(argc, argv, "c:d:h:"
|
||||
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:")
|
||||
|
@@ -1148,7 +1148,7 @@ int ifupdown_main(int argc, char **argv)
|
||||
cmds = iface_up;
|
||||
}
|
||||
|
||||
getopt32(argc, argv, OPTION_STR, &interfaces);
|
||||
getopt32(argv, OPTION_STR, &interfaces);
|
||||
if (argc - optind > 0) {
|
||||
if (DO_ALL) bb_show_usage();
|
||||
} else {
|
||||
|
@@ -1278,7 +1278,7 @@ int inetd_main(int argc, char **argv)
|
||||
if (uid != 0)
|
||||
config_filename = NULL;
|
||||
|
||||
opt = getopt32(argc, argv, "R:f", &stoomany);
|
||||
opt = getopt32(argv, "R:f", &stoomany);
|
||||
if (opt & 1)
|
||||
toomany = xatoi_u(stoomany);
|
||||
argv += optind;
|
||||
|
@@ -87,7 +87,7 @@ int ipcalc_main(int argc, char **argv)
|
||||
#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
|
||||
applet_long_options = ipcalc_longopts;
|
||||
#endif
|
||||
opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs"));
|
||||
opt = getopt32(argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs"));
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (opt & (BROADCAST | NETWORK | NETPREFIX)) {
|
||||
|
@@ -107,7 +107,7 @@ int fakeidentd_main(int argc, char **argv)
|
||||
unsigned opt;
|
||||
int fd;
|
||||
|
||||
opt = getopt32(argc, argv, "fiwb:", &bind_address);
|
||||
opt = getopt32(argv, "fiwb:", &bind_address);
|
||||
strcpy(bogouser, "nobody");
|
||||
if (argv[optind])
|
||||
strncpy(bogouser, argv[optind], sizeof(bogouser));
|
||||
|
@@ -66,7 +66,7 @@ int nameif_main(int argc, char **argv)
|
||||
int if_index = 1;
|
||||
mactable_t *ch;
|
||||
|
||||
if (1 & getopt32(argc, argv, "sc:", &fname)) {
|
||||
if (1 & getopt32(argv, "sc:", &fname)) {
|
||||
openlog(applet_name, 0, LOG_LOCAL0);
|
||||
logmode = LOGMODE_SYSLOG;
|
||||
}
|
||||
|
@@ -706,7 +706,7 @@ int nc_main(int argc, char **argv)
|
||||
|
||||
// -g -G -t -r deleted, unimplemented -a deleted too
|
||||
opt_complementary = "?2:vv"; /* max 2 params, -v is a counter */
|
||||
getopt32(argc, argv, "hnp:s:uvw:" USE_NC_SERVER("l")
|
||||
getopt32(argv, "hnp:s:uvw:" USE_NC_SERVER("l")
|
||||
USE_NC_EXTRA("i:o:z"),
|
||||
&str_p, &str_s, &str_w
|
||||
USE_NC_EXTRA(, &str_i, &str_o, &o_verbose));
|
||||
|
@@ -497,7 +497,7 @@ int netstat_main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Option string must match NETSTAT_xxx constants */
|
||||
opt = getopt32(argc, argv, NETSTAT_OPTS);
|
||||
opt = getopt32(argv, NETSTAT_OPTS);
|
||||
if (opt & 0x1) { // -l
|
||||
flags &= ~NETSTAT_CONNECTED;
|
||||
flags |= NETSTAT_LISTENING;
|
||||
|
@@ -689,7 +689,7 @@ int ping_main(int argc, char **argv)
|
||||
|
||||
/* exactly one argument needed, -v and -q don't mix */
|
||||
opt_complementary = "=1:q--v:v--q";
|
||||
getopt32(argc, argv, OPT_STRING, &opt_c, &opt_s, &opt_I);
|
||||
getopt32(argv, OPT_STRING, &opt_c, &opt_s, &opt_I);
|
||||
if (option_mask32 & OPT_c) pingcount = xatoul(opt_c); // -c
|
||||
if (option_mask32 & OPT_s) datalen = xatou16(opt_s); // -s
|
||||
if (option_mask32 & OPT_I) { // -I
|
||||
|
@@ -54,7 +54,7 @@ int pscan_main(int argc, char **argv)
|
||||
unsigned start;
|
||||
|
||||
opt_complementary = "=1"; /* exactly one non-option */
|
||||
getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt);
|
||||
getopt32(argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt);
|
||||
argv += optind;
|
||||
max_port = xatou_range(opt_max_port, 1, 65535);
|
||||
port = xatou_range(opt_min_port, 1, max_port);
|
||||
|
@@ -656,7 +656,7 @@ int route_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
opt = getopt32(argc, argv, "A:ne", &family);
|
||||
opt = getopt32(argv, "A:ne", &family);
|
||||
|
||||
if ((opt & ROUTE_OPT_A) && strcmp(family, "inet") != 0) {
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
|
@@ -152,7 +152,7 @@ int slattach_main(int argc, char **argv)
|
||||
INIT_G();
|
||||
|
||||
/* Parse command line options */
|
||||
opt = getopt32(argc, argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd);
|
||||
opt = getopt32(argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd);
|
||||
/*argc -= optind;*/
|
||||
argv += optind;
|
||||
|
||||
|
@@ -583,7 +583,7 @@ int telnet_main(int argc, char** argv)
|
||||
bb_show_usage();
|
||||
|
||||
#if ENABLE_FEATURE_TELNET_AUTOLOGIN
|
||||
if (1 & getopt32(argc, argv, "al:", &G.autologin))
|
||||
if (1 & getopt32(argv, "al:", &G.autologin))
|
||||
G.autologin = getenv("USER");
|
||||
argv += optind;
|
||||
#else
|
||||
|
@@ -386,7 +386,7 @@ int telnetd_main(int argc, char **argv)
|
||||
OPT_INETD = 0x20 * ENABLE_FEATURE_TELNETD_STANDALONE,
|
||||
};
|
||||
|
||||
opt = getopt32(argc, argv, "f:l:" USE_FEATURE_TELNETD_STANDALONE("p:b:Fi"),
|
||||
opt = getopt32(argv, "f:l:" USE_FEATURE_TELNETD_STANDALONE("p:b:Fi"),
|
||||
&issuefile, &loginpath
|
||||
USE_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr));
|
||||
/* Redirect log to syslog early, if needed */
|
||||
|
@@ -405,7 +405,7 @@ int tftp_main(int argc, char **argv)
|
||||
opt_complementary = "" USE_FEATURE_TFTP_GET("g:") USE_FEATURE_TFTP_PUT("p:")
|
||||
USE_GETPUT("?g--p:p--g");
|
||||
|
||||
USE_GETPUT(cmd =) getopt32(argc, argv,
|
||||
USE_GETPUT(cmd =) getopt32(argv,
|
||||
USE_FEATURE_TFTP_GET("g") USE_FEATURE_TFTP_PUT("p")
|
||||
"l:r:" USE_FEATURE_TFTP_BLOCKSIZE("b:"),
|
||||
&localfile, &remotefile
|
||||
|
@@ -941,7 +941,7 @@ int traceroute_main(int argc, char **argv)
|
||||
opt_complementary = "x-x";
|
||||
#endif
|
||||
|
||||
op = getopt32(argc, argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:"
|
||||
op = getopt32(argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:"
|
||||
#if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
|
||||
"g:"
|
||||
#endif
|
||||
|
@@ -215,7 +215,7 @@ int udhcpc_main(int argc, char **argv)
|
||||
#if ENABLE_GETOPT_LONG
|
||||
applet_long_options = udhcpc_longopts;
|
||||
#endif
|
||||
opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS",
|
||||
opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS",
|
||||
&str_c, &str_V, &str_h, &str_h, &str_F,
|
||||
&client_config.interface, &client_config.pidfile, &str_r,
|
||||
&client_config.script, &str_T, &str_t
|
||||
|
@@ -36,7 +36,7 @@ int udhcpd_main(int argc, char **argv)
|
||||
struct option_set *option;
|
||||
struct dhcpOfferedAddr *lease, static_lease;
|
||||
|
||||
opt = getopt32(argc, argv, "fS");
|
||||
opt = getopt32(argv, "fS");
|
||||
argv += optind;
|
||||
|
||||
if (!(opt & 1)) { /* no -f */
|
||||
|
@@ -33,7 +33,7 @@ int dumpleases_main(int argc, char **argv)
|
||||
applet_long_options = dumpleases_longopts;
|
||||
#endif
|
||||
opt_complementary = "=0:a--r:r--a";
|
||||
opt = getopt32(argc, argv, "arf:", &file);
|
||||
opt = getopt32(argv, "arf:", &file);
|
||||
|
||||
fd = xopen(file, O_RDONLY);
|
||||
|
||||
|
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv)
|
||||
#endif
|
||||
/* server.allocated = target.allocated = NULL; */
|
||||
opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::");
|
||||
opt = getopt32(argc, argv, "csqO:P:Y:U:",
|
||||
opt = getopt32(argv, "csqO:P:Y:U:",
|
||||
&fname_out, &dir_prefix,
|
||||
&proxy_flag, &user_agent
|
||||
USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist)
|
||||
|
@@ -203,7 +203,7 @@ int zcip_main(int argc, char **argv)
|
||||
// parse commandline: prog [options] ifname script
|
||||
// exactly 2 args; -v accumulates and implies -f
|
||||
opt_complementary = "=2:vv:vf";
|
||||
opts = getopt32(argc, argv, "fqr:v", &r_opt, &verbose);
|
||||
opts = getopt32(argv, "fqr:v", &r_opt, &verbose);
|
||||
if (!FOREGROUND) {
|
||||
/* Do it early, before all bb_xx_msg calls */
|
||||
openlog(applet_name, 0, LOG_DAEMON);
|
||||
|
Reference in New Issue
Block a user