httpd: reduce ifdef forest. comment out redundant PATH setting
[oweals/busybox.git] / networking / ping6.c
index 267109c9f0e486815f87376e4ed24ba7c2f72f25..af9c00e22019005fe31090a1055c0d279b62555d 100644 (file)
@@ -145,10 +145,10 @@ int ping6_main(int argc, char **argv)
 /* full(er) version */
 static struct sockaddr_in6 pingaddr;
 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 int if_index;
 
-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];
@@ -168,12 +168,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",
@@ -198,7 +198,7 @@ static void sendping(int junk)
        pkt->icmp6_type = ICMP6_ECHO_REQUEST;
        pkt->icmp6_code = 0;
        pkt->icmp6_cksum = 0;
-       pkt->icmp6_seq = SWAP_BE16(ntransmitted++);
+       pkt->icmp6_seq = htons(ntransmitted++);
        pkt->icmp6_id = myid;
        CLR(pkt->icmp6_seq % MAX_DUP_CHK);
 
@@ -234,7 +234,7 @@ static void sendping(int junk)
 #ifndef MLD_LISTENER_REDUCTION
 # define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
 #endif
-static char *icmp6_type_name (int id)
+static char *icmp6_type_name(int id)
 {
        switch (id) {
        case ICMP6_DST_UNREACH:                         return "Destination Unreachable";
@@ -305,11 +305,11 @@ static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit
                           triptime / 10, triptime % 10);
                if (dupflag)
                        printf(" (DUP!)");
-               printf("\n");
+               puts("");
        } else
                if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST)
-                       bb_error_msg("Warning: Got ICMP %d (%s)",
-                                       icmppkt->icmp6_type, icmp6_type_name (icmppkt->icmp6_type));
+                       bb_error_msg("warning: got ICMP %d (%s)",
+                                       icmppkt->icmp6_type, icmp6_type_name(icmppkt->icmp6_type));
 }
 
 static void ping(const char *host)
@@ -329,7 +329,7 @@ static void ping(const char *host)
        pingaddr.sin6_family = AF_INET6;
        hostent = xgethostbyname2(host, AF_INET6);
        if (hostent->h_addrtype != AF_INET6)
-               bb_error_msg_and_die("unknown address type; only AF_INET6 is currently supported.");
+               bb_error_msg_and_die("unknown address type; only AF_INET6 is currently supported");
 
        memcpy(&pingaddr.sin6_addr, hostent->h_addr, sizeof(pingaddr.sin6_addr));
 
@@ -370,7 +370,7 @@ static void ping(const char *host)
                pingaddr.sin6_scope_id = if_index;
 
        printf("PING %s (%s): %d data bytes\n",
-                  hostent->h_name,
+                  hostent->h_name,
                   inet_ntop(AF_INET6, &pingaddr.sin6_addr,
                        buf, sizeof(buf)),
                   datalen);
@@ -439,13 +439,13 @@ int ping6_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)