summaryrefslogtreecommitdiff
path: root/networking/ping.c
diff options
context:
space:
mode:
authorMark Whitley2001-01-23 22:30:04 +0000
committerMark Whitley2001-01-23 22:30:04 +0000
commit59ab025363d884deb2013dcaae6c968585a6ec72 (patch)
tree852d97bdc34c44dbcf29cc8b5cd9257a8c90f7b3 /networking/ping.c
parent2b8d07c590249991fae975652aae86f5fca91f81 (diff)
downloadbusybox-59ab025363d884deb2013dcaae6c968585a6ec72.zip
busybox-59ab025363d884deb2013dcaae6c968585a6ec72.tar.gz
#define -> static const int. Also got rid of some big static buffers.
Diffstat (limited to 'networking/ping.c')
-rw-r--r--networking/ping.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 8276dda..f5769b7 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $
+ * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -58,7 +58,7 @@
#if ! defined __GLIBC__ && ! defined __UCLIBC__
typedef unsigned int socklen_t;
-#define ICMP_MINLEN 8 /* abs minimum */
+static const int ICMP_MINLEN = 8; /* abs minimum */
struct icmp_ra_addr
{
@@ -134,13 +134,13 @@ struct icmp
};
#endif
-#define DEFDATALEN 56
-#define MAXIPLEN 60
-#define MAXICMPLEN 76
-#define MAXPACKET 65468
+static const int DEFDATALEN = 56;
+static const int MAXIPLEN = 60;
+static const int MAXICMPLEN = 76;
+static const int MAXPACKET = 65468;
#define MAX_DUP_CHK (8 * 128)
-#define MAXWAIT 10
-#define PINGINTERVAL 1 /* second */
+static const int MAXWAIT = 10;
+static const int PINGINTERVAL = 1; /* second */
#define O_QUIET (1 << 0)
@@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv)
static char *hostname = NULL;
static struct sockaddr_in pingaddr;
static int pingsock = -1;
-static int datalen = DEFDATALEN;
+static int datalen; /* intentionally uninitialized to work around gcc bug */
static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0;
static int myid = 0, options = 0;
@@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv)
{
char *thisarg;
+ datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
+
argc--;
argv++;
options = 0;