Fix kbuild bugs noticed by Bernhard Fischer <rep.nop@aon.at>
[oweals/busybox.git] / networking / ping.c
index a81472f9672bf3ffeb4c7b7bb10443c3a29250c9..782b801c80d3f10cd7f082ac742ec3c5b431aded 100644 (file)
@@ -157,9 +157,9 @@ int ping_main(int argc, char **argv)
 static struct sockaddr_in pingaddr;
 static struct sockaddr_in sourceaddr;
 static int pingsock = -1;
-static int datalen; /* intentionally uninitialized to work around gcc bug */
+static unsigned datalen; /* intentionally uninitialized to work around gcc bug */
 
-static long ntransmitted, nreceived, nrepeats, pingcount;
+static unsigned long ntransmitted, nreceived, nrepeats, pingcount;
 static int myid, options;
 static unsigned long tmin = ULONG_MAX, tmax, tsum;
 static char rcvd_tbl[MAX_DUP_CHK / 8];
@@ -179,12 +179,12 @@ static void pingstats(int junk)
        signal(SIGINT, SIG_IGN);
 
        printf("\n--- %s ping statistics ---\n", hostent->h_name);
-       printf("%ld packets transmitted, ", ntransmitted);
-       printf("%ld packets received, ", nreceived);
+       printf("%lu packets transmitted, ", ntransmitted);
+       printf("%lu packets received, ", nreceived);
        if (nrepeats)
-               printf("%ld duplicates, ", nrepeats);
+               printf("%lu duplicates, ", nrepeats);
        if (ntransmitted)
-               printf("%ld%% packet loss\n",
+               printf("%lu%% packet loss\n",
                           (ntransmitted - nreceived) * 100 / ntransmitted);
        if (nreceived)
                printf("round-trip min/avg/max = %lu.%lu/%lu.%lu/%lu.%lu ms\n",
@@ -314,10 +314,10 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
                printf(" time=%lu.%lu ms", triptime / 10, triptime % 10);
                if (dupflag)
                        printf(" (DUP!)");
-               printf("\n");
+               puts("");
        } else
                if (icmppkt->icmp_type != ICMP_ECHO)
-                       bb_error_msg("Warning: Got ICMP %d (%s)",
+                       bb_error_msg("warning: got ICMP %d (%s)",
                                        icmppkt->icmp_type, icmp_type_name(icmppkt->icmp_type));
        fflush(stdout);
 }
@@ -427,13 +427,13 @@ int ping_main(int argc, char **argv)
                        if (--argc <= 0)
                                bb_show_usage();
                        argv++;
-                       pingcount = atoi(*argv);
+                       pingcount = xatoul(*argv);
                        break;
                case 's':
                        if (--argc <= 0)
                                bb_show_usage();
                        argv++;
-                       datalen = atoi(*argv);
+                       datalen = xatou16(*argv);
                        break;
                case 'I':
                        if (--argc <= 0)