Index: networking/iptunnel.c =================================================================== --- networking/iptunnel.c (revision 15566) +++ networking/iptunnel.c (working copy) @@ -16,9 +16,9 @@ #include "busybox.h" -int iptunnel_main(int argc, char **argv) +int iptunnel_main(void) { ip_parse_common_args(&argc, &argv); - - return do_iptunnel(argc-1, argv+1); + argc -= 1; argv += 1; + return do_iptunnel(); } Index: networking/fakeidentd.c =================================================================== --- networking/fakeidentd.c (revision 15566) +++ networking/fakeidentd.c (working copy) @@ -229,7 +229,7 @@ static int checkInput(char *buf, int len return 0; } -int fakeidentd_main(int argc, char **argv) +int fakeidentd_main(void) { memset(conns, 0, sizeof(conns)); memset(&G, 0, sizeof(G)); @@ -237,7 +237,7 @@ int fakeidentd_main(int argc, char **arg FD_SET(0, &G.readfds); /* handle -b parameter */ - bb_getopt_ulflags(argc, argv, "b:", &bind_ip_address); + bb_getopt_ulflags("b:", &bind_ip_address); /* handle optional REPLY STRING */ if (optind < argc) G.identuser = argv[optind]; Index: networking/nameif.c =================================================================== --- networking/nameif.c (revision 15566) +++ networking/nameif.c (working copy) @@ -83,7 +83,7 @@ static struct ether_addr *cc_macaddr(con return mac; } -int nameif_main(int argc, char **argv) +int nameif_main(void) { mactable_t *clist = NULL; FILE *ifh; @@ -93,7 +93,7 @@ int nameif_main(int argc, char **argv) int if_index = 1; mactable_t *ch; - flags = bb_getopt_ulflags(argc, argv, "sc:", &fname); + flags = bb_getopt_ulflags("sc:", &fname); if ((argc - optind) & 1) bb_show_usage(); Index: networking/ipaddr.c =================================================================== --- networking/ipaddr.c (revision 15566) +++ networking/ipaddr.c (working copy) @@ -16,9 +16,9 @@ #include "busybox.h" -int ipaddr_main(int argc, char **argv) +int ipaddr_main(void) { ip_parse_common_args(&argc, &argv); - - return do_ipaddr(argc-1, argv+1); + argc -=1; argv +=1; + return do_ipaddr(); } Index: networking/wget.c =================================================================== --- networking/wget.c (revision 15566) +++ networking/wget.c (working copy) @@ -149,7 +149,7 @@ static const struct option wget_long_opt }; #endif -int wget_main(int argc, char **argv) +int wget_main(void) { int n, try=5, status; unsigned long opt; @@ -183,7 +183,7 @@ int wget_main(int argc, char **argv) #if ENABLE_WGET_LONG_OPTIONS bb_applet_long_options = wget_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", + opt = bb_getopt_ulflags("cq\213O:\203:P:Y:", &fname_out, &headers_llist, &dir_prefix, &proxy_flag); if (opt & WGET_OPT_CONTINUE) { Index: networking/ip.c =================================================================== --- networking/ip.c (revision 15566) +++ networking/ip.c (working copy) @@ -77,7 +77,7 @@ void ip_parse_common_args(int *argcp, ch } #endif -int ip_main(int argc, char **argv) +int ip_main(void) { int ret = EXIT_FAILURE; @@ -86,22 +86,26 @@ int ip_main(int argc, char **argv) if (argc > 1) { #ifdef CONFIG_FEATURE_IP_ADDRESS if (matches(argv[1], "address") == 0) { - ret = do_ipaddr(argc-2, argv+2); + argc -= 2; argv += 2; + ret = do_ipaddr(); } #endif #ifdef CONFIG_FEATURE_IP_ROUTE if (matches(argv[1], "route") == 0) { - ret = do_iproute(argc-2, argv+2); + argc -= 2; argv += 2; + ret = do_iproute(); } #endif #ifdef CONFIG_FEATURE_IP_LINK if (matches(argv[1], "link") == 0) { - ret = do_iplink(argc-2, argv+2); + argc -= 2; argv += 2; + ret = do_iplink(); } #endif #ifdef CONFIG_FEATURE_IP_TUNNEL if (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0) { - ret = do_iptunnel(argc-2, argv+2); + argc -= 2; argv += 2; + ret = do_iptunnel(); } #endif } Index: networking/nslookup.c =================================================================== --- networking/nslookup.c (revision 15566) +++ networking/nslookup.c (working copy) @@ -166,7 +166,7 @@ static int is_ip_address(const char *s) } /* ________________________________________________________________________ */ -int nslookup_main(int argc, char **argv) +int nslookup_main(void) { struct hostent *host; Index: networking/tftp.c =================================================================== --- networking/tftp.c (revision 15566) +++ networking/tftp.c (working copy) @@ -468,7 +468,7 @@ static int tftp(const int cmd, const str return finished ? EXIT_SUCCESS : EXIT_FAILURE; } -int tftp_main(int argc, char **argv) +int tftp_main(void) { struct hostent *host = NULL; const char *localfile = NULL; @@ -515,7 +515,7 @@ int tftp_main(int argc, char **argv) #endif - cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS, + cmd = bb_getopt_ulflags(GET PUT "l:r:" BS, &localfile, &remotefile BS_ARG); cmd &= (tftp_cmd_get | tftp_cmd_put); Index: networking/dnsd.c =================================================================== --- networking/dnsd.c (revision 15566) +++ networking/dnsd.c (working copy) @@ -368,7 +368,7 @@ static void interrupt(int x) #define is_verbose() (flags&32) //#define DEBUG 1 -int dnsd_main(int argc, char **argv) +int dnsd_main(void) { int udps; uint16_t port = 53; @@ -378,7 +378,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 = bb_getopt_ulflags("i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport); if(sttl) if(!(ttl = atol(sttl))) bb_show_usage(); Index: networking/ifupdown.c =================================================================== --- networking/ifupdown.c (revision 15566) +++ networking/ifupdown.c (working copy) @@ -961,17 +961,17 @@ static int iface_down(struct interface_d static int popen2(FILE **in, FILE **out, char *command, ...) { va_list ap; - char *argv[11] = { command }; - int argc; + char *aargv[11] = { command }; + int aargc; int infd[2], outfd[2]; pid_t pid; - argc = 1; + aargc = 1; va_start(ap, command); - while ((argc < 10) && (argv[argc] = va_arg(ap, char *))) { - argc++; + while ((aargc < 10) && (aargv[aargc] = va_arg(ap, char *))) { + aargc++; } - argv[argc] = NULL; /* make sure */ + aargv[aargc] = NULL; /* make sure */ va_end(ap); if (pipe(infd) != 0) { @@ -999,7 +999,7 @@ static int popen2(FILE **in, FILE **out, close(infd[1]); close(outfd[0]); close(outfd[1]); - execvp(command, argv); + execvp(command, aargv); exit(127); default: /* parent */ *in = fdopen(infd[1], "w"); @@ -1078,7 +1078,7 @@ static llist_t *find_iface_state(llist_t return(NULL); } -int ifupdown_main(int argc, char **argv) +int ifupdown_main(void) { int (*cmds) (struct interface_defn_t *) = NULL; struct interfaces_file_t *defn; @@ -1106,7 +1106,7 @@ int ifupdown_main(int argc, char **argv) #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING while ((i = getopt(argc, argv, "i:hvnamf")) != -1) #else - while ((i = getopt(argc, argv, "i:hvnaf")) != -1) + while ((i = getopt(argc, argv, "i:hvnaf")) != -1) #endif { switch (i) { Index: networking/ether-wake.c =================================================================== --- networking/ether-wake.c (revision 15566) +++ networking/ether-wake.c (working copy) @@ -120,7 +120,7 @@ static inline void get_dest_addr(const c static inline int get_fill(unsigned char *pkt, struct ether_addr *eaddr, int broadcast); static inline int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd); -int etherwake_main(int argc, char *argv[]) +int etherwake_main(void) { char *ifname = "eth0", *pass = NULL; unsigned long flags; @@ -135,7 +135,7 @@ int etherwake_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 = bb_getopt_ulflags("bi:p:", &ifname, &pass); if (optind == argc) bb_show_usage(); if (pass) Index: networking/libiproute/iptunnel.c =================================================================== --- networking/libiproute/iptunnel.c (revision 15566) +++ networking/libiproute/iptunnel.c (working copy) @@ -143,7 +143,7 @@ static int do_del_ioctl(char *basedev, s return err; } -static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) +static int parse_args(int cmd, struct ip_tunnel_parm *p) { int count = 0; char medium[IFNAMSIZ]; @@ -332,11 +332,11 @@ static int parse_args(int argc, char **a } -static int do_add(int cmd, int argc, char **argv) +static int do_add(int cmd) { struct ip_tunnel_parm p; - if (parse_args(argc, argv, cmd, &p) < 0) + if (parse_args(cmd, &p) < 0) return -1; if (p.iph.ttl && p.iph.frag_off == 0) { @@ -358,11 +358,11 @@ static int do_add(int cmd, int argc, cha return -1; } -static int do_del(int argc, char **argv) +static int do_del(void) { struct ip_tunnel_parm p; - if (parse_args(argc, argv, SIOCDELTUNNEL, &p) < 0) + if (parse_args(SIOCDELTUNNEL, &p) < 0) return -1; switch (p.iph.protocol) { @@ -494,12 +494,12 @@ static int do_tunnels_list(struct ip_tun return 0; } -static int do_show(int argc, char **argv) +static int do_show(void) { int err; struct ip_tunnel_parm p; - if (parse_args(argc, argv, SIOCGETTUNNEL, &p) < 0) + if (parse_args(SIOCGETTUNNEL, &p) < 0) return -1; switch (p.iph.protocol) { @@ -524,21 +524,29 @@ static int do_show(int argc, char **argv return 0; } -int do_iptunnel(int argc, char **argv) +int do_iptunnel(void) { if (argc > 0) { - if (matches(*argv, "add") == 0) - return do_add(SIOCADDTUNNEL, argc-1, argv+1); - if (matches(*argv, "change") == 0) - return do_add(SIOCCHGTUNNEL, argc-1, argv+1); - if (matches(*argv, "del") == 0) - return do_del(argc-1, argv+1); + if (matches(*argv, "add") == 0) { + argc -= 1; argv += 1; + return do_add(SIOCADDTUNNEL); + } + if (matches(*argv, "change") == 0) { + argc -= 1; argv += 1; + return do_add(SIOCCHGTUNNEL); + } + if (matches(*argv, "del") == 0) { + argc -= 1; argv += 1; + return do_del(); + } if (matches(*argv, "show") == 0 || matches(*argv, "lst") == 0 || - matches(*argv, "list") == 0) - return do_show(argc-1, argv+1); + matches(*argv, "list") == 0) { + argc -= 1; argv += 1; + return do_show(); + } } else - return do_show(0, NULL); + return do_show(); bb_error_msg("Command \"%s\" is unknown.", *argv); exit(-1); Index: networking/libiproute/ipaddress.c =================================================================== --- networking/libiproute/ipaddress.c (revision 15566) +++ networking/libiproute/ipaddress.c (working copy) @@ -411,7 +411,7 @@ static void ipaddr_reset_filter(int _one filter.oneline = _oneline; } -int ipaddr_list_or_flush(int argc, char **argv, int flush) +int ipaddr_list_or_flush(int flush) { static const char *const option[] = { "to", "scope", "up", "label", "dev", 0 }; @@ -621,7 +621,7 @@ static int default_scope(inet_prefix *lc return 0; } -static int ipaddr_modify(int cmd, int argc, char **argv) +static int ipaddr_modify(int cmd) { static const char *const option[] = { "peer", "remote", "broadcast", "brd", @@ -796,7 +796,7 @@ static int ipaddr_modify(int cmd, int ar exit(0); } -int do_ipaddr(int argc, char **argv) +int do_ipaddr(void) { static const char *const commands[] = { "add", "delete", "list", "show", "lst", "flush", 0 @@ -806,18 +806,19 @@ int do_ipaddr(int argc, char **argv) if (*argv) { command_num = compare_string_array(commands, *argv); + argc -= 1; argv += 1; } switch (command_num) { case 0: /* add */ - return ipaddr_modify(RTM_NEWADDR, argc-1, argv+1); + return ipaddr_modify(RTM_NEWADDR); case 1: /* delete */ - return ipaddr_modify(RTM_DELADDR, argc-1, argv+1); + return ipaddr_modify(RTM_DELADDR); case 2: /* list */ case 3: /* show */ case 4: /* lst */ - return ipaddr_list_or_flush(argc-1, argv+1, 0); + return ipaddr_list_or_flush(0); case 5: /* flush */ - return ipaddr_list_or_flush(argc-1, argv+1, 1); + return ipaddr_list_or_flush(1); } - bb_error_msg_and_die("Unknown command %s", *argv); + bb_error_msg_and_die("Unknown command %s", commands[command_num]); } Index: networking/libiproute/ip_common.h =================================================================== --- networking/libiproute/ip_common.h (revision 15566) +++ networking/libiproute/ip_common.h (working copy) @@ -12,17 +12,17 @@ extern char * _SL_; extern void ip_parse_common_args(int *argcp, char ***argvp); extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); -extern int ipaddr_list_or_flush(int argc, char **argv, int flush); -extern int iproute_monitor(int argc, char **argv); +extern int ipaddr_list_or_flush(int flush); +extern int iproute_monitor(void); extern void iplink_usage(void) ATTRIBUTE_NORETURN; extern void ipneigh_reset_filter(void); -extern int do_ipaddr(int argc, char **argv); -extern int do_iproute(int argc, char **argv); -extern int do_iprule(int argc, char **argv); -extern int do_ipneigh(int argc, char **argv); -extern int do_iptunnel(int argc, char **argv); -extern int do_iplink(int argc, char **argv); -extern int do_ipmonitor(int argc, char **argv); -extern int do_multiaddr(int argc, char **argv); -extern int do_multiroute(int argc, char **argv); +extern int do_ipaddr(void); +extern int do_iproute(void); +extern int do_iprule(void); +extern int do_ipneigh(void); +extern int do_iptunnel(void); +extern int do_iplink(void); +extern int do_ipmonitor(void); +extern int do_multiaddr(void); +extern int do_multiroute(void); #endif /* ip_common.h */ Index: networking/libiproute/iplink.c =================================================================== --- networking/libiproute/iplink.c (revision 15566) +++ networking/libiproute/iplink.c (working copy) @@ -222,7 +222,7 @@ static int set_address(struct ifreq *ifr } -static int do_set(int argc, char **argv) +static int do_set(void) { char *dev = NULL; __u32 mask = 0; @@ -330,23 +330,27 @@ static int do_set(int argc, char **argv) return 0; } -static int ipaddr_list_link(int argc, char **argv) +static int ipaddr_list_link(void) { preferred_family = AF_PACKET; - return ipaddr_list_or_flush(argc, argv, 0); + return ipaddr_list_or_flush(0); } -int do_iplink(int argc, char **argv) +int do_iplink(void) { if (argc > 0) { - if (matches(*argv, "set") == 0) - return do_set(argc-1, argv+1); + if (matches(*argv, "set") == 0) { + argc -= 1; argv += 1; + return do_set(); + } if (matches(*argv, "show") == 0 || matches(*argv, "lst") == 0 || - matches(*argv, "list") == 0) - return ipaddr_list_link(argc-1, argv+1); - } else - return ipaddr_list_link(0, NULL); + matches(*argv, "list") == 0) { + argc -= 1; argv += 1; + return ipaddr_list_link(); + } + } else /* argc = 0, *argv = 0, */ + return ipaddr_list_link(); bb_error_msg("Command \"%s\" is unknown.", *argv); exit(-1); Index: networking/libiproute/ip_parse_common_args.c =================================================================== --- networking/libiproute/ip_parse_common_args.c (revision 15566) +++ networking/libiproute/ip_parse_common_args.c (working copy) @@ -27,14 +27,14 @@ char * _SL_ = NULL; void ip_parse_common_args(int *argcp, char ***argvp) { - int argc = *argcp; - char **argv = *argvp; + int aargc = *argcp; + char **aargv = *argvp; - while (argc > 1) { - char *opt = argv[1]; + while (aargc > 1) { + char *opt = aargv[1]; if (strcmp(opt,"--") == 0) { - argc--; argv++; + aargc--; aargv++; break; } @@ -45,18 +45,18 @@ void ip_parse_common_args(int *argcp, ch opt++; if (matches(opt, "-family") == 0) { - argc--; - argv++; - if (! argv[1]) + aargc--; + aargv++; + if (! aargv[1]) bb_show_usage(); - if (strcmp(argv[1], "inet") == 0) + if (strcmp(aargv[1], "inet") == 0) preferred_family = AF_INET; - else if (strcmp(argv[1], "inet6") == 0) + else if (strcmp(aargv[1], "inet6") == 0) preferred_family = AF_INET6; - else if (strcmp(argv[1], "link") == 0) + else if (strcmp(aargv[1], "link") == 0) preferred_family = AF_PACKET; else - invarg(argv[1], "protocol family"); + invarg(aargv[1], "protocol family"); } else if (strcmp(opt, "-4") == 0) { preferred_family = AF_INET; } else if (strcmp(opt, "-6") == 0) { @@ -68,9 +68,9 @@ void ip_parse_common_args(int *argcp, ch } else { bb_show_usage(); } - argc--; argv++; + aargc--; aargv++; } _SL_ = oneline ? "\\" : "\n" ; - *argcp = argc; - *argvp = argv; + *argcp = aargc; + *argvp = aargv; } Index: networking/libiproute/iproute.c =================================================================== --- networking/libiproute/iproute.c (revision 15566) +++ networking/libiproute/iproute.c (working copy) @@ -282,7 +282,7 @@ static int print_route(struct sockaddr_n return 0; } -static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) +static int iproute_modify(int cmd, unsigned flags) { struct rtnl_handle rth; struct { @@ -476,7 +476,7 @@ static void iproute_reset_filter(void) filter.msrc.bitlen = -1; } -static int iproute_list_or_flush(int argc, char **argv, int flush) +static int iproute_list_or_flush(int flush) { int do_ipv6 = preferred_family; struct rtnl_handle rth; @@ -638,7 +638,7 @@ static int iproute_list_or_flush(int arg } -static int iproute_get(int argc, char **argv) +static int iproute_get(void) { struct rtnl_handle rth; struct { @@ -808,7 +808,7 @@ static int iproute_get(int argc, char ** exit(0); } -int do_iproute(int argc, char **argv) +int do_iproute(void) { static const char * const ip_route_commands[] = { "add", "append", "change", "chg", "delete", "del", "get", @@ -836,10 +836,12 @@ int do_iproute(int argc, char **argv) cmd = RTM_DELROUTE; break; case 6: /* get */ - return iproute_get(argc-1, argv+1); + argc -= 1; argv += 1; + return iproute_get(); case 7: /* list */ case 8: /* show */ - return iproute_list_or_flush(argc-1, argv+1, 0); + argc -= 1; argv += 1; + return iproute_list_or_flush(0); case 9: /* prepend */ flags = NLM_F_CREATE; case 10: /* replace */ @@ -847,10 +849,11 @@ int do_iproute(int argc, char **argv) case 11: /* test */ flags = NLM_F_EXCL; case 12: /* flush */ - return iproute_list_or_flush(argc-1, argv+1, 1); + argc -= 1; argv += 1; + return iproute_list_or_flush(1); default: bb_error_msg_and_die("Unknown command %s", *argv); } - - return iproute_modify(cmd, flags, argc-1, argv+1); + argc -= 1; argv += 1; + return iproute_modify(cmd, flags); } Index: networking/route.c =================================================================== --- networking/route.c (revision 15566) +++ networking/route.c (working copy) @@ -663,7 +663,7 @@ static const char tbl_verb[] = /* 2nd by "\010\002delete" /* Since last, we can save a byte. */ ; -int route_main(int argc, char **argv) +int route_main(void) { unsigned long opt; int what; @@ -680,7 +680,7 @@ int route_main(int argc, char **argv) } } - opt = bb_getopt_ulflags(argc, argv, "A:ne", &family); + opt = bb_getopt_ulflags("A:ne", &family); if ((opt & ROUTE_OPT_A) && strcmp(family, "inet")) { #ifdef CONFIG_FEATURE_IPV6 Index: networking/telnetd.c =================================================================== --- networking/telnetd.c (revision 15566) +++ networking/telnetd.c (working copy) @@ -377,7 +377,7 @@ free_session(struct tsession *ts) #endif /* CONFIG_FEATURE_TELNETD_INETD */ int -telnetd_main(int argc, char **argv) +telnetd_main(void) { #ifndef CONFIG_FEATURE_TELNETD_INETD sockaddr_type sa; Index: networking/nc.c =================================================================== --- networking/nc.c (revision 15566) +++ networking/nc.c (working copy) @@ -32,7 +32,7 @@ static void timeout(int signum) bb_error_msg_and_die("Timed out"); } -int nc_main(int argc, char **argv) +int nc_main(void) { int do_listen = 0, lport = 0, delay = 0, wsecs = 0, tmpfd, opt, sfd, x; Index: networking/inetd.c =================================================================== --- networking/inetd.c (revision 15566) +++ networking/inetd.c (working copy) @@ -577,7 +577,7 @@ static servtab_t *new_servtab(void) static servtab_t *dupconfig (servtab_t *sep) { servtab_t *newtab; - int argc; + int aargc; newtab = new_servtab(); memset (newtab, 0, sizeof (servtab_t)); @@ -598,9 +598,9 @@ static servtab_t *dupconfig (servtab_t * #endif newtab->se_server = sep->se_server ? newstr (sep->se_server) : 0; - for (argc = 0; argc <= MAXARGV; argc++) - newtab->se_argv[argc] = sep->se_argv[argc] ? - newstr (sep->se_argv[argc]) : NULL; + for (aargc = 0; aargc <= MAXARGV; aargc++) + newtab->se_argv[aargc] = sep->se_argv[aargc] ? + newstr (sep->se_argv[aargc]) : NULL; newtab->se_max = sep->se_max; return (newtab); @@ -609,7 +609,7 @@ static servtab_t *dupconfig (servtab_t * static servtab_t *getconfigent (void) { servtab_t *sep; - int argc; + int aargc; char *cp, *arg; char *hostdelim; servtab_t *nsep; @@ -764,13 +764,13 @@ more: else sep->se_bi = NULL; #endif - argc = 0; + aargc = 0; for (arg = skip (&cp); cp; arg = skip (&cp)) { - if (argc < MAXARGV) - sep->se_argv[argc++] = newstr (arg); + if (aargc < MAXARGV) + sep->se_argv[aargc++] = newstr (arg); } - while (argc <= MAXARGV) - sep->se_argv[argc++] = NULL; + while (aargc <= MAXARGV) + sep->se_argv[aargc++] = NULL; /* * Now that we've processed the entire line, check if the hostname @@ -1258,7 +1258,7 @@ inetd_setproctitle (char *a, int s) int -inetd_main (int argc, char *argv[]) +inetd_main (void) { servtab_t *sep; struct passwd *pwd; @@ -1285,7 +1285,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 = bb_getopt_ulflags("R:f", &stoomany); if(opt & 1) { char *e; Index: networking/zcip.c =================================================================== --- networking/zcip.c (revision 15566) +++ networking/zcip.c (working copy) @@ -181,7 +181,7 @@ static inline unsigned ms_rdelay(unsigne * main program */ -int zcip_main(int argc, char *argv[]) +int zcip_main(void) { char *intf = NULL; char *script = NULL; Index: networking/traceroute.c =================================================================== --- networking/traceroute.c (revision 15566) +++ networking/traceroute.c (working copy) @@ -918,7 +918,7 @@ getaddr(u_int32_t *ap, const char *host) int -traceroute_main(int argc, char *argv[]) +traceroute_main(void) { int code, n; char *cp; @@ -964,7 +964,7 @@ traceroute_main(int argc, char *argv[]) bb_opt_complementally = "x-x"; #endif - op = bb_getopt_ulflags(argc, argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:" + op = bb_getopt_ulflags("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 */ Index: networking/hostname.c =================================================================== --- networking/hostname.c (revision 15566) +++ networking/hostname.c (working copy) @@ -65,7 +65,7 @@ static void do_sethostname(char *s, int } } -int hostname_main(int argc, char **argv) +int hostname_main(void) { int opt; int type = 0; Index: networking/arping.c =================================================================== --- networking/arping.c (revision 15566) +++ networking/arping.c (working copy) @@ -264,7 +264,7 @@ static int recv_pack(unsigned char *buf, return 1; } -int arping_main(int argc, char **argv) +int arping_main(void) { char *device = "eth0"; int ifindex; @@ -284,7 +284,7 @@ int arping_main(int argc, char **argv) * Advert also sets unsolicited. */ bb_opt_complementally = "Df:AU"; - opt = bb_getopt_ulflags(argc, argv, "DUAqfbc:w:i:s:", + opt = bb_getopt_ulflags("DUAqfbc:w:i:s:", &_count, &_timeout, &_device); cfg |= opt & 63; /* set respective flags */ if (opt & 64) /* count */ Index: networking/ftpgetput.c =================================================================== --- networking/ftpgetput.c (revision 15566) +++ networking/ftpgetput.c (working copy) @@ -283,7 +283,7 @@ static const struct option ftpgetput_lon #define ftpgetput_long_options 0 #endif -int ftpgetput_main(int argc, char **argv) +int ftpgetput_main(void) { /* content-length of the file */ unsigned long opt; @@ -318,7 +318,7 @@ int ftpgetput_main(int argc, char **argv if (ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS) bb_applet_long_options = ftpgetput_long_options; - opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); + opt = bb_getopt_ulflags("cvu:p:P:", &server->user, &server->password, &port); /* Process the non-option command line arguments */ if (argc - optind != 3) { Index: networking/netstat.c =================================================================== --- networking/netstat.c (revision 15566) +++ networking/netstat.c (working copy) @@ -554,7 +554,7 @@ static void do_info(const char *file, co * Our main function. */ -int netstat_main(int argc, char **argv) +int netstat_main(void) { int opt; int new_flags=0; Index: networking/udhcp/frontend.c =================================================================== --- networking/udhcp/frontend.c (revision 15566) +++ networking/udhcp/frontend.c (working copy) @@ -1,7 +1,7 @@ #include -extern int udhcpd_main(int argc, char *argv[]); -extern int udhcpc_main(int argc, char *argv[]); +extern int udhcpd_main(void); +extern int udhcpc_main(void); int main(int argc, char *argv[]) { Index: networking/udhcp/dhcpc.c =================================================================== --- networking/udhcp/dhcpc.c (revision 15566) +++ networking/udhcp/dhcpc.c (working copy) @@ -134,7 +134,7 @@ static void client_background(void) } -int udhcpc_main(int argc, char *argv[]) +int udhcpc_main(void) { uint8_t *temp, *message; unsigned long t1 = 0, t2 = 0, xid = 0; Index: networking/udhcp/dhcpd.c =================================================================== --- networking/udhcp/dhcpd.c (revision 15566) +++ networking/udhcp/dhcpd.c (working copy) @@ -39,7 +39,7 @@ struct dhcpOfferedAddr *leases; struct server_config_t server_config; -int udhcpd_main(int argc, char *argv[]) +int udhcpd_main(void) { fd_set rfds; struct timeval tv; Index: networking/udhcp/dumpleases.c =================================================================== --- networking/udhcp/dumpleases.c (revision 15566) +++ networking/udhcp/dumpleases.c (working copy) @@ -40,7 +40,7 @@ static void ATTRIBUTE_NORETURN show_usag #ifdef IN_BUSYBOX -int dumpleases_main(int argc, char *argv[]) +int dumpleases_main(void) #else int main(int argc, char *argv[]) #endif Index: networking/httpd.c =================================================================== --- networking/httpd.c (revision 15566) +++ networking/httpd.c (working copy) @@ -1928,7 +1928,7 @@ static const char httpd_opts[]="c:d:h:" SKIP_FEATURE_HTTPD_WITHOUT_INETD(0) -int httpd_main(int argc, char *argv[]) +int httpd_main(void) { unsigned long opt; const char *home_httpd = home; @@ -1953,7 +1953,7 @@ int httpd_main(int argc, char *argv[]) config->ContentLength = -1; - opt = bb_getopt_ulflags(argc, argv, httpd_opts, + opt = bb_getopt_ulflags(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)) Index: networking/ping6.c =================================================================== --- networking/ping6.c (revision 15566) +++ networking/ping6.c (working copy) @@ -140,7 +140,7 @@ static void ping(const char *host) return; } -int ping6_main(int argc, char **argv) +int ping6_main(void) { argc--; argv++; @@ -435,7 +435,7 @@ static void ping(const char *host) pingstats(0); } -int ping6_main(int argc, char **argv) +int ping6_main(void) { char *thisarg; Index: networking/ifconfig.c =================================================================== --- networking/ifconfig.c (revision 15566) +++ networking/ifconfig.c (working copy) @@ -274,7 +274,7 @@ extern int display_interfaces(char *ifna * Our main function. */ -int ifconfig_main(int argc, char **argv) +int ifconfig_main(void) { struct ifreq ifr; struct sockaddr_in sai; Index: networking/iplink.c =================================================================== --- networking/iplink.c (revision 15566) +++ networking/iplink.c (working copy) @@ -16,9 +16,9 @@ #include "busybox.h" -int iplink_main(int argc, char **argv) +int iplink_main(void) { ip_parse_common_args(&argc, &argv); - - return do_iplink(argc-1, argv+1); + argc -= 1; argv += 1; + return do_iplink(); } Index: networking/iproute.c =================================================================== --- networking/iproute.c (revision 15566) +++ networking/iproute.c (working copy) @@ -16,9 +16,9 @@ #include "busybox.h" -int iproute_main(int argc, char **argv) +int iproute_main(void) { ip_parse_common_args(&argc, &argv); - - return do_iproute(argc-1, argv+1); + argc -=1; argv +=1; + return do_iproute(); } Index: networking/telnet.c =================================================================== --- networking/telnet.c (revision 15566) +++ networking/telnet.c (working copy) @@ -606,7 +606,7 @@ static void cookmode(void) if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_def); } -int telnet_main(int argc, char** argv) +int telnet_main(void) { int len; struct sockaddr_in s_in; @@ -638,7 +638,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 & bb_getopt_ulflags("al:", &autologin)) autologin = getenv("USER"); if (optind < argc) { Index: networking/ipcalc.c =================================================================== --- networking/ipcalc.c (revision 15566) +++ networking/ipcalc.c (working copy) @@ -81,7 +81,7 @@ int get_prefix(unsigned long netmask); -int ipcalc_main(int argc, char **argv) +int ipcalc_main(void) { unsigned long mode; int have_netmask = 0; @@ -92,7 +92,7 @@ int ipcalc_main(int argc, char **argv) if (ENABLE_FEATURE_IPCALC_LONG_OPTIONS) bb_applet_long_options = long_options; - mode = bb_getopt_ulflags(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); + mode = bb_getopt_ulflags("mbn" USE_FEATURE_IPCALC_FANCY("phs")); argc -= optind; argv += optind; Index: networking/vconfig.c =================================================================== --- networking/vconfig.c (revision 15566) +++ networking/vconfig.c (working copy) @@ -112,7 +112,7 @@ static const char name_types[] = { static const char conf_file_name[] = "/proc/net/vlan/config"; -int vconfig_main(int argc, char **argv) +int vconfig_main(void) { struct vlan_ioctl_args ifr; const char *p; Index: networking/ping.c =================================================================== --- networking/ping.c (revision 15566) +++ networking/ping.c (working copy) @@ -142,7 +142,7 @@ static void ping(const char *host) return; } -int ping_main(int argc, char **argv) +int ping_main(void) { argc--; argv++; @@ -381,7 +381,7 @@ static void ping(const char *host) pingstats(0); } -int ping_main(int argc, char **argv) +int ping_main(void) { char *thisarg; Index: archival/rpm.c =================================================================== --- archival/rpm.c (revision 15576) +++ archival/rpm.c (working copy) @@ -90,7 +90,7 @@ static void fileaction_dobackup(char *fi static void fileaction_setowngrp(char *filename, int fileref); static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref)); -int rpm_main(int argc, char **argv) +int rpm_main(void) { int opt = 0, func = 0, rpm_fd, offset; Index: archival/uncompress.c =================================================================== --- archival/uncompress.c (revision 15566) +++ archival/uncompress.c (working copy) @@ -18,12 +18,12 @@ #define GUNZIP_TO_STDOUT 1 #define GUNZIP_FORCE 2 -int uncompress_main(int argc, char **argv) +int uncompress_main(void) { int status = EXIT_SUCCESS; unsigned long flags; - flags = bb_getopt_ulflags(argc, argv, "cf"); + flags = bb_getopt_ulflags("cf"); while (optind < argc) { const char *compressed_file = argv[optind++]; Index: archival/dpkg_deb.c =================================================================== --- archival/dpkg_deb.c (revision 15566) +++ archival/dpkg_deb.c (working copy) @@ -18,7 +18,7 @@ #define DPKG_DEB_OPT_EXTRACT 8 #define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 -int dpkg_deb_main(int argc, char **argv) +int dpkg_deb_main(void) { archive_handle_t *ar_archive; archive_handle_t *tar_archive; @@ -46,7 +46,7 @@ int dpkg_deb_main(int argc, char **argv) #endif bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; - opt = bb_getopt_ulflags(argc, argv, "cefXx"); + opt = bb_getopt_ulflags("cefXx"); if (opt & DPKG_DEB_OPT_CONTENTS) { tar_archive->action_header = header_verbose_list; Index: archival/ar.c =================================================================== --- archival/ar.c (revision 15566) +++ archival/ar.c (working copy) @@ -57,7 +57,7 @@ static void header_verbose_list_ar(const #define AR_OPT_CREATE 0x20 #define AR_OPT_INSERT 0x40 -int ar_main(int argc, char **argv) +int ar_main(void) { archive_handle_t *archive_handle; unsigned long opt; @@ -69,7 +69,7 @@ int ar_main(int argc, char **argv) /* Prepend '-' to the first argument if required */ bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt"; - opt = bb_getopt_ulflags(argc, argv, "ptxovcr"); + opt = bb_getopt_ulflags("ptxovcr"); if (opt & AR_CTX_PRINT) { archive_handle->action_data = data_extract_to_stdout; Index: archival/unzip.c =================================================================== --- archival/unzip.c (revision 15566) +++ archival/unzip.c (working copy) @@ -128,7 +128,7 @@ static int unzip_extract(zip_header_t *z return 0; } -int unzip_main(int argc, char **argv) +int unzip_main(void) { zip_header_t zip_header; enum {v_silent, v_normal, v_list} verbosity = v_normal; Index: archival/unlzma.c =================================================================== --- archival/unlzma.c (revision 15566) +++ archival/unlzma.c (working copy) @@ -18,13 +18,13 @@ #define UNLZMA_OPT_STDOUT 1 -int unlzma_main(int argc, char **argv) +int unlzma_main(void) { char *filename; unsigned long opt; int status, src_fd, dst_fd; - opt = bb_getopt_ulflags(argc, argv, "c"); + opt = bb_getopt_ulflags("c"); /* Set input filename and number */ filename = argv[optind]; Index: archival/gzip.c =================================================================== --- archival/gzip.c (revision 15566) +++ archival/gzip.c (working copy) @@ -1129,7 +1129,7 @@ static ulg deflate(void) typedef struct dirent dir_type; /* ======================================================================== */ -int gzip_main(int argc, char **argv) +int gzip_main(void) { int result; int inFileNum; @@ -1164,7 +1164,7 @@ int gzip_main(int argc, char **argv) #ifdef CONFIG_GUNZIP case 'd': optind = 1; - return gunzip_main(argc, argv); + return gunzip_main(); #endif default: bb_show_usage(); Index: archival/gunzip.c =================================================================== --- archival/gunzip.c (revision 15566) +++ archival/gunzip.c (working copy) @@ -75,12 +75,12 @@ static char *license_msg[] = { #define GUNZIP_OPT_TEST 4 #define GUNZIP_OPT_DECOMPRESS 8 -int gunzip_main(int argc, char **argv) +int gunzip_main(void) { char status = EXIT_SUCCESS; unsigned long opt; - opt = bb_getopt_ulflags(argc, argv, "cftd"); + opt = bb_getopt_ulflags("cftd"); /* if called as zcat */ if (strcmp(bb_applet_name, "zcat") == 0) { opt |= GUNZIP_OPT_STDOUT; Index: archival/dpkg.c =================================================================== --- archival/dpkg.c (revision 15566) +++ archival/dpkg.c (working copy) @@ -1531,7 +1531,7 @@ static void configure_package(deb_file_t set_status(status_num, "installed", 3); } -int dpkg_main(int argc, char **argv) +int dpkg_main(void) { deb_file_t **deb_file = NULL; status_node_t *status_node; Index: archival/tar.c =================================================================== --- archival/tar.c (revision 15566) +++ archival/tar.c (working copy) @@ -699,7 +699,7 @@ static const struct option tar_long_opti #define tar_long_options 0 #endif -int tar_main(int argc, char **argv) +int tar_main(void) { char (*get_header_ptr)(archive_handle_t *) = get_header_tar; archive_handle_t *tar_handle; @@ -718,7 +718,7 @@ int tar_main(int argc, char **argv) "--:X::T::\n::t:x:?:t--x:x--t"; if (ENABLE_FEATURE_TAR_LONG_OPTIONS) bb_applet_long_options = tar_long_options; - opt = bb_getopt_ulflags(argc, argv, tar_options, + opt = bb_getopt_ulflags(tar_options, &base_dir, /* Change to dir */ &tar_filename /* archive filename */ #ifdef CONFIG_FEATURE_TAR_FROM Index: archival/bunzip2.c =================================================================== --- archival/bunzip2.c (revision 15566) +++ archival/bunzip2.c (working copy) @@ -17,13 +17,13 @@ #define BUNZIP2_OPT_STDOUT 1 #define BUNZIP2_OPT_FORCE 2 -int bunzip2_main(int argc, char **argv) +int bunzip2_main(void) { char *filename; unsigned long opt; int status, src_fd, dst_fd; - opt = bb_getopt_ulflags(argc, argv, "cf"); + opt = bb_getopt_ulflags("cf"); /* Set input filename and number */ filename = argv[optind]; Index: archival/cpio.c =================================================================== --- archival/cpio.c (revision 15566) +++ archival/cpio.c (working copy) @@ -38,7 +38,7 @@ #define CPIO_OPT_CREATE_LEADING_DIR 0x20 #define CPIO_OPT_PRESERVE_MTIME 0x40 -int cpio_main(int argc, char **argv) +int cpio_main(void) { archive_handle_t *archive_handle; char *cpio_filename = NULL; @@ -50,7 +50,7 @@ int cpio_main(int argc, char **argv) archive_handle->seek = seek_by_char; archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE; - opt = bb_getopt_ulflags(argc, argv, "ituvF:dm", &cpio_filename); + opt = bb_getopt_ulflags("ituvF:dm", &cpio_filename); /* One of either extract or test options must be given */ if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) { Index: archival/rpm2cpio.c =================================================================== --- archival/rpm2cpio.c (revision 15566) +++ archival/rpm2cpio.c (working copy) @@ -66,7 +66,7 @@ static void skip_header(int rpm_fd) } /* No getopt required */ -int rpm2cpio_main(int argc, char **argv) +int rpm2cpio_main(void) { struct rpm_lead lead; int rpm_fd; Index: sysklogd/logger.c =================================================================== --- sysklogd/logger.c (revision 15566) +++ sysklogd/logger.c (working copy) @@ -87,7 +87,7 @@ static int pencode(char *s) } -int logger_main(int argc, char **argv) +int logger_main(void) { int pri = LOG_USER | LOG_NOTICE; int option = 0; Index: sysklogd/klogd.c =================================================================== --- sysklogd/klogd.c (revision 15566) +++ sysklogd/klogd.c (working copy) @@ -42,7 +42,7 @@ static void klogd_signal(int sig ATTRIBU #define KLOGD_LOGBUF_SIZE 4096 -int klogd_main(int argc, char **argv) +int klogd_main(void) { RESERVE_CONFIG_BUFFER(log_buffer, KLOGD_LOGBUF_SIZE); int console_log_level = -1; @@ -55,7 +55,7 @@ int klogd_main(int argc, char **argv) unsigned long opt; /* do normal option parsing */ - opt = bb_getopt_ulflags(argc, argv, "c:n", &start); + opt = bb_getopt_ulflags("c:n", &start); if (opt & OPT_LEVEL) { /* Valid levels are between 1 and 8 */ Index: sysklogd/syslogd.c =================================================================== --- sysklogd/syslogd.c (revision 15566) +++ sysklogd/syslogd.c (working copy) @@ -568,7 +568,7 @@ static void doSyslogd(void) } /* for main loop */ } -int syslogd_main(int argc, char **argv) +int syslogd_main(void) { int opt; Index: sysklogd/logread.c =================================================================== --- sysklogd/logread.c (revision 15566) +++ sysklogd/logread.c (working copy) @@ -61,7 +61,7 @@ static inline void sem_down(int semid) error_exit("semop[SMrdn]"); } -int logread_main(int argc, char **argv) +int logread_main(void) { int i; int follow=0; Index: modutils/lsmod.c =================================================================== --- modutils/lsmod.c (revision 15566) +++ modutils/lsmod.c (working copy) @@ -86,7 +86,7 @@ enum { NEW_MOD_INITIALIZING = 64 }; -int lsmod_main(int argc, char **argv) +int lsmod_main(void) { struct module_info info; char *module_names, *mn, *deps, *dn; @@ -149,7 +149,7 @@ int lsmod_main(int argc, char **argv) #else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ -int lsmod_main(int argc, char **argv) +int lsmod_main(void) { printf("Module Size Used by"); check_tainted(); Index: modutils/rmmod.c =================================================================== --- modutils/rmmod.c (revision 15566) +++ modutils/rmmod.c (working copy) @@ -42,7 +42,7 @@ static inline void filename2modname(char } #endif -int rmmod_main(int argc, char **argv) +int rmmod_main(void) { int n, ret = EXIT_SUCCESS; unsigned int flags = O_NONBLOCK|O_EXCL; @@ -53,7 +53,7 @@ int rmmod_main(int argc, char **argv) #endif /* Parse command line. */ - n = bb_getopt_ulflags(argc, argv, "wfa"); + n = bb_getopt_ulflags("wfa"); if((n & 1)) // --wait flags &= ~O_NONBLOCK; if((n & 2)) // --force Index: modutils/modprobe.c =================================================================== --- modutils/modprobe.c (revision 15566) +++ modutils/modprobe.c (working copy) @@ -615,17 +615,17 @@ done: static int mod_process ( struct mod_list_t *list, int do_insert ) { int rc = 0; - char **argv = NULL; + char **aargv = NULL; struct mod_opt_t *opts; - int argc_malloc; /* never used when CONFIG_FEATURE_CLEAN_UP not defined */ - int argc; + int aargc_malloc; /* never used when CONFIG_FEATURE_CLEAN_UP not defined */ + int aargc; while ( list ) { - argc = 0; + aargc = 0; if( ENABLE_FEATURE_CLEAN_UP ) - argc_malloc = 0; + aargc_malloc = 0; /* If CONFIG_FEATURE_CLEAN_UP is not defined, then we leak memory - * each time we allocate memory for argv. + * each time we allocate memory for aargv. * But it is (quite) small amounts of memory that leak each * time a module is loaded, and it is reclaimed when modprobe * exits anyway (even when standalone shell?). @@ -635,52 +635,52 @@ static int mod_process ( struct mod_list * would not load because there is no more memory, so there's no * problem. */ /* enough for minimal insmod (5 args + NULL) or rmmod (3 args + NULL) */ - argv = (char**) malloc( 6 * sizeof( char* ) ); + aargv = (char**) malloc( 6 * sizeof( char* ) ); if ( do_insert ) { if (already_loaded (list->m_name) != 1) { - argv[argc++] = "insmod"; + aargv[aargc++] = "insmod"; if (ENABLE_FEATURE_2_4_MODULES) { if (do_syslog) - argv[argc++] = "-s"; + aargv[aargc++] = "-s"; if (autoclean) - argv[argc++] = "-k"; + aargv[aargc++] = "-k"; if (quiet) - argv[argc++] = "-q"; + aargv[aargc++] = "-q"; else if(verbose) /* verbose and quiet are mutually exclusive */ - argv[argc++] = "-v"; + aargv[aargc++] = "-v"; } - argv[argc++] = list-> m_path; + aargv[aargc++] = list-> m_path; if( ENABLE_FEATURE_CLEAN_UP ) - argc_malloc = argc; + aargc_malloc = aargc; opts = list-> m_options; while( opts ) { /* Add one more option */ - argc++; - argv = (char**) xrealloc( argv, ( argc + 1 ) * sizeof( char* ) ); - argv[argc-1] = opts-> m_opt_val; + aargc++; + aargv = (char**) xrealloc( aargv, (aargc + 1) * sizeof( char* ) ); + aargv[aargc-1] = opts-> m_opt_val; opts = opts-> m_next; } } } else { /* modutils uses short name for removal */ if (already_loaded (list->m_name) != 0) { - argv[argc++] = "rmmod"; + aargv[aargc++] = "rmmod"; if (do_syslog) - argv[argc++] = "-s"; - argv[argc++] = list->m_name; + aargv[aargc++] = "-s"; + aargv[aargc++] = list->m_name; if( ENABLE_FEATURE_CLEAN_UP ) - argc_malloc = argc; + aargc_malloc = aargc; } } - argv[argc] = NULL; + aargv[aargc] = NULL; - if (argc) { + if (aargc) { if (verbose) { printf("%s module %s\n", do_insert?"Loading":"Unloading", list-> m_name ); } if (!show_only) { - int rc2 = wait4pid(bb_spawn(argv)); - + int rc2 = wait4pid(bb_spawn(aargv)); + if (do_insert) { rc = rc2; /* only last module matters */ } @@ -689,15 +689,15 @@ static int mod_process ( struct mod_list } } if( ENABLE_FEATURE_CLEAN_UP ) - /* the last value in the array has index == argc, but + /* the last value in the array has index == aargc, but * it is the terminating NULL, so we must not free it. */ - while( argc_malloc < argc ) { - free( argv[argc_malloc++] ); + while( aargc_malloc < aargc ) { + free( aargv[aargc_malloc++] ); } } if( ENABLE_FEATURE_CLEAN_UP ) { - free( argv ); - argv = NULL; + free( aargv ); + aargv = NULL; } list = do_insert ? list-> m_prev : list-> m_next; } @@ -811,7 +811,7 @@ static void check_dep ( char *mod, struc } } -static int mod_insert ( char *mod, int argc, char **argv ) +static int mod_insert ( char *mod, int aargc, char **aargv ) { struct mod_list_t *tail = 0; struct mod_list_t *head = 0; @@ -821,11 +821,11 @@ static int mod_insert ( char *mod, int a check_dep ( mod, &head, &tail ); if ( head && tail ) { - if( argc ) { + if( aargc ) { int i; // append module args - for ( i = 0; i < argc; i++ ) - head->m_options = append_option( head->m_options, argv[i] ); + for ( i = 0; i < aargc; i++ ) + head->m_options = append_option( head->m_options, aargv[i] ); } // process tail ---> head @@ -858,13 +858,13 @@ static int mod_remove ( char *mod ) } -int modprobe_main(int argc, char** argv) +int modprobe_main(void) { int rc = EXIT_SUCCESS; char *unused; bb_opt_complementally = "?V-:q-v:v-q"; - main_opts = bb_getopt_ulflags(argc, argv, "acdklnqrst:vVC:", + main_opts = bb_getopt_ulflags("acdklnqrst:vVC:", &unused, &unused); if((main_opts & (DUMP_CONF_EXIT | LIST_ALL))) return EXIT_SUCCESS; Index: modutils/insmod.c =================================================================== --- modutils/insmod.c (revision 15566) +++ modutils/insmod.c (working copy) @@ -82,7 +82,7 @@ #endif #if defined(CONFIG_FEATURE_2_6_MODULES) -extern int insmod_ng_main( int argc, char **argv); +extern int insmod_ng_main( void); #endif @@ -2420,7 +2420,7 @@ static char *get_modinfo_value(struct ob /* Functions relating to module loading after 2.1.18. */ static int -new_process_module_arguments(struct obj_file *f, int argc, char **argv) +new_process_module_arguments(struct obj_file *f) { while (argc > 0) { char *p, *q, *key, *sym_name; @@ -3966,7 +3966,7 @@ static void print_load_map(struct obj_fi #endif -int insmod_main( int argc, char **argv) +int insmod_main( void) { int opt; int len; @@ -4146,7 +4146,9 @@ int insmod_main( int argc, char **argv) { optind--; argv[optind + 1] = m_filename; - return insmod_ng_main(argc - optind, argv + optind); + argc -= optind; + argv += optind; + return insmod_ng_main(); } #endif @@ -4228,7 +4230,9 @@ int insmod_main( int argc, char **argv) ++optind; if (optind < argc) { - if (!new_process_module_arguments(f, argc - optind, argv + optind)) + argc -= optind; + argv += optind; + if (!new_process_module_arguments(f)) { goto out; } @@ -4330,7 +4334,7 @@ static const char *moderror(int err) } } -int insmod_ng_main( int argc, char **argv) +int insmod_ng_main( void) { int i; int fd; Index: console-tools/dumpkmap.c =================================================================== --- console-tools/dumpkmap.c (revision 15566) +++ console-tools/dumpkmap.c (working copy) @@ -41,7 +41,7 @@ struct kbentry { #define NR_KEYS 128 #define MAX_NR_KEYMAPS 256 -int dumpkmap_main(int argc, char **argv) +int dumpkmap_main(void) { struct kbentry ke; int i, j, fd; Index: console-tools/setconsole.c =================================================================== --- console-tools/setconsole.c (revision 15566) +++ console-tools/setconsole.c (working copy) @@ -25,7 +25,7 @@ static const struct option setconsole_lo #define OPT_SETCONS_RESET 1 -int setconsole_main(int argc, char **argv) +int setconsole_main(void) { unsigned long flags; const char *device = CURRENT_TTY; @@ -33,7 +33,7 @@ int setconsole_main(int argc, char **arg #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS bb_applet_long_options = setconsole_long_options; #endif - flags = bb_getopt_ulflags(argc, argv, "r"); + flags = bb_getopt_ulflags("r"); if (argc - optind > 1) bb_show_usage(); Index: console-tools/setlogcons.c =================================================================== --- console-tools/setlogcons.c (revision 15566) +++ console-tools/setlogcons.c (working copy) @@ -14,7 +14,7 @@ #include #include "busybox.h" -extern int setlogcons_main(int argc, char **argv) +extern int setlogcons_main(void) { struct { char fn; Index: console-tools/reset.c =================================================================== --- console-tools/reset.c (revision 15566) +++ console-tools/reset.c (working copy) @@ -28,7 +28,7 @@ #include #include "busybox.h" -int reset_main(int argc, char **argv) +int reset_main(void) { if (isatty(1)) { /* See 'man 4 console_codes' for details: Index: console-tools/setkeycodes.c =================================================================== --- console-tools/setkeycodes.c (revision 15566) +++ console-tools/setkeycodes.c (working copy) @@ -38,7 +38,7 @@ enum { }; extern int -setkeycodes_main(int argc, char** argv) +setkeycodes_main(void) { char *ep; int fd, sc; Index: console-tools/chvt.c =================================================================== --- console-tools/chvt.c (revision 15566) +++ console-tools/chvt.c (working copy) @@ -20,7 +20,7 @@ enum { VT_WAITACTIVE = 0x5607 /* wait for vt active */ }; -int chvt_main(int argc, char **argv) +int chvt_main(void) { int fd, num; Index: console-tools/clear.c =================================================================== --- console-tools/clear.c (revision 15566) +++ console-tools/clear.c (working copy) @@ -27,7 +27,7 @@ #include "busybox.h" -int clear_main(int argc, char **argv) +int clear_main(void) { return printf("\033[H\033[J") != 6; } Index: console-tools/loadfont.c =================================================================== --- console-tools/loadfont.c (revision 15566) +++ console-tools/loadfont.c (working copy) @@ -40,7 +40,7 @@ struct psf_header { static void loadnewfont(int fd); -int loadfont_main(int argc, char **argv) +int loadfont_main(void) { int fd; Index: console-tools/loadkmap.c =================================================================== --- console-tools/loadkmap.c (revision 15566) +++ console-tools/loadkmap.c (working copy) @@ -44,7 +44,7 @@ struct kbentry { #define NR_KEYS 128 #define MAX_NR_KEYMAPS 256 -int loadkmap_main(int argc, char **argv) +int loadkmap_main(void) { struct kbentry ke; int i, j, fd; Index: console-tools/openvt.c =================================================================== --- console-tools/openvt.c (revision 15566) +++ console-tools/openvt.c (working copy) @@ -20,7 +20,7 @@ #include "busybox.h" -int openvt_main(int argc, char **argv) +int openvt_main(void) { int fd; char vtname[sizeof(VC_FORMAT) + 2]; Index: console-tools/deallocvt.c =================================================================== --- console-tools/deallocvt.c (revision 15566) +++ console-tools/deallocvt.c (working copy) @@ -32,7 +32,7 @@ /* From */ enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */ -int deallocvt_main(int argc, char *argv[]) +int deallocvt_main(void) { /* num = 0 deallocate all unused consoles */ int num = 0; Index: Rules.mak =================================================================== --- Rules.mak (revision 15566) +++ Rules.mak (working copy) @@ -176,7 +176,7 @@ CHECKED_CFLAGS+=$(call check_cc,$(CC),-W CHECKED_CFLAGS+=$(call check_cc,$(CC),-funsigned-char,) CHECKED_CFLAGS+=$(call check_cc,$(CC),-mmax-stack-frame=256,) CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen) -CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winline) +#CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winline) # Preemptively pin this too. PROG_CFLAGS:= Index: debianutils/pipe_progress.c =================================================================== --- debianutils/pipe_progress.c (revision 15566) +++ debianutils/pipe_progress.c (working copy) @@ -18,7 +18,7 @@ /* Read a block of data from stdin, write it to stdout. * Activity is indicated by a '.' to stderr */ -int pipe_progress_main(int argc, char **argv) +int pipe_progress_main(void) { RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE); time_t t = time(NULL); Index: debianutils/which.c =================================================================== --- debianutils/which.c (revision 15566) +++ debianutils/which.c (working copy) @@ -22,7 +22,7 @@ static int is_executable_file(const char return (!access(a,X_OK) && !stat(a, b) && S_ISREG(b->st_mode)); } -int which_main(int argc, char **argv) +int which_main(void) { int status; size_t i, count; Index: debianutils/start_stop_daemon.c =================================================================== --- debianutils/start_stop_daemon.c (revision 15566) +++ debianutils/start_stop_daemon.c (working copy) @@ -231,7 +231,7 @@ static const struct option ssd_long_opti #endif -int start_stop_daemon_main(int argc, char **argv) +int start_stop_daemon_main(void) { unsigned long opt; char *signame = NULL; @@ -246,7 +246,7 @@ int start_stop_daemon_main(int argc, cha /* Check required one context option was given */ bb_opt_complementally = "K:S:?:K--S:S--K:m?p:K?xpun:S?xa"; - opt = bb_getopt_ulflags(argc, argv, "KSbqm" + opt = bb_getopt_ulflags("KSbqm" // USE_FEATURE_START_STOP_DAEMON_FANCY("ovR:") USE_FEATURE_START_STOP_DAEMON_FANCY("ov") "a:n:s:u:x:p:" Index: debianutils/readlink.c =================================================================== --- debianutils/readlink.c (revision 15566) +++ debianutils/readlink.c (working copy) @@ -15,11 +15,11 @@ #define READLINK_FLAG_f (1 << 0) -int readlink_main(int argc, char **argv) +int readlink_main(void) { char *buf; unsigned long opt = ENABLE_FEATURE_READLINK_FOLLOW ? - bb_getopt_ulflags(argc, argv, "f") : 0; + bb_getopt_ulflags("f") : 0; if (argc != (ENABLE_FEATURE_READLINK_FOLLOW ? optind + 1 : 2)) bb_show_usage(); Index: debianutils/mktemp.c =================================================================== --- debianutils/mktemp.c (revision 15566) +++ debianutils/mktemp.c (working copy) @@ -16,9 +16,9 @@ #include #include -int mktemp_main(int argc, char **argv) +int mktemp_main(void) { - unsigned long flags = bb_getopt_ulflags(argc, argv, "dq"); + unsigned long flags = bb_getopt_ulflags("dq"); if (optind + 1 != argc) bb_show_usage(); Index: debianutils/run_parts.c =================================================================== --- debianutils/run_parts.c (revision 15566) +++ debianutils/run_parts.c (working copy) @@ -51,7 +51,7 @@ extern char **environ; /* run_parts_main */ /* Process options */ -int run_parts_main(int argc, char **argv) +int run_parts_main(void) { char **args = xmalloc(2 * sizeof(char *)); unsigned char test_mode = 0; Index: shell/hush.c =================================================================== --- shell/hush.c (revision 15566) +++ shell/hush.c (working copy) @@ -2719,7 +2719,7 @@ static void setup_job_control(void) tcsetpgrp(shell_terminal, shell_pgrp); } -int hush_main(int argc, char **argv) +int hush_main(void) { int opt; FILE *input; Index: shell/lash.c =================================================================== --- shell/lash.c (revision 15566) +++ shell/lash.c (working copy) @@ -170,8 +170,6 @@ static int shell_context; /* Type promp static const char *cwd; static char *local_pending_command; static struct jobset job_list = { NULL, NULL }; -static int argc; -static char **argv; static llist_t *close_me_list; static int last_return_code; static int last_bg_pid; @@ -1540,12 +1538,10 @@ static inline void setup_job_control(voi } #endif -int lash_main(int argc_l, char **argv_l) +int lash_main(void) { unsigned long opt; FILE *input = stdin; - argc = argc_l; - argv = argv_l; /* These variables need re-initializing when recursing */ last_jobid = 0; @@ -1566,7 +1562,7 @@ int lash_main(int argc_l, char **argv_l) } } - opt = bb_getopt_ulflags(argc_l, argv_l, "+ic:", &local_pending_command); + opt = bb_getopt_ulflags("+ic:", &local_pending_command); #define LASH_OPT_i (1) #define LASH_OPT_c (2) if (opt & LASH_OPT_c) { Index: shell/msh.c =================================================================== --- shell/msh.c (revision 15566) +++ shell/msh.c (working copy) @@ -223,7 +223,7 @@ static int newfile(char *s); static char *findeq(char *cp); static char *cclass(char *p, int sub); static void initarea(void); -extern int msh_main(int argc, char **argv); +extern int msh_main(void); struct brkcon { @@ -830,7 +830,7 @@ static char *current_prompt; */ -int msh_main(int argc, char **argv) +int msh_main(void) { REGISTER int f; REGISTER char *s; Index: shell/ash.c =================================================================== --- shell/ash.c (revision 15566) +++ shell/ash.c (working copy) @@ -7859,7 +7859,7 @@ static void read_profile(const char *); */ int -ash_main(int argc, char **argv) +ash_main(void) { char *shinit; volatile int state; Index: coreutils/printf.c =================================================================== --- coreutils/printf.c (revision 15566) +++ coreutils/printf.c (working copy) @@ -49,10 +49,6 @@ #include #include "busybox.h" -static int print_formatted (char *format, int argc, char **argv); -static void print_direc (char *start, size_t length, - int field_width, int precision, char *argument); - typedef int (*converter)(char *arg, void *result); static void multiconvert(char *arg, void *result, converter convert) { @@ -99,39 +95,94 @@ static void print_esc_string(char *str) } } -int printf_main(int argc, char **argv) +static void print_direc(char *start, size_t length, int field_width, + int precision, char *argument) { - char *format; - int args_used; + char *p; /* Null-terminated copy of % directive. */ - if (argc <= 1 || **(argv + 1) == '-') { - bb_show_usage(); - } + p = xmalloc((unsigned) (length + 1)); + strncpy(p, start, length); + p[length] = 0; - format = argv[1]; - argc -= 2; - argv += 2; + switch (p[length - 1]) { + case 'd': + case 'i': + if (field_width < 0) { + if (precision < 0) + printf(p, xstrtol(argument)); + else + printf(p, precision, xstrtol(argument)); + } else { + if (precision < 0) + printf(p, field_width, xstrtol(argument)); + else + printf(p, field_width, precision, xstrtol(argument)); + } + break; - do { - args_used = print_formatted(format, argc, argv); - argc -= args_used; - argv += args_used; - } - while (args_used > 0 && argc > 0); + case 'o': + case 'u': + case 'x': + case 'X': + if (field_width < 0) { + if (precision < 0) + printf(p, xstrtoul(argument)); + else + printf(p, precision, xstrtoul(argument)); + } else { + if (precision < 0) + printf(p, field_width, xstrtoul(argument)); + else + printf(p, field_width, precision, xstrtoul(argument)); + } + break; -/* - if (argc > 0) - fprintf(stderr, "excess args ignored"); -*/ + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + if (field_width < 0) { + if (precision < 0) + printf(p, xstrtod(argument)); + else + printf(p, precision, xstrtod(argument)); + } else { + if (precision < 0) + printf(p, field_width, xstrtod(argument)); + else + printf(p, field_width, precision, xstrtod(argument)); + } + break; - return EXIT_SUCCESS; + case 'c': + printf(p, *argument); + break; + + case 's': + if (field_width < 0) { + if (precision < 0) + printf(p, argument); + else + printf(p, precision, argument); + } else { + if (precision < 0) + printf(p, field_width, argument); + else + printf(p, field_width, precision, argument); + } + break; + } + + free(p); } + /* Print the text in FORMAT, using ARGV (with ARGC elements) for arguments to any `%' directives. Return the number of elements of ARGV used. */ -static int print_formatted(char *format, int argc, char **argv) +static int print_formatted(char *format) { int save_argc = argc; /* Preserve original value. */ char *f; /* Pointer into `format'. */ @@ -228,85 +279,33 @@ static int print_formatted(char *format, return save_argc - argc; } -static void -print_direc(char *start, size_t length, int field_width, int precision, - char *argument) + +int printf_main(void) { - char *p; /* Null-terminated copy of % directive. */ + char *format; + int args_used; - p = xmalloc((unsigned) (length + 1)); - strncpy(p, start, length); - p[length] = 0; + if (argc <= 1 || **(argv + 1) == '-') { + bb_show_usage(); + } - switch (p[length - 1]) { - case 'd': - case 'i': - if (field_width < 0) { - if (precision < 0) - printf(p, xstrtol(argument)); - else - printf(p, precision, xstrtol(argument)); - } else { - if (precision < 0) - printf(p, field_width, xstrtol(argument)); - else - printf(p, field_width, precision, xstrtol(argument)); - } - break; + format = argv[1]; + argc -= 2; + argv += 2; - case 'o': - case 'u': - case 'x': - case 'X': - if (field_width < 0) { - if (precision < 0) - printf(p, xstrtoul(argument)); - else - printf(p, precision, xstrtoul(argument)); - } else { - if (precision < 0) - printf(p, field_width, xstrtoul(argument)); - else - printf(p, field_width, precision, xstrtoul(argument)); - } - break; + do { + args_used = print_formatted(format); + argc -= args_used; + argv += args_used; + } + while (args_used > 0 && argc > 0); - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - if (field_width < 0) { - if (precision < 0) - printf(p, xstrtod(argument)); - else - printf(p, precision, xstrtod(argument)); - } else { - if (precision < 0) - printf(p, field_width, xstrtod(argument)); - else - printf(p, field_width, precision, xstrtod(argument)); - } - break; +/* + if (argc > 0) + fprintf(stderr, "excess args ignored"); +*/ - case 'c': - printf(p, *argument); - break; + return EXIT_SUCCESS; +} - case 's': - if (field_width < 0) { - if (precision < 0) - printf(p, argument); - else - printf(p, precision, argument); - } else { - if (precision < 0) - printf(p, field_width, argument); - else - printf(p, field_width, precision, argument); - } - break; - } - free(p); -} Index: coreutils/uname.c =================================================================== --- coreutils/uname.c (revision 15566) +++ coreutils/uname.c (working copy) @@ -65,7 +65,7 @@ static const unsigned short int utsname_ offsetof(uname_info_t,processor) }; -int uname_main(int argc, char **argv) +int uname_main(void) { uname_info_t uname_info; #if defined(__sparc__) && defined(__linux__) @@ -74,7 +74,7 @@ int uname_main(int argc, char **argv) const unsigned short int *delta; char toprint; - toprint = bb_getopt_ulflags(argc, argv, options); + toprint = bb_getopt_ulflags(options); if (argc != optind) { bb_show_usage(); Index: coreutils/sleep.c =================================================================== --- coreutils/sleep.c (revision 15566) +++ coreutils/sleep.c (working copy) @@ -46,7 +46,7 @@ static const struct suffix_mult sleep_su }; #endif -int sleep_main(int argc, char **argv) +int sleep_main(void) { unsigned int duration; Index: coreutils/wc.c =================================================================== --- coreutils/wc.c (revision 15566) +++ coreutils/wc.c (working copy) @@ -96,7 +96,7 @@ enum { static const char fmt_str[] = " %7u\0 %s\n"; static const char total_str[] = "total"; -int wc_main(int argc, char **argv) +int wc_main(void) { FILE *fp; const char *s; @@ -111,7 +111,7 @@ int wc_main(int argc, char **argv) char in_word; char print_type; - print_type = bb_getopt_ulflags(argc, argv, wc_opts); + print_type = bb_getopt_ulflags(wc_opts); if (print_type == 0) { print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); Index: coreutils/basename.c =================================================================== --- coreutils/basename.c (revision 15566) +++ coreutils/basename.c (working copy) @@ -37,7 +37,7 @@ #include #include "busybox.h" -int basename_main(int argc, char **argv) +int basename_main(void) { size_t m, n; char *s; Index: coreutils/nice.c =================================================================== --- coreutils/nice.c (revision 15566) +++ coreutils/nice.c (working copy) @@ -42,7 +42,7 @@ static inline int int_add_no_wrap(int a, return s; } -int nice_main(int argc, char **argv) +int nice_main(void) { static const char Xetpriority_msg[] = "cannot %cet priority"; Index: coreutils/libcoreutils/coreutils.h =================================================================== --- coreutils/libcoreutils/coreutils.h (revision 15566) +++ coreutils/libcoreutils/coreutils.h (working copy) @@ -10,6 +10,6 @@ typedef int (*stat_func)(const char *fn, extern int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf); extern int cp_mv_stat(const char *fn, struct stat *fn_stat); -extern mode_t getopt_mk_fifo_nod(int argc, char **argv); +extern mode_t getopt_mk_fifo_nod(void); #endif Index: coreutils/libcoreutils/getopt_mk_fifo_nod.c =================================================================== --- coreutils/libcoreutils/getopt_mk_fifo_nod.c (revision 15566) +++ coreutils/libcoreutils/getopt_mk_fifo_nod.c (working copy) @@ -26,12 +26,12 @@ #include "libbb.h" #include "coreutils.h" -mode_t getopt_mk_fifo_nod(int argc, char **argv) +mode_t getopt_mk_fifo_nod(void) { mode_t mode = 0666; char *smode = NULL; - bb_getopt_ulflags(argc, argv, "m:", &smode); + bb_getopt_ulflags("m:", &smode); if(smode) { if (bb_parse_mode(smode, &mode)) umask(0); Index: coreutils/mv.c =================================================================== --- coreutils/mv.c (revision 15566) +++ coreutils/mv.c (working copy) @@ -48,7 +48,7 @@ static const struct option mv_long_optio static const char fmt[] = "cannot overwrite %sdirectory with %sdirectory"; -int mv_main(int argc, char **argv) +int mv_main(void) { struct stat dest_stat; const char *last; @@ -61,7 +61,7 @@ int mv_main(int argc, char **argv) bb_applet_long_options = mv_long_options; #endif bb_opt_complementally = "f-i:i-f"; - flags = bb_getopt_ulflags(argc, argv, "fi"); + flags = bb_getopt_ulflags("fi"); if (optind + 2 > argc) { bb_show_usage(); } Index: coreutils/md5_sha1_sum.c =================================================================== --- coreutils/md5_sha1_sum.c (revision 15566) +++ coreutils/md5_sha1_sum.c (working copy) @@ -90,14 +90,14 @@ static uint8_t *hash_file(const char *fi } /* This could become a common function for md5 as well, by using md5_stream */ -static int hash_files(int argc, char **argv, hash_algo_t hash_algo) +static int hash_files(int aargc, char **aargv, hash_algo_t hash_algo) { int return_value = EXIT_SUCCESS; uint8_t *hash_value; unsigned int flags; if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) - flags = bb_getopt_ulflags(argc, argv, "scw"); + flags = bb_getopt_ulflags("scw"); if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { if (flags & FLAG_SILENT) { @@ -109,18 +109,18 @@ static int hash_files(int argc, char **a } } - if (argc == optind) { - argv[argc++] = "-"; + if (aargc == optind) { + aargv[aargc++] = "-"; } if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && flags & FLAG_CHECK) { FILE *pre_computed_stream; int count_total = 0; int count_failed = 0; - char *file_ptr = argv[optind]; + char *file_ptr = aargv[optind]; char *line; - if (optind + 1 != argc) { + if (optind + 1 != aargc) { bb_error_msg_and_die ("only one argument may be specified when using -c"); } @@ -171,8 +171,8 @@ static int hash_files(int argc, char **a bb_perror_msg_and_die("Couldnt close file %s", file_ptr); } } else { - while (optind < argc) { - char *file_ptr = argv[optind++]; + while (optind < aargc) { + char *file_ptr = aargv[optind++]; hash_value = hash_file(file_ptr, hash_algo); if (hash_value == NULL) { @@ -187,15 +187,19 @@ static int hash_files(int argc, char **a } #ifdef CONFIG_MD5SUM -int md5sum_main(int argc, char **argv) +int md5sum_main(void) { - return (hash_files(argc, argv, HASH_MD5)); + int aargc = argc; + char **aargv = argv; + return (hash_files(aargc, aargv, HASH_MD5)); } #endif #ifdef CONFIG_SHA1SUM -int sha1sum_main(int argc, char **argv) +int sha1sum_main(void) { - return (hash_files(argc, argv, HASH_SHA1)); + int aargc = argc; + char **aargv = argv; + return (hash_files(aargc, aargv, HASH_SHA1)); } #endif Index: coreutils/dd.c =================================================================== --- coreutils/dd.c (revision 15566) +++ coreutils/dd.c (working copy) @@ -43,7 +43,7 @@ static void dd_output_status(int cur_sig (long)out_full, (long)out_part); } -int dd_main(int argc, char **argv) +int dd_main(void) { size_t count = -1, oc = 0, ibs = 512, obs = 512; ssize_t n; Index: coreutils/df.c =================================================================== --- coreutils/df.c (revision 15566) +++ coreutils/df.c (working copy) @@ -33,7 +33,7 @@ static long kscale(long b, long bs) } #endif -int df_main(int argc, char **argv) +int df_main(void) { long blocks_used; long blocks_percent_used; @@ -50,7 +50,7 @@ int df_main(int argc, char **argv) #ifdef CONFIG_FEATURE_HUMAN_READABLE bb_opt_complementally = "h-km:k-hm:m-hk"; - opt = bb_getopt_ulflags(argc, argv, "hmk"); + opt = bb_getopt_ulflags("hmk"); if(opt & 1) { df_disp_hr = 0; disp_units_hdr = " Size"; @@ -60,7 +60,7 @@ int df_main(int argc, char **argv) disp_units_hdr = "1M-blocks"; } #else - opt = bb_getopt_ulflags(argc, argv, "k"); + opt = bb_getopt_ulflags("k"); #endif bb_printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", Index: coreutils/uudecode.c =================================================================== --- coreutils/uudecode.c (revision 15566) +++ coreutils/uudecode.c (working copy) @@ -127,14 +127,14 @@ static int read_base64(FILE *src_stream, } } -int uudecode_main(int argc, char **argv) +int uudecode_main(void) { int (*decode_fn_ptr) (FILE * src, FILE * dst); FILE *src_stream; char *outname = NULL; char *line; - bb_getopt_ulflags(argc, argv, "o:", &outname); + bb_getopt_ulflags("o:", &outname); if (optind == argc) { src_stream = stdin; Index: coreutils/mknod.c =================================================================== --- coreutils/mknod.c (revision 15566) +++ coreutils/mknod.c (working copy) @@ -33,13 +33,13 @@ static const char modes_chars[] = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 }; static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK }; -int mknod_main(int argc, char **argv) +int mknod_main(void) { mode_t mode; dev_t dev; const char *name; - mode = getopt_mk_fifo_nod(argc, argv); + mode = getopt_mk_fifo_nod(); argv += optind; argc -= optind; Index: coreutils/diff.c =================================================================== --- coreutils/diff.c (revision 15566) +++ coreutils/diff.c (working copy) @@ -1192,7 +1192,7 @@ static void diffdir(char *p1, char *p2) -int diff_main(int argc, char **argv) +int diff_main(void) { int gotstdin = 0; @@ -1201,7 +1201,7 @@ int diff_main(int argc, char **argv) bb_opt_complementally = "L::"; cmd_flags = - bb_getopt_ulflags(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, + bb_getopt_ulflags("abdiL:NqrsS:tTU:wu", &L_arg, &start, &U_opt); if (cmd_flags & FLAG_L) { Index: coreutils/ln.c =================================================================== --- coreutils/ln.c (revision 15566) +++ coreutils/ln.c (working copy) @@ -36,7 +36,7 @@ #define LN_BACKUP 8 #define LN_SUFFIX 16 -int ln_main(int argc, char **argv) +int ln_main(void) { int status = EXIT_SUCCESS; int flag; @@ -47,7 +47,7 @@ int ln_main(int argc, char **argv) struct stat statbuf; int (*link_func)(const char *, const char *); - flag = bb_getopt_ulflags(argc, argv, "sfnbS:", &suffix); + flag = bb_getopt_ulflags("sfnbS:", &suffix); if (argc == optind) { bb_show_usage(); Index: coreutils/mkfifo.c =================================================================== --- coreutils/mkfifo.c (revision 15566) +++ coreutils/mkfifo.c (working copy) @@ -29,12 +29,12 @@ #include "busybox.h" #include "libcoreutils/coreutils.h" -int mkfifo_main(int argc, char **argv) +int mkfifo_main(void) { mode_t mode; int retval = EXIT_SUCCESS; - mode = getopt_mk_fifo_nod(argc, argv); + mode = getopt_mk_fifo_nod(); if (!*(argv += optind)) { bb_show_usage(); Index: coreutils/dos2unix.c =================================================================== --- coreutils/dos2unix.c (revision 15566) +++ coreutils/dos2unix.c (working copy) @@ -86,7 +86,7 @@ static int convert(char *fn) return 0; } -int dos2unix_main(int argc, char *argv[]) +int dos2unix_main(void) { int o; @@ -101,7 +101,7 @@ int dos2unix_main(int argc, char *argv[] /* process parameters */ /* -u convert to unix */ /* -d convert to dos */ - o = bb_getopt_ulflags(argc, argv, "du"); + o = bb_getopt_ulflags("du"); /* Do the conversion requested by an argument else do the default * conversion depending on our name. */ Index: coreutils/tee.c =================================================================== --- coreutils/tee.c (revision 15566) +++ coreutils/tee.c (working copy) @@ -29,7 +29,7 @@ #include #include "busybox.h" -int tee_main(int argc, char **argv) +int tee_main(void) { const char *mode = "w\0a"; FILE **files; @@ -44,7 +44,7 @@ int tee_main(int argc, char **argv) int c; #endif - flags = bb_getopt_ulflags(argc, argv, "ia"); /* 'a' must be 2nd */ + flags = bb_getopt_ulflags("ia"); /* 'a' must be 2nd */ mode += (flags & 2); /* Since 'a' is the 2nd option... */ Index: coreutils/date.c =================================================================== --- coreutils/date.c (revision 15566) +++ coreutils/date.c (working copy) @@ -111,7 +111,7 @@ static struct tm *date_conv_ftime(struct #define DATE_OPT_TIMESPEC 0x20 #define DATE_OPT_HINT 0x40 -int date_main(int argc, char **argv) +int date_main(void) { char *date_str = NULL; char *date_fmt = NULL; @@ -127,7 +127,7 @@ int date_main(int argc, char **argv) char *hintfmt_arg; bb_opt_complementally = "?:d--s:s--d"; - opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" + opt = bb_getopt_ulflags("Rs:ud:r:" USE_FEATURE_DATE_ISOFMT("I::D:"), &date_str, &date_str, &filename USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); Index: coreutils/rm.c =================================================================== --- coreutils/rm.c (revision 15566) +++ coreutils/rm.c (working copy) @@ -32,14 +32,14 @@ #include #include "busybox.h" -int rm_main(int argc, char **argv) +int rm_main(void) { int status = 0; int flags = 0; unsigned long opt; bb_opt_complementally = "f-i:i-f"; - opt = bb_getopt_ulflags(argc, argv, "fiRr"); + opt = bb_getopt_ulflags("fiRr"); if(opt & 1) flags |= FILEUTILS_FORCE; if(opt & 2) Index: coreutils/expr.c =================================================================== --- coreutils/expr.c (revision 15566) +++ coreutils/expr.c (working copy) @@ -89,7 +89,7 @@ static int toarith (VALUE *v); static void freev (VALUE *v); static void tostring (VALUE *v); -int expr_main (int argc, char **argv) +int expr_main (void) { VALUE *v; Index: coreutils/true.c =================================================================== --- coreutils/true.c (revision 15566) +++ coreutils/true.c (working copy) @@ -26,7 +26,7 @@ #include #include "busybox.h" -int true_main(int argc, char **argv) +int true_main(void) { return EXIT_SUCCESS; } Index: coreutils/test.c =================================================================== --- coreutils/test.c (revision 15566) +++ coreutils/test.c (working copy) @@ -171,22 +171,22 @@ static void initialize_group_array(void) static jmp_buf leaving; -int bb_test(int argc, char **argv) +int bb_test(int aargc, char **aargv) { int res; - if (strcmp(argv[0], "[") == 0) { - if (strcmp(argv[--argc], "]")) { + if (strcmp(aargv[0], "[") == 0) { + if (strcmp(aargv[--aargc], "]")) { bb_error_msg("missing ]"); return 2; } - argv[argc] = NULL; - } else if (strcmp(argv[0], "[[") == 0) { - if (strcmp(argv[--argc], "]]")) { + aargv[aargc] = NULL; + } else if (strcmp(aargv[0], "[[") == 0) { + if (strcmp(aargv[--aargc], "]]")) { bb_error_msg("missing ]]"); return 2; } - argv[argc] = NULL; + aargv[aargc] = NULL; } res = setjmp(leaving); @@ -204,35 +204,35 @@ int bb_test(int argc, char **argv) ngroups = 0; /* Implement special cases from POSIX.2, section 4.62.4 */ - switch (argc) { + switch (aargc) { case 1: return 1; case 2: - return *argv[1] == '\0'; + return *aargv[1] == '\0'; case 3: - if (argv[1][0] == '!' && argv[1][1] == '\0') { - return *argv[2] != '\0'; + if (aargv[1][0] == '!' && aargv[1][1] == '\0') { + return *aargv[2] != '\0'; } break; case 4: - if (argv[1][0] != '!' || argv[1][1] != '\0') { - if (t_lex(argv[2]), t_wp_op && t_wp_op->op_type == BINOP) { - t_wp = &argv[1]; + if (aargv[1][0] != '!' || aargv[1][1] != '\0') { + if (t_lex(aargv[2]), t_wp_op && t_wp_op->op_type == BINOP) { + t_wp = &aargv[1]; return binop() == 0; } } break; case 5: - if (argv[1][0] == '!' && argv[1][1] == '\0') { - if (t_lex(argv[3]), t_wp_op && t_wp_op->op_type == BINOP) { - t_wp = &argv[2]; + if (aargv[1][0] == '!' && aargv[1][1] == '\0') { + if (t_lex(aargv[3]), t_wp_op && t_wp_op->op_type == BINOP) { + t_wp = &aargv[2]; return binop() != 0; } } break; } - t_wp = &argv[1]; + t_wp = &aargv[1]; res = !oexpr(t_lex(*t_wp)); if (*t_wp != NULL && *++t_wp != NULL) { @@ -574,8 +574,10 @@ static int is_a_group_member(gid_t gid) /* applet entry point */ -int test_main(int argc, char **argv) +int test_main(void) { - exit(bb_test(argc, argv)); + int aargc = argc; + char **aargv = argv; + exit(bb_test(aargc, aargv)); } Index: coreutils/cksum.c =================================================================== --- coreutils/cksum.c (revision 15566) +++ coreutils/cksum.c (working copy) @@ -11,7 +11,7 @@ #include #include "busybox.h" -int cksum_main(int argc, char **argv) { +int cksum_main(void) { uint32_t *crc32_table = bb_crc32_filltable(1); Index: coreutils/fold.c =================================================================== --- coreutils/fold.c (revision 15566) +++ coreutils/fold.c (working copy) @@ -44,7 +44,7 @@ static int adjust_column(int column, cha return column; } -int fold_main(int argc, char **argv) +int fold_main(void) { char *w_opt; int width = 80; @@ -66,7 +66,7 @@ int fold_main(int argc, char **argv) } } - flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt); + flags = bb_getopt_ulflags("bsw:", &w_opt); if (flags & FLAG_WIDTH) width = bb_xgetlarg(w_opt, 10, 1, 10000); Index: coreutils/tr.c =================================================================== --- coreutils/tr.c (revision 15566) +++ coreutils/tr.c (working copy) @@ -190,7 +190,7 @@ static int complement(char *buffer, int return ix; } -int tr_main(int argc, char **argv) +int tr_main(void) { register unsigned char *ptr; int output_length=0, input_length; Index: coreutils/sort.c =================================================================== --- coreutils/sort.c (revision 15566) +++ coreutils/sort.c (working copy) @@ -226,7 +226,7 @@ static int compare_keys(const void *xarg return ((flags&FLAG_r)?-1:1)*retval; } -int sort_main(int argc, char **argv) +int sort_main(void) { FILE *fp,*outfile=NULL; int linecount=0,i,flag; Index: coreutils/seq.c =================================================================== --- coreutils/seq.c (revision 15566) +++ coreutils/seq.c (working copy) @@ -11,7 +11,7 @@ #include #include "busybox.h" -int seq_main(int argc, char **argv) +int seq_main(void) { double last, first, increment, i; Index: coreutils/nohup.c =================================================================== --- coreutils/nohup.c (revision 15566) +++ coreutils/nohup.c (working copy) @@ -1,11 +1,11 @@ /* vi:set ts=4: */ /* nohup - invoke a utility immune to hangups. - * + * * Busybox version based on nohup specification at * http://www.opengroup.org/onlinepubs/007904975/utilities/nohup.html - * + * * Copyright 2006 Rob Landley - * + * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ @@ -14,7 +14,7 @@ #include #include "busybox.h" -int nohup_main(int argc, char *argv[]) +int nohup_main(void) { int temp, nullfd; char *nohupout = "nohup.out", *home = NULL; Index: coreutils/chmod.c =================================================================== --- coreutils/chmod.c (revision 15566) +++ coreutils/chmod.c (working copy) @@ -31,7 +31,7 @@ static int fileAction(const char *fileNa return (FALSE); } -int chmod_main(int ATTRIBUTE_UNUSED argc, char **argv) +int chmod_main(void) { int retval = EXIT_SUCCESS; int recursiveFlag = FALSE; Index: coreutils/pwd.c =================================================================== --- coreutils/pwd.c (revision 15566) +++ coreutils/pwd.c (working copy) @@ -24,7 +24,7 @@ #include #include "busybox.h" -int pwd_main(int argc, char **argv) +int pwd_main(void) { char *buf; Index: coreutils/yes.c =================================================================== --- coreutils/yes.c (revision 15566) +++ coreutils/yes.c (working copy) @@ -31,7 +31,7 @@ #include #include "busybox.h" -int yes_main(int argc, char **argv) +int yes_main(void) { static const char fmt_str[] = " %s"; const char *fmt; Index: coreutils/realpath.c =================================================================== --- coreutils/realpath.c (revision 15566) +++ coreutils/realpath.c (working copy) @@ -14,7 +14,7 @@ #include #include "busybox.h" -int realpath_main(int argc, char **argv) +int realpath_main(void) { int retval = EXIT_SUCCESS; Index: coreutils/head.c =================================================================== --- coreutils/head.c (revision 15566) +++ coreutils/head.c (working copy) @@ -36,7 +36,7 @@ static const struct suffix_mult head_suf static const char header_fmt_str[] = "\n==> %s <==\n"; -int head_main(int argc, char **argv) +int head_main(void) { unsigned long count = 10; unsigned long i; Index: coreutils/cp.c =================================================================== --- coreutils/cp.c (revision 15566) +++ coreutils/cp.c (working copy) @@ -28,7 +28,7 @@ #include "busybox.h" #include "libcoreutils/coreutils.h" -int cp_main(int argc, char **argv) +int cp_main(void) { struct stat source_stat; struct stat dest_stat; @@ -39,7 +39,7 @@ int cp_main(int argc, char **argv) int flags; int status = 0; - flags = bb_getopt_ulflags(argc, argv, "pdRfiarPHL"); + flags = bb_getopt_ulflags("pdRfiarPHL"); if (flags & 32) { flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE); Index: coreutils/od.c =================================================================== --- coreutils/od.c (revision 15566) +++ coreutils/od.c (working copy) @@ -33,7 +33,7 @@ #define ishexdigit(c) (isxdigit)(c) static void -odoffset(int argc, char ***argvp) +odoffset(char ***argvp) { register char *num, *p; int base; @@ -164,7 +164,7 @@ static const char od_o2si[] = { 0xb, 1, 8, 9, }; -int od_main(int argc, char **argv) +int od_main(void) { int ch; int first = 1; @@ -196,9 +196,9 @@ int od_main(int argc, char **argv) argc -= optind; argv += optind; - odoffset(argc, &argv); + odoffset(&argv); - return(bb_dump_dump(argv)); + return(bb_dump_dump()); } /*- Index: coreutils/stty.c =================================================================== --- coreutils/stty.c (revision 15566) +++ coreutils/stty.c (working copy) @@ -470,7 +470,7 @@ static const struct suffix_mult stty_suf }; #ifndef TEST -int stty_main(int argc, char **argv) +int stty_main(void) #else int main(int argc, char **argv) #endif Index: coreutils/sum.c =================================================================== --- coreutils/sum.c (revision 15566) +++ coreutils/sum.c (working copy) @@ -134,14 +134,14 @@ release_and_ret: return 1; } -int sum_main(int argc, char **argv) +int sum_main(void) { int flags; int ok; int (*sum_func)(const char *, int) = bsd_sum_file; /* give the bsd func priority over sysv func */ - flags = bb_getopt_ulflags(argc, argv, "sr"); + flags = bb_getopt_ulflags("sr"); if (flags & 1) sum_func = sysv_sum_file; if (flags & 2) Index: coreutils/install.c =================================================================== --- coreutils/install.c (revision 15566) +++ coreutils/install.c (working copy) @@ -51,7 +51,7 @@ static const struct option install_long_ }; #endif -int install_main(int argc, char **argv) +int install_main(void) { mode_t mode; uid_t uid; @@ -67,7 +67,7 @@ int install_main(int argc, char **argv) #endif bb_opt_complementally = "?:s--d:d--s"; /* -c exists for backwards compatibility, its needed */ - flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ + flags = bb_getopt_ulflags("cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ /* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */ if (flags & INSTALL_OPT_PRESERVE_TIME) { Index: coreutils/uuencode.c =================================================================== --- coreutils/uuencode.c (revision 15566) +++ coreutils/uuencode.c (working copy) @@ -84,7 +84,7 @@ static void uuencode (const unsigned cha #define SRC_BUF_SIZE 45 // This *MUST* be a multiple of 3 #define DST_BUF_SIZE 4 * ((SRC_BUF_SIZE + 2) / 3) -int uuencode_main(int argc, char **argv) +int uuencode_main(void) { const size_t src_buf_size = SRC_BUF_SIZE; const size_t dst_buf_size = DST_BUF_SIZE; @@ -98,7 +98,7 @@ int uuencode_main(int argc, char **argv) RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1); tbl = tbl_std; - if (bb_getopt_ulflags(argc, argv, "m") & 1) { + if (bb_getopt_ulflags("m") & 1) { tbl = tbl_base64; } Index: coreutils/stat.c =================================================================== --- coreutils/stat.c (revision 15566) +++ coreutils/stat.c (working copy) @@ -521,14 +521,14 @@ static int do_stat(char const *filename, return 1; } -int stat_main(int argc, char **argv) +int stat_main(void) { int i; char *format = NULL; int ok = 1; int (*statfunc)(char const *, char const *) = do_stat; - flags = bb_getopt_ulflags(argc, argv, "ftL" + flags = bb_getopt_ulflags("ftL" USE_FEATURE_STAT_FORMAT("c:", &format) ); Index: coreutils/uniq.c =================================================================== --- coreutils/uniq.c (revision 15566) +++ coreutils/uniq.c (working copy) @@ -17,11 +17,11 @@ static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4"; -static FILE *xgetoptfile_uniq_s(char **argv, int read0write2) +static FILE *xgetoptfile_uniq_s(char **aargv, int read0write2) { const char *n; - if ((n = *argv) != NULL) { + if ((n = *aargv) != NULL) { if ((*n != '-') || n[1]) { return bb_xfopen(n, "r\0w" + read0write2); } @@ -29,7 +29,7 @@ static FILE *xgetoptfile_uniq_s(char **a return (read0write2) ? stdout : stdin; } -int uniq_main(int argc, char **argv) +int uniq_main(void) { FILE *in, *out; unsigned long dups, skip_fields, skip_chars, i, uniq_flags; Index: coreutils/echo.c =================================================================== --- coreutils/echo.c (revision 15566) +++ coreutils/echo.c (working copy) @@ -29,23 +29,23 @@ #include #include "busybox.h" -int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv) +int bb_echo(int aargc, char **aargv) { #ifndef CONFIG_FEATURE_FANCY_ECHO #define eflag '\\' - ++argv; + ++aargv; #else const char *p; int nflag = 1; int eflag = 0; - while (*++argv && (**argv == '-')) { + while (*++aargv && (**aargv == '-')) { /* If it appears that we are handling options, then make sure * that all of the options specified are actually valid. * Otherwise, the string should just be echoed. */ - if (!*(p = *argv + 1)) { /* A single '-', so echo it. */ + if (!*(p = *aargv + 1)) { /* A single '-', so echo it. */ goto just_echo; } @@ -56,7 +56,7 @@ int bb_echo(int ATTRIBUTE_UNUSED argc, c } while (*++p); /* All of the options in this arg are valid, so handle them. */ - p = *argv + 1; + p = *aargv + 1; do { if (*p == 'n') { nflag = 0; @@ -70,34 +70,34 @@ int bb_echo(int ATTRIBUTE_UNUSED argc, c just_echo: #endif - while (*argv) { + while (*aargv) { register int c; - while ((c = *(*argv)++)) { + while ((c = *(*aargv)++)) { if (c == eflag) { /* Check for escape seq. */ - if (**argv == 'c') { + if (**aargv == 'c') { /* '\c' means cancel newline and * ignore all subsequent chars. */ return 0; } #ifndef CONFIG_FEATURE_FANCY_ECHO /* SUSv3 specifies that octal escapes must begin with '0'. */ - if (((unsigned int)(**argv - '1')) >= 7) + if (((unsigned int)(**aargv - '1')) >= 7) #endif { /* Since SUSv3 mandates a first digit of 0, 4-digit octals * of the form \0### are accepted. */ - if ((**argv == '0') && (((unsigned int)(argv[0][1] - '0')) < 8)) { - (*argv)++; + if ((**aargv == '0') && (((unsigned int)(aargv[0][1] - '0')) < 8)) { + (*aargv)++; } /* bb_process_escape_sequence can handle nul correctly */ - c = bb_process_escape_sequence((const char **) argv); + c = bb_process_escape_sequence((const char **) aargv); } } putchar(c); } - if (*++argv) { + if (*++aargv) { putchar(' '); } } @@ -112,9 +112,11 @@ just_echo: return 0; } -int echo_main(int argc, char** argv) +int echo_main(void) { - (void)bb_echo(argc, argv); + int aargc = argc; + char **aargv = argv; + (void)bb_echo(aargc, aargv); bb_fflush_stdout_and_exit(EXIT_SUCCESS); } Index: coreutils/chown.c =================================================================== --- coreutils/chown.c (revision 15566) +++ coreutils/chown.c (working copy) @@ -37,13 +37,13 @@ static int fileAction(const char *fileNa #define FLAG_R 1 #define FLAG_h 2 -int chown_main(int argc, char **argv) +int chown_main(void) { int flags; int retval = EXIT_SUCCESS; char *groupName; - flags = bb_getopt_ulflags(argc, argv, "Rh"); + flags = bb_getopt_ulflags("Rh"); if (flags & FLAG_h) chown_func = lchown; Index: coreutils/length.c =================================================================== --- coreutils/length.c (revision 15566) +++ coreutils/length.c (working copy) @@ -7,7 +7,7 @@ #include #include "busybox.h" -int length_main(int argc, char **argv) +int length_main(void) { if ((argc != 2) || (**(++argv) == '-')) { bb_show_usage(); Index: coreutils/env.c =================================================================== --- coreutils/env.c (revision 15566) +++ coreutils/env.c (working copy) @@ -46,7 +46,7 @@ static const struct option env_long_opti }; #endif -int env_main(int argc, char** argv) +int env_main(void) { static char *cleanenv[1] = { NULL }; @@ -60,7 +60,7 @@ int env_main(int argc, char** argv) bb_applet_long_options = env_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); + opt = bb_getopt_ulflags("+iu:", &unset_env); argv += optind; if (*argv && (argv[0][0] == '-') && !argv[0][1]) { Index: coreutils/tail.c =================================================================== --- coreutils/tail.c (revision 15566) +++ coreutils/tail.c (working copy) @@ -86,7 +86,7 @@ static const char tail_opts[] = static const char header_fmt[] = "\n==> %s <==\n"; -int tail_main(int argc, char **argv) +int tail_main(void) { long count = 10; unsigned int sleep_period = 1; Index: coreutils/hostid.c =================================================================== --- coreutils/hostid.c (revision 15566) +++ coreutils/hostid.c (working copy) @@ -13,7 +13,7 @@ #include #include "busybox.h" -int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) +int hostid_main(void) { if (argc > 1) { bb_show_usage(); Index: coreutils/false.c =================================================================== --- coreutils/false.c (revision 15566) +++ coreutils/false.c (working copy) @@ -13,7 +13,7 @@ #include #include "busybox.h" -int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) +int false_main(void) { return EXIT_FAILURE; } Index: coreutils/who.c =================================================================== --- coreutils/who.c (revision 15566) +++ coreutils/who.c (working copy) @@ -35,7 +35,7 @@ static const char * idle_string (time_t return "old"; } -int who_main(int argc, char **argv) +int who_main(void) { struct utmp *ut; struct stat st; Index: coreutils/usleep.c =================================================================== --- coreutils/usleep.c (revision 15566) +++ coreutils/usleep.c (working copy) @@ -27,7 +27,7 @@ #include #include "busybox.h" -int usleep_main(int argc, char **argv) +int usleep_main(void) { if (argc != 2) { bb_show_usage(); Index: coreutils/catv.c =================================================================== --- coreutils/catv.c (revision 15566) +++ coreutils/catv.c (working copy) @@ -14,11 +14,11 @@ #include #include -int catv_main(int argc, char **argv) +int catv_main(void) { int retval = EXIT_SUCCESS, fd, flags; - flags = bb_getopt_ulflags(argc, argv, "etv"); + flags = bb_getopt_ulflags("etv"); flags ^= 4; // Loop through files. Index: coreutils/chroot.c =================================================================== --- coreutils/chroot.c (revision 15566) +++ coreutils/chroot.c (working copy) @@ -15,7 +15,7 @@ #include #include "busybox.h" -int chroot_main(int argc, char **argv) +int chroot_main(void) { if (argc < 2) { bb_show_usage(); Index: coreutils/cal.c =================================================================== --- coreutils/cal.c (revision 15566) +++ coreutils/cal.c (working copy) @@ -101,7 +101,7 @@ static char *build_row(char *p, int *dp) #define J_WEEK_LEN (WEEK_LEN + 7) #define HEAD_SEP 2 /* spaces between day headings */ -int cal_main(int argc, char **argv) +int cal_main(void) { struct tm *local_time; struct tm zero_tm; @@ -115,7 +115,7 @@ int cal_main(int argc, char **argv) setlocale(LC_TIME, ""); #endif - flags = bb_getopt_ulflags(argc, argv, "jy"); + flags = bb_getopt_ulflags("jy"); julian = flags & 1; Index: coreutils/chgrp.c =================================================================== --- coreutils/chgrp.c (revision 15566) +++ coreutils/chgrp.c (working copy) @@ -30,13 +30,13 @@ static int fileAction(const char *fileNa return (FALSE); } -int chgrp_main(int argc, char **argv) +int chgrp_main(void) { long gid; int recursiveFlag; int retval = EXIT_SUCCESS; - recursiveFlag = bb_getopt_ulflags(argc, argv, "R"); + recursiveFlag = bb_getopt_ulflags("R"); if (argc - optind < 2) { bb_show_usage(); Index: coreutils/printenv.c =================================================================== --- coreutils/printenv.c (revision 15566) +++ coreutils/printenv.c (working copy) @@ -25,7 +25,7 @@ #include #include "busybox.h" -int printenv_main(int argc, char **argv) +int printenv_main(void) { extern char **environ; int e = 0; Index: coreutils/watch.c =================================================================== --- coreutils/watch.c (revision 15566) +++ coreutils/watch.c (working copy) @@ -26,7 +26,7 @@ #include #include "busybox.h" -int watch_main(int argc, char **argv) +int watch_main(void) { int width, len; unsigned period = 2; Index: coreutils/mkdir.c =================================================================== --- coreutils/mkdir.c (revision 15566) +++ coreutils/mkdir.c (working copy) @@ -42,7 +42,7 @@ static const struct option mkdir_long_op }; #endif -int mkdir_main (int argc, char **argv) +int mkdir_main (void) { mode_t mode = (mode_t)(-1); int status = EXIT_SUCCESS; @@ -53,7 +53,7 @@ int mkdir_main (int argc, char **argv) #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS bb_applet_long_options = mkdir_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); + opt = bb_getopt_ulflags("m:p", &smode); if(opt & 1) { mode = 0777; if (!bb_parse_mode (smode, &mode)) { Index: coreutils/cat.c =================================================================== --- coreutils/cat.c (revision 15566) +++ coreutils/cat.c (working copy) @@ -13,12 +13,12 @@ #include "busybox.h" #include -int cat_main(int argc, char **argv) +int cat_main(void) { FILE *f; int retval = EXIT_SUCCESS; - bb_getopt_ulflags(argc, argv, "u"); + bb_getopt_ulflags("u"); argv += optind; if (!*argv) { Index: coreutils/du.c =================================================================== --- coreutils/du.c (revision 15566) +++ coreutils/du.c (working copy) @@ -152,7 +152,7 @@ static long du(char *filename) return sum; } -int du_main(int argc, char **argv) +int du_main(void) { long total; int slink_depth_save; @@ -178,7 +178,7 @@ int du_main(int argc, char **argv) */ #ifdef CONFIG_FEATURE_HUMAN_READABLE bb_opt_complementally = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; - opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); + opt = bb_getopt_ulflags("aHkLsx" "d:" "lc" "hm", &smax_print_depth); if((opt & (1 << 9))) { /* -h opt */ disp_hr = 0; @@ -193,7 +193,7 @@ int du_main(int argc, char **argv) } #else bb_opt_complementally = "H-L:L-H:s-d:d-s"; - opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); + opt = bb_getopt_ulflags("aHkLsx" "d:" "lc", &smax_print_depth); #if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K if((opt & (1 << 2))) { /* -k opt */ Index: coreutils/sync.c =================================================================== --- coreutils/sync.c (revision 15566) +++ coreutils/sync.c (working copy) @@ -26,7 +26,7 @@ #include #include "busybox.h" -int sync_main(int argc, char **argv) +int sync_main(void) { bb_warn_ignoring_args(argc - 1); Index: coreutils/rmdir.c =================================================================== --- coreutils/rmdir.c (revision 15566) +++ coreutils/rmdir.c (working copy) @@ -28,14 +28,14 @@ #include #include "busybox.h" -int rmdir_main(int argc, char **argv) +int rmdir_main(void) { int status = EXIT_SUCCESS; int flags; int do_dot; char *path; - flags = bb_getopt_ulflags(argc, argv, "p"); + flags = bb_getopt_ulflags("p"); argv += optind; Index: coreutils/ls.c =================================================================== --- coreutils/ls.c (revision 15566) +++ coreutils/ls.c (working copy) @@ -878,7 +878,7 @@ static const unsigned opt_flags[] = { /*----------------------------------------------------------------------*/ -int ls_main(int argc, char **argv) +int ls_main(void) { struct dnode **dnd; struct dnode **dnf; @@ -917,7 +917,7 @@ int ls_main(int argc, char **argv) /* process options */ #ifdef CONFIG_FEATURE_AUTOWIDTH - opt = bb_getopt_ulflags(argc, argv, ls_options, &tabstops_str, &terminal_width_str + opt = bb_getopt_ulflags(ls_options, &tabstops_str, &terminal_width_str #ifdef CONFIG_FEATURE_LS_COLOR , &color_opt #endif @@ -929,7 +929,7 @@ int ls_main(int argc, char **argv) terminal_width = atoi(terminal_width_str); } #else - opt = bb_getopt_ulflags(argc, argv, ls_options + opt = bb_getopt_ulflags(ls_options #ifdef CONFIG_FEATURE_LS_COLOR , &color_opt #endif Index: coreutils/cmp.c =================================================================== --- coreutils/cmp.c (revision 15566) +++ coreutils/cmp.c (working copy) @@ -62,7 +62,7 @@ enum { OPT_l = 2 }; -int cmp_main(int argc, char **argv) +int cmp_main(void) { FILE *fp1, *fp2, *outfile = stdout; const char *filename1, *filename2; @@ -73,7 +73,7 @@ int cmp_main(int argc, char **argv) bb_default_error_retval = 2; /* 1 is returned if files are different. */ - opt_flags = bb_getopt_ulflags(argc, argv, opt_chars); + opt_flags = bb_getopt_ulflags(opt_chars); if ((opt_flags == 3) || (((unsigned int)(--argc - optind)) > 1)) { bb_show_usage(); Index: coreutils/dirname.c =================================================================== --- coreutils/dirname.c (revision 15566) +++ coreutils/dirname.c (working copy) @@ -27,7 +27,7 @@ #include #include "busybox.h" -int dirname_main(int argc, char **argv) +int dirname_main(void) { if (argc != 2) { bb_show_usage(); Index: coreutils/tty.c =================================================================== --- coreutils/tty.c (revision 15566) +++ coreutils/tty.c (working copy) @@ -28,7 +28,7 @@ #include #include "busybox.h" -int tty_main(int argc, char **argv) +int tty_main(void) { const char *s; int silent; /* Note: No longer relevant in SUSv3. */ @@ -36,7 +36,7 @@ int tty_main(int argc, char **argv) bb_default_error_retval = 2; /* SUSv3 requires > 1 for error. */ - silent = bb_getopt_ulflags(argc, argv, "s"); + silent = bb_getopt_ulflags("s"); /* gnu tty outputs a warning that it is ignoring all args. */ bb_warn_ignoring_args(argc - optind); Index: coreutils/touch.c =================================================================== --- coreutils/touch.c (revision 15566) +++ coreutils/touch.c (working copy) @@ -39,13 +39,13 @@ #include #include "busybox.h" -int touch_main(int argc, char **argv) +int touch_main(void) { int fd; int flags; int status = EXIT_SUCCESS; - flags = bb_getopt_ulflags(argc, argv, "c"); + flags = bb_getopt_ulflags("c"); argv += optind; Index: coreutils/logname.c =================================================================== --- coreutils/logname.c (revision 15566) +++ coreutils/logname.c (working copy) @@ -25,7 +25,7 @@ #include #include "busybox.h" -int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) +int logname_main(void) { const char *p; Index: coreutils/whoami.c =================================================================== --- coreutils/whoami.c (revision 15566) +++ coreutils/whoami.c (working copy) @@ -27,7 +27,7 @@ #include #include "busybox.h" -int whoami_main(int argc, char **argv) +int whoami_main(void) { if (argc > 1) bb_show_usage(); Index: coreutils/cut.c =================================================================== --- coreutils/cut.c (revision 15566) +++ coreutils/cut.c (working copy) @@ -291,13 +291,13 @@ static void cut_file(FILE *file) } -int cut_main(int argc, char **argv) +int cut_main(void) { unsigned long opt; char *sopt, *sdopt; bb_opt_complementally = "b--bcf:c--bcf:f--bcf"; - opt = bb_getopt_ulflags(argc, argv, optstring, &sopt, &sopt, &sopt, &sdopt); + opt = bb_getopt_ulflags(optstring, &sopt, &sopt, &sopt, &sdopt); part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS); if(part == 0) bb_error_msg_and_die("you must specify a list of bytes, characters, or fields"); Index: coreutils/comm.c =================================================================== --- coreutils/comm.c (revision 15566) +++ coreutils/comm.c (working copy) @@ -112,11 +112,11 @@ static void cmp_files(char **infiles) fclose(streams[1]); } -int comm_main(int argc, char **argv) +int comm_main(void) { unsigned long flags; - flags = bb_getopt_ulflags(argc, argv, "123"); + flags = bb_getopt_ulflags("123"); if (optind + 2 != argc) bb_show_usage(); Index: coreutils/id.c =================================================================== --- coreutils/id.c (revision 15566) +++ coreutils/id.c (working copy) @@ -40,7 +40,7 @@ static short printf_full(unsigned int id return status; } -int id_main(int argc, char **argv) +int id_main(void) { struct passwd *p; uid_t uid; @@ -51,7 +51,7 @@ int id_main(int argc, char **argv) /* Don't allow -n -r -nr -ug -rug -nug -rnug */ /* Don't allow more than one username */ bb_opt_complementally = "?1:?:u--g:g--u:r?ug:n?ug"; - flags = bb_getopt_ulflags(argc, argv, "rnug"); + flags = bb_getopt_ulflags("rnug"); /* This values could be overwritten later */ uid = geteuid(); Index: libbb/getopt_ulflags.c =================================================================== --- libbb/getopt_ulflags.c (revision 15566) +++ libbb/getopt_ulflags.c (working copy) @@ -29,12 +29,12 @@ /* Documentation unsigned long -bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) +bb_getopt_ulflags(const char *applet_opts, ...) The command line options must be declared in const char *applet_opts as a string of chars, for example: - flags = bb_getopt_ulflags(argc, argv, "rnug"); + flags = bb_getopt_ulflags("rnug"); If one of the given options is found, a flag value is added to the return value (an unsigned long). @@ -42,7 +42,7 @@ bb_getopt_ulflags (int argc, char **argv The flag value is determined by the position of the char in applet_opts string. For example, in the above case: - flags = bb_getopt_ulflags(argc, argv, "rnug"); + flags = bb_getopt_ulflags("rnug"); "r" will add 1 (bit 0) "n" will add 2 (bit 1) @@ -61,7 +61,7 @@ bb_getopt_ulflags (int argc, char **argv char *pointer_to_arg_for_c; char *pointer_to_arg_for_d; - flags = bb_getopt_ulflags(argc, argv, "a:b:c:d:", + flags = bb_getopt_ulflags("a:b:c:d:", &pointer_to_arg_for_a, &pointer_to_arg_for_b, &pointer_to_arg_for_c, &pointer_to_arg_for_d); @@ -114,7 +114,7 @@ const char *bb_opt_complementally bb_opt_complementally = "abc"; - flags = bb_getopt_ulflags(argc, argv, "abcd") + flags = bb_getopt_ulflags("abcd") If getopt() finds "-a" on the command line, then bb_getopt_ulflags's return value will be as if "-a -b -c" were @@ -128,7 +128,7 @@ const char *bb_opt_complementally int w_counter = 0; bb_opt_complementally = "ww"; - bb_getopt_ulflags(argc, argv, "w", &w_counter); + bb_getopt_ulflags("w", &w_counter); if(w_counter) width = (w_counter == 1) ? 132 : INT_MAX; @@ -144,7 +144,7 @@ const char *bb_opt_complementally llist_t *my_b = NULL; int verbose_level = 0; bb_opt_complementally = "vv:b::b-c:c-b"; - f = bb_getopt_ulflags(argc, argv, "vb:c", &my_b, &verbose_level); + f = bb_getopt_ulflags("vb:c", &my_b, &verbose_level); if((f & 2)) // -c after -b unsets -b flag while(my_b) { dosomething_with(my_b->data) ; my_b = my_b->link; } if(my_b) // but llist is stored if -b is specified @@ -172,7 +172,7 @@ Special characters: char *smax_print_depth; bb_opt_complementally = "s-d:d-s:x-x"; - opt = bb_getopt_ulflags(argc, argv, "sd:x", &smax_print_depth); + opt = bb_getopt_ulflags("sd:x", &smax_print_depth); if (opt & 2) max_print_depth = atoi(smax_print_depth); @@ -185,7 +185,7 @@ Special characters: use ':' or end of line. For example: bb_opt_complementally = "-:w-x:x-w"; - bb_getopt_ulflags(argc, argv, "wx"); + bb_getopt_ulflags("wx"); Allows any arguments to be given without a dash (./program w x) as well as with a dash (./program -x). @@ -239,7 +239,7 @@ Special characters: bb_opt_complementally = "e::"; - bb_getopt_ulflags(argc, argv, "e:", &patterns); + bb_getopt_ulflags("e:", &patterns); $ grep -e user -e root /etc/passwd root:x:0:0:root:/root:/bin/bash user:x:500:500::/home/user:/bin/bash @@ -258,7 +258,7 @@ Special characters: // Don't allow -n -r -rn -ug -rug -nug -rnug bb_opt_complementally = "r?ug:n?ug:?u--g:g--u"; - flags = bb_getopt_ulflags(argc, argv, "rnug"); + flags = bb_getopt_ulflags("rnug"); This example allowed only: $ id; id -u; id -g; id -ru; id -nu; id -rg; id -ng; id -rnu; id -rng @@ -270,7 +270,7 @@ Special characters: // Don't allow -KS -SK, but -S or -K is required bb_opt_complementally = "K:S:?K--S:S--K"; - flags = bb_getopt_ulflags(argc, argv, "KS...); + flags = bb_getopt_ulflags("KS...); "x--x" give error if double or more used -x option @@ -308,7 +308,7 @@ const struct option *bb_applet_long_opti #endif unsigned long -bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) +bb_getopt_ulflags(const char *applet_opts, ...) { unsigned long flags = 0; unsigned long requires = 0; Index: libbb/dump.c =================================================================== --- libbb/dump.c (revision 15566) +++ libbb/dump.c (working copy) @@ -317,13 +317,13 @@ static void do_skip(char *fname, int sta bb_dump_skip = 0; } -static int next(char **argv) +static int next(char **aargv) { static int done; int statok; - if (argv) { - _argv = argv; + if (aargv) { + _argv = aargv; return (1); } for (;;) { @@ -648,7 +648,7 @@ static void display(void) } } -int bb_dump_dump(char **argv) +int bb_dump_dump(void) { register FS *tfs; Index: libbb/xfuncs.c =================================================================== --- libbb/xfuncs.c (revision 15566) +++ libbb/xfuncs.c (working copy) @@ -186,18 +186,18 @@ void bb_xfflush_stdout(void) #ifdef L_spawn // This does a fork/exec in one call, using vfork(). -pid_t bb_spawn(char **argv) +pid_t bb_spawn(char **aargv) { static int failed; pid_t pid; - void *app = find_applet_by_name(argv[0]); + void *app = find_applet_by_name(aargv[0]); // Be nice to nommu machines. failed = 0; pid = vfork(); if (pid < 0) return pid; if (!pid) { - execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : *argv, argv); + execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : *aargv, aargv); // We're sharing a stack with blocked parent, let parent know we failed // and then exit to unblock parent (but don't run atexit() stuff, which @@ -211,10 +211,10 @@ pid_t bb_spawn(char **argv) #endif #ifdef L_xspawn -pid_t bb_xspawn(char **argv) +pid_t bb_xspawn(char **aargv) { - pid_t pid = bb_spawn(argv); - if (pid < 0) bb_perror_msg_and_die("%s", *argv); + pid_t pid = bb_spawn(aargv); + if (pid < 0) bb_perror_msg_and_die("%s", *aargv); return pid; } #endif Index: e2fsprogs/lsattr.c =================================================================== --- e2fsprogs/lsattr.c (revision 15566) +++ e2fsprogs/lsattr.c (working copy) @@ -119,11 +119,11 @@ static int lsattr_dir_proc(const char *d return 0; } -int lsattr_main(int argc, char **argv) +int lsattr_main(void) { int i; - flags = bb_getopt_ulflags(argc, argv, "Radlv"); + flags = bb_getopt_ulflags("Radlv"); if (optind > argc - 1) lsattr_args("."); Index: e2fsprogs/e2fsck.c =================================================================== --- e2fsprogs/e2fsck.c (revision 15566) +++ e2fsprogs/e2fsck.c (working copy) @@ -13005,7 +13005,7 @@ static void parse_extended_opts(e2fsck_t } -static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) +static errcode_t PRS(e2fsck_t *ret_ctx) { int flush = 0; int c, fd; @@ -13206,7 +13206,7 @@ static errcode_t PRS(int argc, char *arg static const char my_ver_string[] = E2FSPROGS_VERSION; static const char my_ver_date[] = E2FSPROGS_DATE; -int e2fsck_main (int argc, char *argv[]) +int e2fsck_main (void) { errcode_t retval; int exit_value = EXIT_OK; @@ -13229,7 +13229,7 @@ int e2fsck_main (int argc, char *argv[]) show_version_only++; } - retval = PRS(argc, argv, &ctx); + retval = PRS(&ctx); if (retval) { bb_error_msg(_("while trying to initialize program")); exit(EXIT_ERROR); Index: e2fsprogs/chattr.c =================================================================== --- e2fsprogs/chattr.c (revision 15566) +++ e2fsprogs/chattr.c (working copy) @@ -176,7 +176,7 @@ static int chattr_dir_proc(const char *d return 0; } -int chattr_main(int argc, char **argv) +int chattr_main(void) { int i; char *arg; Index: e2fsprogs/tune2fs.c =================================================================== --- e2fsprogs/tune2fs.c (revision 15566) +++ e2fsprogs/tune2fs.c (working copy) @@ -356,7 +356,7 @@ static char * x_blkid_get_devname(const } #ifdef CONFIG_E2LABEL -static void parse_e2label_options(int argc, char ** argv) +static void parse_e2label_options(void) { if ((argc < 2) || (argc > 3)) bb_show_usage(); @@ -372,7 +372,7 @@ static void parse_e2label_options(int ar print_label++; } #else -#define parse_e2label_options(x,y) +#define parse_e2label_options() #endif static time_t parse_time(char *str) @@ -401,7 +401,7 @@ static time_t parse_time(char *str) return (mktime(&ts)); } -static void parse_tune2fs_options(int argc, char **argv) +static void parse_tune2fs_options(void) { int c; char * tmp; @@ -566,7 +566,7 @@ MOUNTS_COUNT_ERROR: } #ifdef CONFIG_FINDFS -static ATTRIBUTE_NORETURN void do_findfs(int argc, char **argv) +static ATTRIBUTE_NORETURN void do_findfs(void) { if ((argc != 2) || (strncmp(argv[1], "LABEL=", 6) && strncmp(argv[1], "UUID=", 5))) @@ -576,7 +576,7 @@ static ATTRIBUTE_NORETURN void do_findfs exit(0); } #else -#define do_findfs(x, y) +#define do_findfs() #endif static void tune2fs_clean_up(void) @@ -585,7 +585,7 @@ static void tune2fs_clean_up(void) if (ENABLE_FEATURE_CLEAN_UP && journal_device) free(journal_device); } -int tune2fs_main(int argc, char **argv) +int tune2fs_main(void) { errcode_t retval; ext2_filsys fs; @@ -596,11 +596,11 @@ int tune2fs_main(int argc, char **argv) atexit(tune2fs_clean_up); if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ - do_findfs(argc, argv); /* no return */ + do_findfs(); /* no return */ else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ - parse_e2label_options(argc, argv); + parse_e2label_options(); else - parse_tune2fs_options(argc, argv); /* tune2fs */ + parse_tune2fs_options(); io_ptr = unix_io_manager; retval = ext2fs_open2(device_name, io_options, open_flag, Index: e2fsprogs/fsck.c =================================================================== --- e2fsprogs/fsck.c (revision 15566) +++ e2fsprogs/fsck.c (working copy) @@ -577,9 +577,9 @@ static int progress_active(void) static int execute(const char *type, const char *device, const char *mntpt, int interactive) { - char *s, *argv[80]; + char *s; char *prog; - int argc, i; + int i; struct fsck_instance *inst, *p; pid_t pid; @@ -1180,7 +1180,7 @@ static void signal_cancel(int sig FSCK_A cancel_requested++; } -static void PRS(int argc, char *argv[]) +static void PRS(void) { int i, j; char *arg, *dev, *tmp = 0; @@ -1330,7 +1330,7 @@ static void PRS(int argc, char *argv[]) max_running = atoi(tmp); } -int fsck_main(int argc, char *argv[]) +int fsck_main(void) { int i, status = 0; int interactive = 0; @@ -1341,7 +1341,7 @@ int fsck_main(int argc, char *argv[]) setvbuf(stderr, NULL, _IONBF, BUFSIZ); blkid_get_cache(&cache, NULL); - PRS(argc, argv); + PRS(); if (!notitle) printf("fsck %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE); Index: e2fsprogs/mke2fs.c =================================================================== --- e2fsprogs/mke2fs.c (revision 15566) +++ e2fsprogs/mke2fs.c (working copy) @@ -787,7 +787,7 @@ static __u32 ok_features[3] = { EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER /* R/O compat */ }; -static int PRS(int argc, char *argv[]) +static int PRS(void) { int b, c; int size; @@ -1204,7 +1204,7 @@ static void mke2fs_clean_up(void) if (ENABLE_FEATURE_CLEAN_UP && journal_device) free(journal_device); } -int mke2fs_main (int argc, char *argv[]) +int mke2fs_main (void) { errcode_t retval; ext2_filsys fs; @@ -1215,7 +1215,7 @@ int mke2fs_main (int argc, char *argv[]) if (ENABLE_FEATURE_CLEAN_UP) atexit(mke2fs_clean_up); - if(!PRS(argc, argv)) + if(!PRS()) return 0; #ifdef CONFIG_TESTIO_DEBUG Index: miscutils/time.c =================================================================== --- miscutils/time.c (revision 15566) +++ miscutils/time.c (working copy) @@ -112,11 +112,10 @@ static int resuse_end(pid_t pid, resourc } /* Print ARGV to FP, with each entry in ARGV separated by FILLER. */ -static void fprintargv(FILE * fp, char *const *argv, const char *filler) +static void fprintargv(FILE * fp, const char *filler) { - char *const *av; + char *const *av = argv; - av = argv; fputs(*av, fp); while (*++av) { fputs(filler, fp); @@ -200,8 +199,7 @@ static unsigned long ptok(unsigned long COMMAND is the command and args that are being summarized. RESP is resource information on the command. */ -static void summarize(FILE * fp, const char *fmt, char **command, - resource_t * resp) +static void summarize(FILE * fp, const char *fmt, resource_t * resp) { unsigned long r; /* Elapsed real milliseconds. */ unsigned long v; /* Elapsed virtual (CPU) milliseconds. */ @@ -234,7 +232,7 @@ static void summarize(FILE * fp, const c putc('%', fp); break; case 'C': /* The command that got timed. */ - fprintargv(fp, command, " "); + fprintargv(fp, " "); break; case 'D': /* Average unshared data size. */ fprintf(fp, "%lu", @@ -404,7 +402,7 @@ static void summarize(FILE * fp, const c /* Run command CMD and return statistics on it. Put the statistics in *RESP. */ -static void run_command(char *const *cmd, resource_t * resp) +static void run_command(resource_t * resp) { pid_t pid; /* Pid of child. */ __sighandler_t interrupt_signal, quit_signal; @@ -416,8 +414,8 @@ static void run_command(char *const *cmd else if (pid == 0) { /* If child. */ /* Don't cast execvp arguments; that causes errors on some systems, versus merely warnings if the cast is left off. */ - execvp(cmd[0], cmd); - bb_error_msg("cannot run %s", cmd[0]); + execvp(argv[0], argv); + bb_error_msg("cannot run %s", argv[0]); _exit(errno == ENOENT ? 127 : 126); } @@ -433,7 +431,7 @@ static void run_command(char *const *cmd signal(SIGQUIT, quit_signal); } -int time_main(int argc, char **argv) +int time_main(void) { int gotone; resource_t res; @@ -465,8 +463,8 @@ int time_main(int argc, char **argv) if (argv == NULL || *argv == NULL) bb_show_usage(); - run_command(argv, &res); - summarize(stderr, output_format, argv, &res); + run_command(&res); + summarize(stderr, output_format, &res); fflush(stderr); if (WIFSTOPPED(res.waitstatus)) Index: miscutils/makedevs.c =================================================================== --- miscutils/makedevs.c (revision 15566) +++ miscutils/makedevs.c (working copy) @@ -19,7 +19,7 @@ #include /* major() and minor() */ #ifdef CONFIG_FEATURE_MAKEDEVS_LEAF -int makedevs_main(int argc, char **argv) +int makedevs_main(void) { mode_t mode; char *basedev, *type, *nodname, buf[255]; @@ -77,7 +77,7 @@ int makedevs_main(int argc, char **argv) /* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ -int makedevs_main(int argc, char **argv) +int makedevs_main(void) { FILE *table = stdin; char *rootdir = NULL; @@ -85,7 +85,7 @@ int makedevs_main(int argc, char **argv) int linenum = 0; int ret = EXIT_SUCCESS; - bb_getopt_ulflags(argc, argv, "d:", &line); + bb_getopt_ulflags("d:", &line); if (line) table = bb_xfopen(line, "r"); Index: miscutils/watchdog.c =================================================================== --- miscutils/watchdog.c (revision 15566) +++ miscutils/watchdog.c (working copy) @@ -28,13 +28,13 @@ static void watchdog_shutdown(int ATTRIB exit(0); } -int watchdog_main(int argc, char **argv) +int watchdog_main(void) { unsigned long opts; unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */ char *t_arg; - opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg); + opts = bb_getopt_ulflags("Ft:", &t_arg); if (opts & OPT_TIMER) timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); Index: miscutils/last.c =================================================================== --- miscutils/last.c (revision 15566) +++ miscutils/last.c (working copy) @@ -34,7 +34,7 @@ #error struct utmp member char[] size(s) have changed! #endif -int last_main(int argc, char **argv) +int last_main(void) { struct utmp ut; int n, file = STDIN_FILENO; Index: miscutils/crond.c =================================================================== --- miscutils/crond.c (revision 15566) +++ miscutils/crond.c (working copy) @@ -146,7 +146,7 @@ static void crondlog(const char *ctl, .. } } -int crond_main(int ac, char **av) +int crond_main(void) { unsigned long opt; char *lopt, *Lopt, *copt; @@ -160,7 +160,7 @@ int crond_main(int ac, char **av) #endif opterr = 0; /* disable getopt 'errors' message. */ - opt = bb_getopt_ulflags(ac, av, "l:L:fbSc:" + opt = bb_getopt_ulflags("l:L:fbSc:" #if ENABLE_DEBUG_CROND_OPTION "d:" #endif @@ -206,7 +206,7 @@ int crond_main(int ac, char **av) if (!(opt & 4)) { #ifdef BB_NOMMU /* reexec for vfork() do continue parent */ - vfork_daemon_rexec(1, 0, ac, av, "-f"); + vfork_daemon_rexec(1, 0, argc, argv, "-f"); #else bb_xdaemon(1, 0); #endif Index: miscutils/adjtimex.c =================================================================== --- miscutils/adjtimex.c (revision 15566) +++ miscutils/adjtimex.c (working copy) @@ -42,7 +42,7 @@ static const char * const ret_code_descr "leap second has occurred", "clock not synchronized" }; -int adjtimex_main(int argc, char **argv) +int adjtimex_main(void) { struct timex txc; int quiet=0; Index: miscutils/less.c =================================================================== --- miscutils/less.c (revision 15566) +++ miscutils/less.c (working copy) @@ -1104,11 +1104,11 @@ static void keypress_process(int keypres number_process(keypress); } -int less_main(int argc, char **argv) { +int less_main(void) { int keypress; - flags = bb_getopt_ulflags(argc, argv, "EMmN~"); + flags = bb_getopt_ulflags("EMmN~"); argc -= optind; argv += optind; Index: miscutils/bbconfig.c =================================================================== --- miscutils/bbconfig.c (revision 15566) +++ miscutils/bbconfig.c (working copy) @@ -4,7 +4,7 @@ #include "busybox.h" #include "bbconfigopts.h" -int bbconfig_main(int argc, char **argv) +int bbconfig_main(void) { printf(bbconfig_config); return 0; Index: miscutils/hdparm.c =================================================================== --- miscutils/hdparm.c (revision 15566) +++ miscutils/hdparm.c (working copy) @@ -2112,8 +2112,8 @@ static const char hdparm_options[]= "gfu /*-------------------------------------*/ /* our main() routine: */ -int hdparm_main(int argc, char **argv) ATTRIBUTE_NORETURN; -int hdparm_main(int argc, char **argv) +int hdparm_main(void) ATTRIBUTE_NORETURN; +int hdparm_main(void) { int c; int flagcount = 0; Index: miscutils/devfsd.c =================================================================== --- miscutils/devfsd.c (revision 15566) +++ miscutils/devfsd.c (working copy) @@ -171,7 +171,7 @@ struct permissions_type struct execute_type { - char *argv[MAX_ARGS + 1]; /* argv[0] must always be the programme */ + char *aargv[MAX_ARGS + 1]; /* argv[0] must always be the programme */ }; struct copy_type @@ -430,7 +430,7 @@ static unsigned int scan_dev_name(const /* Public functions follow */ -int devfsd_main (int argc, char **argv) +int devfsd_main (void) { int print_version = FALSE; int do_daemon = TRUE; @@ -699,9 +699,9 @@ static void process_config_line (const c num_args -= 3; for (count = 0; count < num_args; ++count) - new->u.execute.argv[count] = bb_xstrdup (p[count]); + new->u.execute.aargv[count] = bb_xstrdup (p[count]); - new->u.execute.argv[num_args] = NULL; + new->u.execute.aargv[num_args] = NULL; break; case 7: /* COPY */ new->action.what = AC_COPY; @@ -878,19 +878,19 @@ static void action_modload (const struct [RETURNS] Nothing. */ { - char *argv[6]; + char *aargv[6]; char device[STRING_LENGTH]; - argv[0] = MODPROBE; - argv[1] = MODPROBE_SWITCH_1; /* "-k" */ - argv[2] = MODPROBE_SWITCH_2; /* "-C" */ - argv[3] = CONFIG_MODULES_DEVFS; - argv[4] = device; - argv[5] = NULL; + aargv[0] = MODPROBE; + aargv[1] = MODPROBE_SWITCH_1; /* "-k" */ + aargv[2] = MODPROBE_SWITCH_2; /* "-C" */ + aargv[3] = CONFIG_MODULES_DEVFS; + aargv[4] = device; + aargv[5] = NULL; snprintf (device, sizeof (device), "/dev/%s", info->devname); - debug_msg_logger(LOG_INFO, "%s: %s %s %s %s %s",__FUNCTION__, argv[0],argv[1],argv[2],argv[3],argv[4]); - fork_and_execute(DIE, argv[0], argv); + debug_msg_logger(LOG_INFO, "%s: %s %s %s %s %s",__FUNCTION__, aargv[0],aargv[1],aargv[2],aargv[3],aargv[4]); + fork_and_execute(DIE, aargv[0], aargv); } /* End Function action_modload */ static void action_execute (const struct devfsd_notify_struct *info, @@ -907,23 +907,23 @@ static void action_execute (const struct { unsigned int count; struct get_variable_info gv_info; - char *argv[MAX_ARGS + 1]; + char *aargv[MAX_ARGS + 1]; char largv[MAX_ARGS + 1][STRING_LENGTH]; debug_msg_logger(LOG_INFO ,__FUNCTION__); gv_info.info = info; gv_info.devname = info->devname; snprintf (gv_info.devpath, sizeof (gv_info.devpath), "%s/%s", mount_point, info->devname); - for (count = 0; entry->u.execute.argv[count] != NULL; ++count) + for (count = 0; entry->u.execute.aargv[count] != NULL; ++count) { expand_expression (largv[count], STRING_LENGTH, - entry->u.execute.argv[count], + entry->u.execute.aargv[count], get_variable, &gv_info, gv_info.devname, regexpr, numexpr ); - argv[count] = largv[count]; + aargv[count] = largv[count]; } - argv[count] = NULL; - fork_and_execute(NO_DIE, argv[0], argv); + aargv[count] = NULL; + fork_and_execute(NO_DIE, aargv[0], aargv); } /* End Function action_execute */ @@ -1206,9 +1206,9 @@ static void free_config (void) { for (count = 0; count < MAX_ARGS; ++count) { - if (c_entry->u.execute.argv[count] == NULL) + if (c_entry->u.execute.aargv[count] == NULL) break; - free (c_entry->u.execute.argv[count]); + free (c_entry->u.execute.aargv[count]); } } free (c_entry); Index: miscutils/mountpoint.c =================================================================== --- miscutils/mountpoint.c (revision 15566) +++ miscutils/mountpoint.c (working copy) @@ -15,9 +15,9 @@ #include /* strerror */ #include /* optind */ -int mountpoint_main(int argc, char **argv) +int mountpoint_main(void) { - int opt = bb_getopt_ulflags(argc, argv, "qdx"); + int opt = bb_getopt_ulflags("qdx"); #define OPT_q (1) #define OPT_d (2) #define OPT_x (4) Index: miscutils/taskset.c =================================================================== --- miscutils/taskset.c (revision 15574) +++ miscutils/taskset.c (working copy) @@ -37,7 +37,7 @@ static char *__from_cpuset(cpu_set_t *ma #define from_cpuset(mask) mask #endif -int taskset_main(int argc, char** argv) +int taskset_main(void) { cpu_set_t mask, new_mask; pid_t pid = 0; @@ -45,7 +45,7 @@ int taskset_main(int argc, char** argv) const char *state = "current\0new"; char *p_opt = NULL, *aff = NULL; - ul = bb_getopt_ulflags(argc, argv, "+p:", &p_opt); + ul = bb_getopt_ulflags("+p:", &p_opt); #define TASKSET_OPT_p (1) if (ul & TASKSET_OPT_p) { Index: miscutils/mt.c =================================================================== --- miscutils/mt.c (revision 15566) +++ miscutils/mt.c (working copy) @@ -50,7 +50,7 @@ static const struct mt_opcodes opcodes[] {0, 0} }; -int mt_main(int argc, char **argv) +int mt_main(void) { const char *file = "/dev/tape"; const struct mt_opcodes *code = opcodes; Index: miscutils/dc.c =================================================================== --- miscutils/dc.c (revision 15566) +++ miscutils/dc.c (working copy) @@ -196,7 +196,7 @@ static int number_of_tokens(char *buffer return i; } -int dc_main(int argc, char **argv) +int dc_main(void) { /* take stuff from stdin if no args are given */ if (argc <= 1) { Index: miscutils/crontab.c =================================================================== --- miscutils/crontab.c (revision 15566) +++ miscutils/crontab.c (working copy) @@ -48,7 +48,7 @@ static int GetReplaceStream(const char * static int ChangeUser(const char *user, short dochdir); int -crontab_main(int ac, char **av) +crontab_main(void) { enum { NONE, EDIT, LIST, REPLACE, DELETE } option = NONE; const struct passwd *pas; @@ -65,19 +65,19 @@ crontab_main(int ac, char **av) safe_strncpy(caller, pas->pw_name, sizeof(caller)); i = 1; - if (ac > 1) { - if (av[1][0] == '-' && av[1][1] == 0) { + if (argc > 1) { + if (argv[1][0] == '-' && argv[1][1] == 0) { option = REPLACE; ++i; - } else if (av[1][0] != '-') { + } else if (argv[1][0] != '-') { option = REPLACE; ++i; - repFile = av[1]; + repFile = argv[1]; } } - for (; i < ac; ++i) { - char *ptr = av[i]; + for (; i < argc; ++i) { + char *ptr = argv[i]; if (*ptr != '-') break; @@ -97,14 +97,14 @@ crontab_main(int ac, char **av) option = DELETE; /* fall through */ case 'u': - if (i + 1 < ac && av[i+1][0] != '-') { + if (i + 1 < argc && argv[i+1][0] != '-') { ++i; if (getuid() == geteuid()) { - pas = getpwnam(av[i]); + pas = getpwnam(argv[i]); if (pas) { UserId = pas->pw_uid; } else { - bb_error_msg_and_die("user %s unknown", av[i]); + bb_error_msg_and_die("user %s unknown", argv[i]); } } else { bb_error_msg_and_die("only the superuser may specify a user"); @@ -113,17 +113,17 @@ crontab_main(int ac, char **av) break; case 'c': if (getuid() == geteuid()) { - CDir = (*ptr) ? ptr : av[++i]; + CDir = (*ptr) ? ptr : argv[++i]; } else { bb_error_msg_and_die("-c option: superuser only"); } break; default: - i = ac; + i = argc; break; } } - if (i != ac || option == NONE) + if (i != argc || option == NONE) bb_show_usage(); /* Index: miscutils/Config.in =================================================================== --- miscutils/Config.in (revision 15566) +++ miscutils/Config.in (working copy) @@ -311,6 +311,12 @@ config CONFIG_TASKSET help Retrieve or set a processes's CPU affinity +config CONFIG_FEATURE_TASKSET_FANCY + bool "fancy features" + default n + help + Pretty print the mask. This adds about 140b. + config CONFIG_TIME bool "time" default n Index: miscutils/rx.c =================================================================== --- miscutils/rx.c (revision 15566) +++ miscutils/rx.c (working copy) @@ -261,7 +261,7 @@ static void sigalrm_handler(int ATTRIBUT { } -int rx_main(int argc, char **argv) +int rx_main(void) { char *fn; int ttyfd, filefd; Index: miscutils/strings.c =================================================================== --- miscutils/strings.c (revision 15566) +++ miscutils/strings.c (working copy) @@ -24,7 +24,7 @@ #define PRINT_OFFSET 4 #define SIZE 8 -int strings_main(int argc, char **argv) +int strings_main(void) { int n, c, i = 0, status = EXIT_SUCCESS; unsigned long opt; @@ -34,7 +34,7 @@ int strings_main(int argc, char **argv) const char *fmt = "%s: "; char *n_arg = "4"; - opt = bb_getopt_ulflags(argc, argv, "afon:", &n_arg); + opt = bb_getopt_ulflags("afon:", &n_arg); /* -a is our default behaviour */ argc -= optind; Index: miscutils/eject.c =================================================================== --- miscutils/eject.c (revision 15566) +++ miscutils/eject.c (working copy) @@ -24,13 +24,13 @@ #define CDROMEJECT 0x5309 /* Ejects the cdrom media */ #define DEFAULT_CDROM "/dev/cdrom" -int eject_main(int argc, char **argv) +int eject_main(void) { unsigned long flags; char *device; struct mntent *m; - flags = bb_getopt_ulflags(argc, argv, "t"); + flags = bb_getopt_ulflags("t"); device = argv[optind] ? : DEFAULT_CDROM; if ((m = find_mount_point(device, bb_path_mtab_file))) { Index: miscutils/setsid.c =================================================================== --- miscutils/setsid.c (revision 15566) +++ miscutils/setsid.c (working copy) @@ -19,7 +19,7 @@ #include #include -int setsid_main(int argc, char *argv[]) +int setsid_main(void) { if (argc < 2) bb_show_usage(); Index: miscutils/runlevel.c =================================================================== --- miscutils/runlevel.c (revision 15566) +++ miscutils/runlevel.c (working copy) @@ -18,7 +18,7 @@ #include #include -int runlevel_main(int argc, char *argv[]) +int runlevel_main(void) { struct utmp *ut; char prev; Index: include/libbb.h =================================================================== --- include/libbb.h (revision 15566) +++ include/libbb.h (working copy) @@ -96,6 +96,9 @@ #endif #endif +/* global argc/argv */ +extern int argc; +extern char **argv; typedef struct llist_s { char *data; @@ -123,8 +126,8 @@ extern void bb_perror_nomsg(void); extern void bb_verror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0))); extern void bb_vperror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0))); -extern int bb_echo(int argc, char** argv); -extern int bb_test(int argc, char** argv); +extern int bb_echo(int aargc, char** aargv); +extern int bb_test(int aargc, char** aargv); extern const char *bb_mode_string(int mode); extern int is_directory(const char *name, int followLinks, struct stat *statBuf); @@ -175,8 +178,8 @@ extern void bb_fflush_stdout_and_exit(i extern void xstat(const char *filename, struct stat *buf); extern int bb_xsocket(int domain, int type, int protocol); -extern pid_t bb_spawn(char **argv); -extern pid_t bb_xspawn(char **argv); +extern pid_t bb_spawn(char **aargv); +extern pid_t bb_xspawn(char **aargv); extern int wait4pid(int pid); extern void bb_xdaemon(int nochdir, int noclose); extern void bb_xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); @@ -186,7 +189,7 @@ extern void bb_xchdir(const char *path); #define BB_GETOPT_ERROR 0x80000000UL extern const char *bb_opt_complementally; extern const struct option *bb_applet_long_options; -extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts, ...); +extern unsigned long bb_getopt_ulflags(const char *applet_opts, ...); extern int bb_vfprintf(FILE * __restrict stream, const char * __restrict format, va_list arg) __attribute__ ((format (printf, 2, 0))); @@ -511,8 +514,7 @@ extern void print_login_prompt(void); #ifdef BB_NOMMU extern void vfork_daemon(int nochdir, int noclose); -extern void vfork_daemon_rexec(int nochdir, int noclose, - int argc, char **argv, char *foreground_opt); +extern void vfork_daemon_rexec(int nochdir, int noclose, char *foreground_opt); #endif extern int get_terminal_width_height(int fd, int *width, int *height); Index: include/busybox.h =================================================================== --- include/busybox.h (revision 15566) +++ include/busybox.h (working copy) @@ -28,7 +28,7 @@ enum SUIDRoot { struct BB_applet { const char *name; - int (*main) (int argc, char **argv); + int (*main) (void); __extension__ enum Location location:4; __extension__ enum SUIDRoot need_suid:4; }; @@ -38,7 +38,7 @@ extern const struct BB_applet applets[]; /* Automagically pull in all the applet function prototypes and * applet usage strings. These are all of the form: - * extern int foo_main(int argc, char **argv); + * extern int foo_main(void); * extern const char foo_usage[]; * These are all autogenerated from the set of currently defined applets. */ Index: include/dump.h =================================================================== --- include/dump.h (revision 15566) +++ include/dump.h (working copy) @@ -39,7 +39,7 @@ typedef struct _fs { /* format strings } FS; extern void bb_dump_add(const char *fmt); -extern int bb_dump_dump (char **argv); +extern int bb_dump_dump (void); extern int bb_dump_size(FS * fs); extern FS *bb_dump_fshead; /* head of format strings */ Index: include/applets.h =================================================================== --- include/applets.h (revision 15566) +++ include/applets.h (working copy) @@ -16,9 +16,9 @@ #if defined(PROTOTYPES) -# define APPLET(a,b,c) extern int a##_main(int argc, char **argv); -# define APPLET_NOUSAGE(a,b,c,d) extern int b##_main(int argc, char **argv); -# define APPLET_ODDNAME(a,b,c,d,e) extern int b##_main(int argc, char **argv); +# define APPLET(a,b,c) extern int a##_main(void); +# define APPLET_NOUSAGE(a,b,c,d) extern int b##_main(void); +# define APPLET_ODDNAME(a,b,c,d,e) extern int b##_main(void); #elif defined(MAKE_USAGE) # ifdef CONFIG_FEATURE_VERBOSE_USAGE # define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0" Index: loginutils/vlock.c =================================================================== --- loginutils/vlock.c (revision 15566) +++ loginutils/vlock.c (working copy) @@ -53,7 +53,7 @@ static void restore_terminal(void) tcsetattr(STDIN_FILENO, TCSANOW, &oterm); } -int vlock_main(int argc, char **argv) +int vlock_main(void) { sigset_t sig; struct sigaction sa; @@ -64,7 +64,7 @@ int vlock_main(int argc, char **argv) bb_show_usage(); } - o_lock_all = bb_getopt_ulflags (argc, argv, "a"); + o_lock_all = bb_getopt_ulflags("a"); if((pw = getpwuid(getuid())) == NULL) { bb_error_msg_and_die("Unknown uid %d", getuid()); Index: loginutils/sulogin.c =================================================================== --- loginutils/sulogin.c (revision 15566) +++ loginutils/sulogin.c (working copy) @@ -45,7 +45,7 @@ static void catchalarm(int ATTRIBUTE_UNU } -int sulogin_main(int argc, char **argv) +int sulogin_main(void) { char *cp; char *device = (char *) 0; Index: loginutils/passwd.c =================================================================== --- loginutils/passwd.c (revision 15566) +++ loginutils/passwd.c (working copy) @@ -132,7 +132,7 @@ static int update_passwd(const struct pa } -int passwd_main(int argc, char **argv) +int passwd_main(void) { int amroot; char *cp; Index: loginutils/deluser.c =================================================================== --- loginutils/deluser.c (revision 15566) +++ loginutils/deluser.c (working copy) @@ -80,7 +80,7 @@ static void del_line_matching(const char } } -int deluser_main(int argc, char **argv) +int deluser_main(void) { if (argc != 2) { bb_show_usage(); Index: loginutils/addgroup.c =================================================================== --- loginutils/addgroup.c (revision 15566) +++ loginutils/addgroup.c (working copy) @@ -89,7 +89,7 @@ static int addgroup(char *group, gid_t g * * can be customized via command-line parameters. * ________________________________________________________________________ */ -int addgroup_main(int argc, char **argv) +int addgroup_main(void) { char *group; gid_t gid = 0; @@ -97,7 +97,7 @@ int addgroup_main(int argc, char **argv) /* check for min, max and missing args and exit on error */ bb_opt_complementally = "-1:?2:?"; - if (bb_getopt_ulflags(argc, argv, "g:", &group)) { + if (bb_getopt_ulflags("g:", &group)) { gid = bb_xgetlarg(group, 10, 0, LONG_MAX); } /* move past the commandline options */ Index: loginutils/adduser.c =================================================================== --- loginutils/adduser.c (revision 15566) +++ loginutils/adduser.c (working copy) @@ -166,7 +166,7 @@ static int adduser(struct passwd *p, uns * * can be customized via command-line parameters. * ________________________________________________________________________ */ -int adduser_main(int argc, char **argv) +int adduser_main(void) { struct passwd pw; const char *usegroup = NULL; @@ -178,7 +178,7 @@ int adduser_main(int argc, char **argv) /* check for min, max and missing args and exit on error */ bb_opt_complementally = "-1:?1:?"; - flags = bb_getopt_ulflags(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); + flags = bb_getopt_ulflags("h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); /* got root? */ if(geteuid()) { Index: loginutils/su.c =================================================================== --- loginutils/su.c (revision 15566) +++ loginutils/su.c (working copy) @@ -62,7 +62,7 @@ static void log_su (const char *successf #endif -int su_main ( int argc, char **argv ) +int su_main ( void) { unsigned long flags; char *opt_shell = 0; @@ -77,7 +77,7 @@ int su_main ( int argc, char **argv ) const char *old_user; #endif - flags = bb_getopt_ulflags(argc, argv, "mplc:s:", + flags = bb_getopt_ulflags("mplc:s:", &opt_command, &opt_shell); #define SU_OPT_m (3) #define SU_OPT_p (3) Index: loginutils/login.c =================================================================== --- loginutils/login.c (revision 15566) +++ loginutils/login.c (working copy) @@ -58,7 +58,7 @@ static void alarm_handler ( int sig ATTR } -int login_main(int argc, char **argv) +int login_main(void) { char tty[BUFSIZ]; char full_tty[200]; Index: loginutils/getty.c =================================================================== --- loginutils/getty.c (revision 15566) +++ loginutils/getty.c (working copy) @@ -311,11 +311,11 @@ static void parse_speeds(struct options /* parse-args - parse command-line arguments */ -static void parse_args(int argc, char **argv, struct options *op) +static void parse_args(struct options *op) { char *ts; - op->flags = bb_getopt_ulflags(argc, argv, opt_string, + op->flags = bb_getopt_ulflags(opt_string, &(op->initstring), &fakehost, &(op->issue), &(op->login), &ts); if(op->flags & F_INITSTRING) { @@ -836,7 +836,7 @@ static void update_utmp(char *line) #undef logname -int getty_main(int argc, char **argv) +int getty_main(void) { char *logname = NULL; /* login name, given to /bin/login */ struct chardata chardata; /* set by get_logname() */ @@ -870,7 +870,7 @@ int getty_main(int argc, char **argv) /* Parse command-line arguments. */ - parse_args(argc, argv, &options); + parse_args(&options); #ifdef __linux__ setsid(); Index: findutils/find.c =================================================================== --- findutils/find.c (revision 15566) +++ findutils/find.c (working copy) @@ -190,7 +190,7 @@ static int find_type(char *type) } #endif -int find_main(int argc, char **argv) +int find_main(void) { int dereference = FALSE; int i, firstopt, status = EXIT_SUCCESS; Index: findutils/xargs.c =================================================================== --- findutils/xargs.c (revision 15566) +++ findutils/xargs.c (working copy) @@ -405,7 +405,7 @@ static xlist_t *process0_stdin(xlist_t * #define OPT_NEXT_OTHER (1<<(5+OPT_INC_P+OPT_INC_X+OPT_INC_0)) */ -int xargs_main(int argc, char **argv) +int xargs_main(void) { char **args; int i, a, n; @@ -428,7 +428,7 @@ int xargs_main(int argc, char **argv) bb_opt_complementally = "pt"; #endif - opt = bb_getopt_ulflags(argc, argv, "+trn:s:e::" + opt = bb_getopt_ulflags("+trn:s:e::" #ifdef CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION "p" #endif Index: findutils/grep.c =================================================================== --- findutils/grep.c (revision 15566) +++ findutils/grep.c (working copy) @@ -280,7 +280,7 @@ static void load_regexes_from_file(llist } -int grep_main(int argc, char **argv) +int grep_main(void) { FILE *file; int matched; @@ -296,7 +296,7 @@ int grep_main(int argc, char **argv) char *Copt; bb_opt_complementally = "H-h:e::f::C-AB"; - opt = bb_getopt_ulflags(argc, argv, + opt = bb_getopt_ulflags( GREP_OPTS GREP_OPT_CONTEXT OPT_EGREP, &pattern_head, &fopt, &slines_after, &slines_before, &Copt); @@ -331,7 +331,7 @@ int grep_main(int argc, char **argv) #else /* with auto sanity checks */ bb_opt_complementally = "H-h:e::f::c-n:q-n:l-n"; - opt = bb_getopt_ulflags(argc, argv, GREP_OPTS OPT_EGREP, + opt = bb_getopt_ulflags(GREP_OPTS OPT_EGREP, &pattern_head, &fopt); #endif invert_search = (opt & GREP_OPT_v) != 0; /* 0 | 1 */ Index: init/init.c =================================================================== --- init/init.c (revision 15566) +++ init/init.c (working copy) @@ -368,19 +368,19 @@ static void console_init(void) messageD(LOG, "console=%s", console); } -static void fixup_argv(int argc, char **argv, char *new_argv0) +static void fixup_argv(int aargc, char **aargv, char *new_argv0) { int len; /* Fix up argv[0] to be certain we claim to be init */ - len = strlen(argv[0]); - memset(argv[0], 0, len); - safe_strncpy(argv[0], new_argv0, len + 1); + len = strlen(aargv[0]); + memset(aargv[0], 0, len); + safe_strncpy(aargv[0], new_argv0, len + 1); - /* Wipe argv[1]-argv[N] so they don't clutter the ps listing */ + /* Wipe aargv[1]-aargv[N] so they don't clutter the ps listing */ len = 1; - while (argc > len) { - memset(argv[len], 0, strlen(argv[len])); + while (aargc > len) { + memset(aargv[len], 0, strlen(aargv[len])); len++; } } @@ -1005,7 +1005,7 @@ static void reload_signal(int sig ATTRIB } #endif /* CONFIG_FEATURE_USE_INITTAB */ -int init_main(int argc, char **argv) +int init_main(void) { struct init_action *a; pid_t wpid; Index: init/halt.c =================================================================== --- init/halt.c (revision 15566) +++ init/halt.c (working copy) @@ -12,7 +12,7 @@ #include #include -int halt_main(int argc, char *argv[]) +int halt_main(void) { static const int magic[] = { #ifdef RB_HALT_SYSTEM @@ -36,7 +36,7 @@ RB_AUTOBOOT for(which=0;delay[which]!=*bb_applet_name;which++); /* Parse and handle arguments */ - flags = bb_getopt_ulflags(argc, argv, "d:nf", &delay); + flags = bb_getopt_ulflags("d:nf", &delay); if (flags&1) sleep(atoi(delay)); if (!(flags&2)) sync(); Index: init/mesg.c =================================================================== --- init/mesg.c (revision 15566) +++ init/mesg.c (working copy) @@ -17,7 +17,7 @@ #define S_IWGRP_OR_S_IWOTH (S_IWGRP | S_IWOTH) #endif -int mesg_main(int argc, char *argv[]) +int mesg_main(void) { struct stat sb; char *tty; Index: procps/free.c =================================================================== --- procps/free.c (revision 15566) +++ procps/free.c (working copy) @@ -14,7 +14,7 @@ #include #include -int free_main(int argc, char **argv) +int free_main(void) { struct sysinfo info; sysinfo(&info); Index: procps/pidof.c =================================================================== --- procps/pidof.c (revision 15566) +++ procps/pidof.c (working copy) @@ -41,7 +41,7 @@ #define omitted (0) #endif -int pidof_main(int argc, char **argv) +int pidof_main(void) { unsigned n = 0; unsigned fail = 1; @@ -52,7 +52,7 @@ int pidof_main(int argc, char **argv) #endif /* do unconditional option parsing */ - opt = bb_getopt_ulflags(argc, argv, + opt = bb_getopt_ulflags( _SINGLE_COMPL("s") _OMIT_COMPL("o:") _OMIT(&omits)); Index: procps/sysctl.c =================================================================== --- procps/sysctl.c (revision 15566) +++ procps/sysctl.c (working copy) @@ -65,7 +65,7 @@ static void dwrite_str(int fd, const cha /* * sysctl_main()... */ -int sysctl_main(int argc, char **argv) +int sysctl_main(void) { int retval = 0; int output = 1; Index: procps/ps.c =================================================================== --- procps/ps.c (revision 15566) +++ procps/ps.c (working copy) @@ -22,7 +22,7 @@ #include /* for is_selinux_enabled() */ #endif -int ps_main(int argc, char **argv) +int ps_main(void) { procps_status_t * p; int i, len; @@ -44,11 +44,11 @@ int ps_main(int argc, char **argv) #if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX /* handle arguments */ #if ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX - i = bb_getopt_ulflags(argc, argv, "wc", &w_count); + i = bb_getopt_ulflags("wc", &w_count); #elif ENABLE_FEATURE_PS_WIDE && !ENABLE_SELINUX - bb_getopt_ulflags(argc, argv, "w", &w_count); + bb_getopt_ulflags("w", &w_count); #else /* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */ - i = bb_getopt_ulflags(argc, argv, "c"); + i = bb_getopt_ulflags("c"); #endif #if ENABLE_FEATURE_PS_WIDE /* if w is given once, GNU ps sets the width to 132, Index: procps/top.c =================================================================== --- procps/top.c (revision 15566) +++ procps/top.c (working copy) @@ -393,7 +393,7 @@ static void sig_catcher(int sig ATTRIBUT #endif /* CONFIG_FEATURE_USE_TERMIOS */ -int top_main(int argc, char **argv) +int top_main(void) { int opt, interval, lines, col; char *sinterval; @@ -405,7 +405,7 @@ int top_main(int argc, char **argv) #endif /* CONFIG_FEATURE_USE_TERMIOS */ /* do normal option parsing */ - opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval); + opt = bb_getopt_ulflags("d:", &sinterval); if ((opt & 1)) { interval = atoi(sinterval); } else { Index: procps/uptime.c =================================================================== --- procps/uptime.c (revision 15566) +++ procps/uptime.c (working copy) @@ -29,7 +29,7 @@ #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) -int uptime_main(int argc, char **argv) +int uptime_main(void) { int updays, uphours, upminutes; struct sysinfo info; Index: procps/fuser.c =================================================================== --- procps/fuser.c (revision 15566) +++ procps/fuser.c (working copy) @@ -313,7 +313,7 @@ static int fuser_kill_pid_list(pid_list return success; } -int fuser_main(int argc, char **argv) +int fuser_main(void) { int port, i, optn; int* fni; /* file name indexes of argv */ Index: procps/renice.c =================================================================== --- procps/renice.c (revision 15566) +++ procps/renice.c (working copy) @@ -51,7 +51,7 @@ static inline int int_add_no_wrap(int a, return s; } -int renice_main(int argc, char **argv) +int renice_main(void) { static const char Xetpriority_msg[] = "%d : %cetpriority"; Index: procps/kill.c =================================================================== --- procps/kill.c (revision 15566) +++ procps/kill.c (working copy) @@ -21,7 +21,7 @@ #define KILL 0 #define KILLALL 1 -int kill_main(int argc, char **argv) +int kill_main(void) { int whichApp, signo = SIGTERM; const char *name; Index: applets/applets.c =================================================================== --- applets/applets.c (revision 15566) +++ applets/applets.c (working copy) @@ -470,17 +470,19 @@ struct BB_applet *find_applet_by_name (c applet_name_compare); } -void run_applet_by_name (const char *name, int argc, char **argv) +void run_applet_by_name (const char *name, int aargc, char **aargv) { + argc = aargc; + argv = aargv; if(ENABLE_FEATURE_SUID_CONFIG) parse_config_file (); - if(!strncmp(name, "busybox", 7)) busybox_main(argc, argv); + if(!strncmp(name, "busybox", 7)) busybox_main(); /* Do a binary search to find the applet entry given the name. */ applet_using = find_applet_by_name(name); if(applet_using) { bb_applet_name = applet_using->name; if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage (); if(ENABLE_FEATURE_SUID) check_suid (applet_using); - exit ((*(applet_using->main)) (argc, argv)); + exit ((*(applet_using->main)) ()); } } Index: applets/busybox.c =================================================================== --- applets/busybox.c (revision 15566) +++ applets/busybox.c (working copy) @@ -18,6 +18,10 @@ const char *bb_applet_name ATTRIBUTE_EXTERNALLY_VISIBLE; +/* global argc/argv */ +int argc; +char **argv; + #ifdef CONFIG_FEATURE_INSTALLER /* * directory table @@ -65,9 +69,11 @@ static void install_links(const char *bu #define install_links(x,y) #endif /* CONFIG_FEATURE_INSTALLER */ -int main(int argc, char **argv) +int main(int main_argc, char **main_argv) { const char *s; + argc = main_argc; + argv = main_argv; bb_applet_name=argv[0]; if (*bb_applet_name == '-') bb_applet_name++; @@ -82,7 +88,7 @@ int main(int argc, char **argv) bb_error_msg_and_die("applet not found"); } -int busybox_main(int argc, char **argv) +int busybox_main(void) { /* * This style of argument parsing doesn't scale well Index: editors/vi.c =================================================================== --- editors/vi.c (revision 15566) +++ editors/vi.c (working copy) @@ -276,7 +276,7 @@ static void write1(const char *out) fputs(out, stdout); } -int vi_main(int argc, char **argv) +int vi_main(void) { int c; RESERVE_CONFIG_BUFFER(STATUS_BUFFER, STATUS_BUFFER_LEN); Index: editors/patch.c =================================================================== --- editors/patch.c (revision 15566) +++ editors/patch.c (working copy) @@ -76,7 +76,7 @@ static int file_doesnt_exist(const char return(stat(filename, &statbuf)); } -int patch_main(int argc, char **argv) +int patch_main(void) { int patch_level = -1; char *patch_line; @@ -85,7 +85,7 @@ int patch_main(int argc, char **argv) { char *p, *i; - ret = bb_getopt_ulflags(argc, argv, "p:i:", &p, &i); + ret = bb_getopt_ulflags("p:i:", &p, &i); if (ret & 1) patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX); if (ret & 2) { Index: editors/awk.c =================================================================== --- editors/awk.c (revision 15566) +++ editors/awk.c (working copy) @@ -2613,7 +2613,7 @@ static rstream *next_input_file(void) return &rsm; } -int awk_main(int argc, char **argv) +int awk_main(void) { char *s, *s1; int i, j, c, flen; Index: editors/ed.c =================================================================== --- editors/ed.c (revision 15566) +++ editors/ed.c (working copy) @@ -48,7 +48,7 @@ static LINE *findLine(int num); static int findString(const LINE *lp, const char * str, int len, int offset); -int ed_main(int argc, char **argv) +int ed_main(void) { if (!initEdit()) return EXIT_FAILURE; Index: editors/sed.c =================================================================== --- editors/sed.c (revision 15566) +++ editors/sed.c (working copy) @@ -1096,7 +1096,7 @@ static void add_cmd_block(char *cmdstr) free(temp); } -int sed_main(int argc, char **argv) +int sed_main(void) { int status = EXIT_SUCCESS, opt, getpat = 1; Index: util-linux/ipcs.c =================================================================== --- util-linux/ipcs.c (revision 15566) +++ util-linux/ipcs.c (working copy) @@ -587,7 +587,7 @@ static void print_sem (int semid) return; } -int ipcs_main (int argc, char **argv) { +int ipcs_main (void) { int opt, msg = 0, sem = 0, shm = 0, id=0, print=0; char format = 0; char options[] = "atclupsmqi:ih?"; Index: util-linux/dmesg.c =================================================================== --- util-linux/dmesg.c (revision 15566) +++ util-linux/dmesg.c (working copy) @@ -11,10 +11,10 @@ #include #include -int dmesg_main(int argc, char *argv[]) +int dmesg_main(void) { char *size, *level; - int flags = bb_getopt_ulflags(argc, argv, "c:s:n:", &size, &level); + int flags = bb_getopt_ulflags("c:s:n:", &size, &level); if (flags & 4) { if(klogctl(8, NULL, bb_xgetlarg(size, 10, 0, 10))) Index: util-linux/rdate.c =================================================================== --- util-linux/rdate.c (revision 15566) +++ util-linux/rdate.c (working copy) @@ -58,13 +58,13 @@ static time_t askremotedate(const char * return(ntohl(nett) - RFC_868_BIAS); } -int rdate_main(int argc, char **argv) +int rdate_main(void) { time_t remote_time; unsigned long flags; bb_opt_complementally = "-1"; - flags = bb_getopt_ulflags(argc, argv, "sp"); + flags = bb_getopt_ulflags("sp"); remote_time = askremotedate(argv[optind]); Index: util-linux/fdisk.c =================================================================== --- util-linux/fdisk.c (revision 15566) +++ util-linux/fdisk.c (working copy) @@ -5665,7 +5665,7 @@ unknown_command(int c) } #endif -int fdisk_main(int argc, char **argv) +int fdisk_main(void) { int c; #ifdef CONFIG_FEATURE_FDISK_WRITABLE Index: util-linux/getopt.c =================================================================== --- util-linux/getopt.c (revision 15566) +++ util-linux/getopt.c (working copy) @@ -60,8 +60,7 @@ static int alternative; /* 0 is getopt_l /* Function prototypes */ static const char *normalize(const char *arg); -static int generate_output(char * argv[],int argc,const char *optstr, - const struct option *longopts); +static int generate_output(const char *optstr, const struct option *longopts); static void add_long_options(char *options); static void add_longopt(const char *name,int has_arg); static void set_shell(const char *new_shell); @@ -138,8 +137,7 @@ const char *normalize(const char *arg) * optstr must contain the short options, and longopts the long options. * Other settings are found in global variables. */ -int generate_output(char * argv[],int argc,const char *optstr, - const struct option *longopts) +int generate_output(const char *optstr, const struct option *longopts) { int exit_code = 0; /* We assume everything will be OK */ int opt; @@ -293,7 +291,7 @@ static const struct option longopts[]= static const char shortopts[]="+ao:l:n:qQs:Tu"; -int getopt_main(int argc, char *argv[]) +int getopt_main(void) { const char *optstr = NULL; char *name = NULL; @@ -322,7 +320,8 @@ int getopt_main(int argc, char *argv[]) s=xmalloc(strlen(argv[1])+1); strcpy(s,argv[1]+strspn(argv[1],"-+")); argv[1]=argv[0]; - return (generate_output(argv+1,argc-1,s,long_options)); + argc -= 1; argv += 1; + return (generate_output(s,long_options)); } while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) @@ -366,5 +365,7 @@ int getopt_main(int argc, char *argv[]) argv[optind-1]=name; else argv[optind-1]=argv[0]; - return (generate_output(argv+optind-1,argc-optind+1,optstr,long_options)); + argc -= optind + 1; + argv += optind - 1; + return generate_output(optstr,long_options); } Index: util-linux/fdformat.c =================================================================== --- util-linux/fdformat.c (revision 15566) +++ util-linux/fdformat.c (working copy) @@ -69,7 +69,7 @@ static void bb_xioctl(int fd, int reques } } -int fdformat_main(int argc,char **argv) +int fdformat_main(void) { int fd, n, cyl, read_bytes, verify; unsigned char *data; @@ -80,7 +80,7 @@ int fdformat_main(int argc,char **argv) if (argc < 2) { bb_show_usage(); } - verify = !bb_getopt_ulflags(argc, argv, "n"); + verify = !bb_getopt_ulflags("n"); argv += optind; /* R_OK is needed for verifying */ Index: util-linux/mkswap.c =================================================================== --- util-linux/mkswap.c (revision 15566) +++ util-linux/mkswap.c (working copy) @@ -258,7 +258,7 @@ static inline long get_size(const char * return size; } -int mkswap_main(int argc, char **argv) +int mkswap_main(void) { char *tmp; struct stat statbuf; @@ -272,7 +272,7 @@ int mkswap_main(int argc, char **argv) init_signature_page(); /* get pagesize */ bb_opt_complementally = "?"; /* call bb_show_usage internally */ - sz = bb_getopt_ulflags(argc, argv, "+cfv:", &tmp); + sz = bb_getopt_ulflags("+cfv:", &tmp); if (sz & 1) check = 1; #ifdef __sparc__ Index: util-linux/more.c =================================================================== --- util-linux/more.c (revision 15566) +++ util-linux/more.c (working copy) @@ -57,7 +57,7 @@ static void gotsig(int sig) #endif /* CONFIG_FEATURE_USE_TERMIOS */ -int more_main(int argc, char **argv) +int more_main(void) { int c, lines, input = 0; int please_display_more_prompt = 0; Index: util-linux/mount.c =================================================================== --- util-linux/mount.c (revision 15566) +++ util-linux/mount.c (working copy) @@ -365,7 +365,7 @@ report_error: // Parse options, if necessary parse fstab/mtab, and call singlemount for // each directory to be mounted. -int mount_main(int argc, char **argv) +int mount_main(void) { char *cmdopts = bb_xstrdup(""), *fstabname, *fstype=0, *storage_path=0; FILE *fstab; Index: util-linux/swaponoff.c =================================================================== --- util-linux/swaponoff.c (revision 15566) +++ util-linux/swaponoff.c (working copy) @@ -62,14 +62,14 @@ static int do_em_all(void) #define DO_ALL 0x01 -int swap_on_off_main(int argc, char **argv) +int swap_on_off_main(void) { int ret; if (argc == 1) bb_show_usage(); - ret = bb_getopt_ulflags(argc, argv, "a"); + ret = bb_getopt_ulflags("a"); if (ret & DO_ALL) return do_em_all(); Index: util-linux/fbset.c =================================================================== --- util-linux/fbset.c (revision 15566) +++ util-linux/fbset.c (working copy) @@ -324,7 +324,7 @@ static inline void showmode(struct fb_va #ifdef STANDALONE int main(int argc, char **argv) #else -int fbset_main(int argc, char **argv) +int fbset_main(void) #endif { struct fb_var_screeninfo var, varset; Index: util-linux/mkfs_minix.c =================================================================== --- util-linux/mkfs_minix.c (revision 15566) +++ util-linux/mkfs_minix.c (working copy) @@ -690,7 +690,7 @@ static void get_list_blocks(char *filena printf("one bad block\n"); } -int mkfs_minix_main(int argc, char **argv) +int mkfs_minix_main(void) { int i=1; char *tmp; Index: util-linux/pivot_root.c =================================================================== --- util-linux/pivot_root.c (revision 15566) +++ util-linux/pivot_root.c (working copy) @@ -15,7 +15,7 @@ extern int pivot_root(const char * new_root,const char * put_old); -int pivot_root_main(int argc, char **argv) +int pivot_root_main(void) { if (argc != 3) bb_show_usage(); Index: util-linux/switch_root.c =================================================================== --- util-linux/switch_root.c (revision 15566) +++ util-linux/switch_root.c (working copy) @@ -66,7 +66,7 @@ static void delete_contents(char *direct } else unlink(directory); } -int switch_root_main(int argc, char *argv[]) +int switch_root_main(void) { char *newroot, *console=NULL; struct stat st1, st2; @@ -75,7 +75,7 @@ int switch_root_main(int argc, char *arg // Parse args (-c console) bb_opt_complementally="-2"; - bb_getopt_ulflags(argc,argv,"c:",&console); + bb_getopt_ulflags("c:",&console); // Change to new root directory and verify it's a different fs. Index: util-linux/ipcrm.c =================================================================== --- util-linux/ipcrm.c (revision 15566) +++ util-linux/ipcrm.c (working copy) @@ -69,7 +69,8 @@ typedef enum type_id { } type_id; static int -remove_ids(type_id type, int argc, char **argv) { +remove_ids(type_id type) +{ int id; int ret = 0; /* for gcc */ char *end; @@ -113,7 +114,7 @@ remove_ids(type_id type, int argc, char return(nb_errors); } -static int deprecated_main(int argc, char **argv) +static int deprecated_main(void) { if (argc < 3) { bb_show_usage(); @@ -121,15 +122,18 @@ static int deprecated_main(int argc, cha } if (!strcmp(argv[1], "shm")) { - if (remove_ids(SHM, argc-2, &argv[2])) + argc += 2; argv += 2; + if (remove_ids(SHM)) bb_fflush_stdout_and_exit(1); } else if (!strcmp(argv[1], "msg")) { - if (remove_ids(MSG, argc-2, &argv[2])) + argc += 2; argv += 2; + if (remove_ids(MSG)) bb_fflush_stdout_and_exit(1); } else if (!strcmp(argv[1], "sem")) { - if (remove_ids(SEM, argc-2, &argv[2])) + argc += 2; argv += 2; + if (remove_ids(SEM)) bb_fflush_stdout_and_exit(1); } else { @@ -143,7 +147,7 @@ static int deprecated_main(int argc, cha } -int ipcrm_main(int argc, char **argv) +int ipcrm_main(void) { int c; int error = 0; @@ -158,7 +162,7 @@ int ipcrm_main(int argc, char **argv) if (strcmp(argv[1], "shm") == 0 || strcmp(argv[1], "msg") == 0 || strcmp(argv[1], "sem") == 0) - return deprecated_main(argc, argv); + return deprecated_main(); /* process new syntax to conform with SYSV ipcrm */ while ((c = getopt(argc, argv, "q:m:s:Q:M:S:h?")) != -1) { Index: util-linux/hexdump.c =================================================================== --- util-linux/hexdump.c (revision 15566) +++ util-linux/hexdump.c (working copy) @@ -51,7 +51,7 @@ static const struct suffix_mult suffixes {NULL, 0 } }; -int hexdump_main(int argc, char **argv) +int hexdump_main(void) { // register FS *tfs; const char *p; @@ -99,5 +99,5 @@ int hexdump_main(int argc, char **argv) argv += optind; - return(bb_dump_dump(argv)); + return(bb_dump_dump()); } Index: util-linux/umount.c =================================================================== --- util-linux/umount.c (revision 15566) +++ util-linux/umount.c (working copy) @@ -26,7 +26,7 @@ #define OPT_IGNORED 32 // -v is ignored #define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? 64 : 0) -int umount_main(int argc, char **argv) +int umount_main(void) { int doForce; char path[2*PATH_MAX]; @@ -42,7 +42,7 @@ int umount_main(int argc, char **argv) /* Parse any options */ - opt = bb_getopt_ulflags(argc, argv, OPTION_STRING); + opt = bb_getopt_ulflags(OPTION_STRING); argc -= optind; argv += optind; Index: util-linux/setarch.c =================================================================== --- util-linux/setarch.c (revision 15566) +++ util-linux/setarch.c (working copy) @@ -16,7 +16,7 @@ #include "busybox.h" -int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv) +int setarch_main(void) { int pers = -1; Index: util-linux/hwclock.c =================================================================== --- util-linux/hwclock.c (revision 15566) +++ util-linux/hwclock.c (working copy) @@ -180,7 +180,7 @@ static int check_utc(void) #define HWCLOCK_OPT_HCTOSYS 0x08 #define HWCLOCK_OPT_SYSTOHC 0x10 -int hwclock_main ( int argc, char **argv ) +int hwclock_main ( void) { unsigned long opt; int utc; @@ -198,7 +198,7 @@ static const struct option hwclock_long_ #endif bb_opt_complementally = "?:r--ws:w--rs:s--wr:l--u:u--l"; - opt = bb_getopt_ulflags(argc, argv, "lursw"); + opt = bb_getopt_ulflags("lursw"); /* If -u or -l wasn't given check if we are using utc */ if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) Index: util-linux/fsck_minix.c =================================================================== --- util-linux/fsck_minix.c (revision 15566) +++ util-linux/fsck_minix.c (working copy) @@ -1275,7 +1275,7 @@ static void check2(void) } #endif -int fsck_minix_main(int argc, char **argv) +int fsck_minix_main(void) { struct termios tmp; int retcode = 0; Index: util-linux/mdev.c =================================================================== --- util-linux/mdev.c (revision 15566) +++ util-linux/mdev.c (working copy) @@ -225,7 +225,7 @@ static void find_dev(char *path) closedir(dir); } -int mdev_main(int argc, char *argv[]) +int mdev_main(void) { char *action; char *env_path; Index: util-linux/losetup.c =================================================================== --- util-linux/losetup.c (revision 15566) +++ util-linux/losetup.c (working copy) @@ -11,7 +11,7 @@ #include "busybox.h" -int losetup_main (int argc, char **argv) +int losetup_main (void) { int offset = 0; Index: util-linux/freeramdisk.c =================================================================== --- util-linux/freeramdisk.c (revision 15566) +++ util-linux/freeramdisk.c (working copy) @@ -21,7 +21,7 @@ /* From */ #define FDFLUSH _IO(2,0x4b) -int freeramdisk_main(int argc, char **argv) +int freeramdisk_main(void) { int result; int fd; Index: util-linux/readprofile.c =================================================================== --- util-linux/readprofile.c (revision 15566) +++ util-linux/readprofile.c (working copy) @@ -61,7 +61,7 @@ static const char defaultmap[]="/boot/System.map"; static const char defaultpro[]="/proc/profile"; -int readprofile_main(int argc, char **argv) +int readprofile_main(void) { FILE *map; int proFd;