diff options
Diffstat (limited to 'ping.c')
-rw-r--r-- | ping.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $ | 3 | * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -58,7 +58,7 @@ | |||
58 | #if ! defined __GLIBC__ && ! defined __UCLIBC__ | 58 | #if ! defined __GLIBC__ && ! defined __UCLIBC__ |
59 | typedef unsigned int socklen_t; | 59 | typedef unsigned int socklen_t; |
60 | 60 | ||
61 | #define ICMP_MINLEN 8 /* abs minimum */ | 61 | static const int ICMP_MINLEN = 8; /* abs minimum */ |
62 | 62 | ||
63 | struct icmp_ra_addr | 63 | struct icmp_ra_addr |
64 | { | 64 | { |
@@ -134,13 +134,13 @@ struct icmp | |||
134 | }; | 134 | }; |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #define DEFDATALEN 56 | 137 | static const int DEFDATALEN = 56; |
138 | #define MAXIPLEN 60 | 138 | static const int MAXIPLEN = 60; |
139 | #define MAXICMPLEN 76 | 139 | static const int MAXICMPLEN = 76; |
140 | #define MAXPACKET 65468 | 140 | static const int MAXPACKET = 65468; |
141 | #define MAX_DUP_CHK (8 * 128) | 141 | #define MAX_DUP_CHK (8 * 128) |
142 | #define MAXWAIT 10 | 142 | static const int MAXWAIT = 10; |
143 | #define PINGINTERVAL 1 /* second */ | 143 | static const int PINGINTERVAL = 1; /* second */ |
144 | 144 | ||
145 | #define O_QUIET (1 << 0) | 145 | #define O_QUIET (1 << 0) |
146 | 146 | ||
@@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv) | |||
262 | static char *hostname = NULL; | 262 | static char *hostname = NULL; |
263 | static struct sockaddr_in pingaddr; | 263 | static struct sockaddr_in pingaddr; |
264 | static int pingsock = -1; | 264 | static int pingsock = -1; |
265 | static int datalen = DEFDATALEN; | 265 | static int datalen; /* intentionally uninitialized to work around gcc bug */ |
266 | 266 | ||
267 | static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; | 267 | static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; |
268 | static int myid = 0, options = 0; | 268 | static int myid = 0, options = 0; |
@@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv) | |||
508 | { | 508 | { |
509 | char *thisarg; | 509 | char *thisarg; |
510 | 510 | ||
511 | datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */ | ||
512 | |||
511 | argc--; | 513 | argc--; |
512 | argv++; | 514 | argv++; |
513 | options = 0; | 515 | options = 0; |