wget: add TODO
[oweals/busybox.git] / networking / arping.c
index c63ec91af1f27c8d1cdeca2b42ed98e5d7bfcd4b..e4c9b86a9df90aff76fa59acfa491f3aa4df70a5 100644 (file)
@@ -41,8 +41,8 @@ enum cfg_e {
 static int cfg;
 
 static int s;
-static int count = -1;
-static int timeout;
+static unsigned count = UINT_MAX;
+static unsigned timeout;
 static int sent;
 static int brd_sent;
 static int received;
@@ -265,20 +265,20 @@ int arping_main(int argc, char **argv)
        xsetuid(getuid());
 
        {
-               unsigned long opt;
+               unsigned opt;
                char *_count, *_timeout;
 
                /* Dad also sets quit_on_reply.
                 * Advert also sets unsolicited.
                 */
-               bb_opt_complementally = "Df:AU";
-               opt = bb_getopt_ulflags(argc, argv, "DUAqfbc:w:i:s:",
+               opt_complementary = "Df:AU";
+               opt = getopt32(argc, argv, "DUAqfbc:w:i:s:",
                                        &_count, &_timeout, &device, &source);
                cfg |= opt & 0x3f; /* set respective flags */
                if (opt & 0x40) /* -c: count */
-                       count = atoi(_count);
+                       count = xatou(_count);
                if (opt & 0x80) /* -w: timeout */
-                       timeout = atoi(_timeout);
+                       timeout = xatoul_range(_timeout, 0, INT_MAX/2000);
                if (opt & 0x100) { /* -i: interface */
                        if (strlen(device) > IF_NAMESIZE) {
                                bb_error_msg_and_die("interface name '%s' is too long",
@@ -295,7 +295,7 @@ int arping_main(int argc, char **argv)
 
        target = *argv;
 
-       bb_default_error_retval = 2;
+       xfunc_error_retval = 2;
 
        {
                struct ifreq ifr;
@@ -392,7 +392,7 @@ int arping_main(int argc, char **argv)
                }
        }
        if (me.sll_halen == 0) {
-               bb_error_msg("Interface \"%s\" is not ARPable (no ll address)", device);
+               bb_error_msg("interface \"%s\" is not ARPable (no ll address)", device);
                exit(cfg&dad ? 0 : 2);
        }
        he = me;