From 67b23e6043d8e2b30b0bf3bc105b8583c2a26db5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 3 Oct 2006 21:00:06 +0000 Subject: getopt_ulflags -> getopt32. It is impossible to formulate sane ABI based on size of ulong because it can be 32-bit or 64-bit. Basically it means that you cannot portably use more that 32 option chars in one call anyway... Make it explicit. --- networking/arping.c | 6 +++--- networking/dnsd.c | 2 +- networking/ether-wake.c | 2 +- networking/fakeidentd.c | 2 +- networking/ftpgetput.c | 6 +++--- networking/hostname.c | 4 ++-- networking/httpd.c | 4 ++-- networking/ifupdown.c | 2 +- networking/inetd.c | 2 +- networking/ipcalc.c | 4 ++-- networking/nameif.c | 2 +- networking/netstat.c | 6 +++--- networking/route.c | 4 ++-- networking/telnet.c | 2 +- networking/telnetd.c | 4 ++-- networking/tftp.c | 6 +++--- networking/traceroute.c | 6 +++--- networking/wget.c | 8 ++++---- networking/zcip.c | 6 +++--- 19 files changed, 39 insertions(+), 39 deletions(-) (limited to 'networking') diff --git a/networking/arping.c b/networking/arping.c index f84c8a75c..1ff6f90be 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -265,14 +265,14 @@ int arping_main(int argc, char **argv) xsetuid(getuid()); { - unsigned long opt; + unsigned opt; char *_count, *_timeout; /* Dad also sets quit_on_reply. * Advert also sets unsolicited. */ - bb_opt_complementally = "Df:AU"; - opt = bb_getopt_ulflags(argc, argv, "DUAqfbc:w:i:s:", + opt_complementary = "Df:AU"; + opt = getopt32(argc, argv, "DUAqfbc:w:i:s:", &_count, &_timeout, &device, &source); cfg |= opt & 0x3f; /* set respective flags */ if (opt & 0x40) /* -c: count */ diff --git a/networking/dnsd.c b/networking/dnsd.c index b0e74d770..ab3704707 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -372,7 +372,7 @@ int dnsd_main(int argc, char **argv) char *sttl=NULL, *sport=NULL; if(argc > 1) - flags = bb_getopt_ulflags(argc, argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport); + flags = getopt32(argc, argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport); if(sttl) if(!(ttl = atol(sttl))) bb_show_usage(); diff --git a/networking/ether-wake.c b/networking/ether-wake.c index f4ca889fa..294a9dd3c 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -120,7 +120,7 @@ int ether_wake_main(int argc, char *argv[]) struct whereto_t whereto; /* who to wake up */ /* handle misc user options */ - flags = bb_getopt_ulflags(argc, argv, "bi:p:", &ifname, &pass); + flags = getopt32(argc, argv, "bi:p:", &ifname, &pass); if (optind == argc) bb_show_usage(); if (pass) diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index 2d690edba..6070e5f2d 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c @@ -228,7 +228,7 @@ int fakeidentd_main(int argc, char **argv) FD_SET(0, &G.readfds); /* handle -b parameter */ - bb_getopt_ulflags(argc, argv, "b:", &bind_ip_address); + getopt32(argc, argv, "b:", &bind_ip_address); /* handle optional REPLY STRING */ if (optind < argc) G.identuser = argv[optind]; diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 453cce571..25b7f1427 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -275,7 +275,7 @@ static const struct option ftpgetput_long_options[] = { int ftpgetput_main(int argc, char **argv) { /* content-length of the file */ - unsigned long opt; + unsigned opt; char *port = "ftp"; /* socket to ftp server */ @@ -305,9 +305,9 @@ int ftpgetput_main(int argc, char **argv) * Decipher the command line */ if (ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS) - bb_applet_long_options = ftpgetput_long_options; + applet_long_options = ftpgetput_long_options; - opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); + opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); /* Process the non-option command line arguments */ if (argc - optind != 3) { diff --git a/networking/hostname.c b/networking/hostname.c index 2850bd5bd..4fe28d740 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -55,13 +55,13 @@ int hostname_main(int argc, char **argv) }; char buf[256]; - unsigned long opt; + unsigned opt; char *hostname_str = NULL; if (argc < 1) bb_show_usage(); - opt = bb_getopt_ulflags(argc, argv, "dfisF:", &hostname_str); + opt = getopt32(argc, argv, "dfisF:", &hostname_str); /* Output in desired format */ if (opt & OPT_dfis) { diff --git a/networking/httpd.c b/networking/httpd.c index e533594f2..ac9eac6bf 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1909,7 +1909,7 @@ static const char httpd_opts[] = "c:d:h:" int httpd_main(int argc, char *argv[]) { - unsigned long opt; + unsigned opt; const char *home_httpd = home; char *url_for_decode; USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) @@ -1932,7 +1932,7 @@ int httpd_main(int argc, char *argv[]) config->ContentLength = -1; - opt = bb_getopt_ulflags(argc, argv, httpd_opts, + opt = getopt32(argc, argv, httpd_opts, &(config->configFile), &url_for_decode, &home_httpd USE_FEATURE_HTTPD_ENCODE_URL_STR(, &url_for_encode) USE_FEATURE_HTTPD_BASIC_AUTH(, &(config->realm)) diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 9dd1c9926..f34287580 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -1088,7 +1088,7 @@ int ifupdown_main(int argc, char **argv) cmds = iface_down; } - option_mask = bb_getopt_ulflags(argc, argv, OPTION_STR, &interfaces); + option_mask = getopt32(argc, argv, OPTION_STR, &interfaces); if (argc - optind > 0) { if (DO_ALL) bb_show_usage(); } else diff --git a/networking/inetd.c b/networking/inetd.c index 8c8843b9b..350f91dc4 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -1253,7 +1253,7 @@ inetd_main(int argc, char *argv[]) openlog(bb_applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON); - opt = bb_getopt_ulflags(argc, argv, "R:f", &stoomany); + opt = getopt32(argc, argv, "R:f", &stoomany); if(opt & 1) { char *e; diff --git a/networking/ipcalc.c b/networking/ipcalc.c index aafb7869b..576dfc853 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -90,9 +90,9 @@ int ipcalc_main(int argc, char **argv) char *ipstr; if (ENABLE_FEATURE_IPCALC_LONG_OPTIONS) - bb_applet_long_options = long_options; + applet_long_options = long_options; - mode = bb_getopt_ulflags(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); + mode = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); argc -= optind; argv += optind; diff --git a/networking/nameif.c b/networking/nameif.c index 3fa257263..146eccea9 100644 --- a/networking/nameif.c +++ b/networking/nameif.c @@ -65,7 +65,7 @@ int nameif_main(int argc, char **argv) int if_index = 1; mactable_t *ch; - if (1 & bb_getopt_ulflags(argc, argv, "sc:", &fname)) { + if (1 & getopt32(argc, argv, "sc:", &fname)) { openlog(bb_applet_name, 0, LOG_LOCAL0); logmode = LOGMODE_SYSLOG; } diff --git a/networking/netstat.c b/networking/netstat.c index cadcb0e31..bc5c61974 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -21,7 +21,7 @@ extern void displayroutes(int noresolve, int netstatfmt); #define NETSTAT_CONNECTED 0x01 #define NETSTAT_LISTENING 0x02 #define NETSTAT_NUMERIC 0x04 -/* Must match getopt_ulflags option string */ +/* Must match getopt32 option string */ #define NETSTAT_TCP 0x10 #define NETSTAT_UDP 0x20 #define NETSTAT_RAW 0x40 @@ -526,7 +526,7 @@ int netstat_main(int argc, char **argv) OPT_extended = 0x4, OPT_showroute = 0x100, }; - unsigned long opt; + unsigned opt; #ifdef CONFIG_FEATURE_IPV6 int inet = 1; int inet6 = 1; @@ -536,7 +536,7 @@ int netstat_main(int argc, char **argv) #endif /* Option string must match NETSTAT_xxx constants */ - opt = bb_getopt_ulflags(argc, argv, "laentuwxr"); + opt = getopt32(argc, argv, "laentuwxr"); if (opt & 0x1) { // -l flags &= ~NETSTAT_CONNECTED; flags |= NETSTAT_LISTENING; diff --git a/networking/route.c b/networking/route.c index 5fd888617..2e6e017b6 100644 --- a/networking/route.c +++ b/networking/route.c @@ -647,7 +647,7 @@ static const char tbl_verb[] = /* 2nd byte matches RTACTION_* code */ int route_main(int argc, char **argv) { - unsigned long opt; + unsigned opt; int what; char *family; @@ -662,7 +662,7 @@ int route_main(int argc, char **argv) } } - opt = bb_getopt_ulflags(argc, argv, "A:ne", &family); + opt = getopt32(argc, argv, "A:ne", &family); if ((opt & ROUTE_OPT_A) && strcmp(family, "inet")) { #ifdef CONFIG_FEATURE_IPV6 diff --git a/networking/telnet.c b/networking/telnet.c index fd0f84d50..cd4c33a86 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -623,7 +623,7 @@ int telnet_main(int argc, char** argv) bb_show_usage(); #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN - if (1 & bb_getopt_ulflags(argc, argv, "al:", &autologin)) + if (1 & getopt32(argc, argv, "al:", &autologin)) autologin = getenv("USER"); if (optind < argc) { diff --git a/networking/telnetd.c b/networking/telnetd.c index 9fa8faf66..808d4be51 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -362,7 +362,7 @@ free_session(struct tsession *ts) int telnetd_main(int argc, char **argv) { - unsigned long opt; + unsigned opt; fd_set rdfdset, wrfdset; int selret; #ifndef CONFIG_FEATURE_TELNETD_INETD @@ -387,7 +387,7 @@ telnetd_main(int argc, char **argv) openlog(bb_applet_name, 0, LOG_USER); logmode = LOGMODE_SYSLOG; - opt = bb_getopt_ulflags(argc, argv, "f:l:" USE_FEATURE_TELNETD_INETD("p:b:"), + opt = getopt32(argc, argv, "f:l:" USE_FEATURE_TELNETD_INETD("p:b:"), &issuefile, &loginpath SKIP_FEATURE_TELNETD_INETD(, &opt_portnbr, &opt_bindaddr)); //if (opt & 1) // -f diff --git a/networking/tftp.c b/networking/tftp.c index 42fd9d2ca..5f0c190e2 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -497,13 +497,13 @@ int tftp_main(int argc, char **argv) #endif #if defined(CONFIG_FEATURE_TFTP_GET) && defined(CONFIG_FEATURE_TFTP_PUT) - bb_opt_complementally = GET_COMPL PUT_COMPL ":?g--p:p--g"; + opt_complementary = GET_COMPL PUT_COMPL ":?g--p:p--g"; #elif defined(CONFIG_FEATURE_TFTP_GET) || defined(CONFIG_FEATURE_TFTP_PUT) - bb_opt_complementally = GET_COMPL PUT_COMPL; + opt_complementary = GET_COMPL PUT_COMPL; #endif - cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS, + cmd = getopt32(argc, argv, GET PUT "l:r:" BS, &localfile, &remotefile BS_ARG); cmd &= (tftp_cmd_get | tftp_cmd_put); diff --git a/networking/traceroute.c b/networking/traceroute.c index e7e131149..042cbe35a 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -949,12 +949,12 @@ traceroute_main(int argc, char *argv[]) opterr = 0; #ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE - bb_opt_complementally = "x-x:g::"; + opt_complementary = "x-x:g::"; #else - bb_opt_complementally = "x-x"; + opt_complementary = "x-x"; #endif - op = bb_getopt_ulflags(argc, argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:" + op = getopt32(argc, argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:" #define USAGE_OP_DONT_FRAGMNT (1<<0) /* F */ #define USAGE_OP_USE_ICMP (1<<1) /* I */ #define USAGE_OP_TTL_FLAG (1<<2) /* l */ diff --git a/networking/wget.c b/networking/wget.c index bbe1bba9a..0054a9876 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -124,7 +124,7 @@ static const struct option wget_long_options[] = { int wget_main(int argc, char **argv) { int n, try=5, status; - unsigned long opt; + unsigned opt; int port; char *proxy = 0; char *dir_prefix=NULL; @@ -148,11 +148,11 @@ int wget_main(int argc, char **argv) /* * Crack command line. */ - bb_opt_complementally = "-1:\203::"; + opt_complementary = "-1:\203::"; #if ENABLE_FEATURE_WGET_LONG_OPTIONS - bb_applet_long_options = wget_long_options; + applet_long_options = wget_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:U:", + opt = getopt32(argc, argv, "cq\213O:\203:P:Y:U:", &fname_out, &headers_llist, &dir_prefix, &proxy_flag, &user_agent); if (strcmp(proxy_flag, "off") == 0) { diff --git a/networking/zcip.c b/networking/zcip.c index c6b0d2d80..d9c1adf19 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -75,7 +75,7 @@ enum { #define VDBG(fmt,args...) \ do { } while (0) -static unsigned long opts; +static unsigned opts; #define FOREGROUND (opts & 1) #define QUIT (opts & 2) @@ -217,8 +217,8 @@ int zcip_main(int argc, char *argv[]) // parse commandline: prog [options] ifname script char *r_opt; - bb_opt_complementally = "vv:vf"; // -v accumulates and implies -f - opts = bb_getopt_ulflags(argc, argv, "fqr:v", &r_opt, &verbose); + opt_complementary = "vv:vf"; // -v accumulates and implies -f + opts = getopt32(argc, argv, "fqr:v", &r_opt, &verbose); if (!FOREGROUND) { /* Do it early, before all bb_xx_msg calls */ logmode = LOGMODE_SYSLOG; -- cgit v1.2.3