summaryrefslogtreecommitdiffhomepage
path: root/networking
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2001-01-23 22:30:04 +0000
committerMark Whitley <markw@lineo.com>2001-01-23 22:30:04 +0000
commit59ab025363d884deb2013dcaae6c968585a6ec72 (patch)
tree852d97bdc34c44dbcf29cc8b5cd9257a8c90f7b3 /networking
parent2b8d07c590249991fae975652aae86f5fca91f81 (diff)
#define -> static const int. Also got rid of some big static buffers.
Diffstat (limited to 'networking')
-rw-r--r--networking/ping.c20
-rw-r--r--networking/telnet.c28
-rw-r--r--networking/wget.c4
3 files changed, 28 insertions, 24 deletions
diff --git a/networking/ping.c b/networking/ping.c
index 8276dda4b..f5769b74e 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;
diff --git a/networking/telnet.c b/networking/telnet.c
index 76956e9ac..ac6813e29 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -50,7 +50,7 @@
#include <netdb.h>
#if 0
-#define DOTRACE 1
+static const int DOTRACE = 1;
#endif
#ifdef DOTRACE
@@ -67,21 +67,23 @@
#include <sys/time.h>
#endif
-#define DATABUFSIZE 128
-#define IACBUFSIZE 128
+static const int DATABUFSIZE = 128;
+static const int IACBUFSIZE = 128;
-#define CHM_TRY 0
-#define CHM_ON 1
-#define CHM_OFF 2
+static const int CHM_TRY = 0;
+static const int CHM_ON = 1;
+static const int CHM_OFF = 2;
-#define UF_ECHO 0x01
-#define UF_SGA 0x02
+static const int UF_ECHO = 0x01;
+static const int UF_SGA = 0x02;
-#define TS_0 1
-#define TS_IAC 2
-#define TS_OPT 3
-#define TS_SUB1 4
-#define TS_SUB2 5
+enum {
+ TS_0 = 1,
+ TS_IAC = 2,
+ TS_OPT = 3,
+ TS_SUB1 = 4,
+ TS_SUB2 = 5,
+};
#define WriteCS(fd, str) write(fd, str, sizeof str -1)
diff --git a/networking/wget.c b/networking/wget.c
index a5c3e7baf..e3e6eed79 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -49,7 +49,7 @@ static char *curfile; /* Name of current file being transferred. */
static struct timeval start; /* Time a transfer started. */
volatile unsigned long statbytes; /* Number of bytes transferred so far. */
/* For progressmeter() -- number of seconds before xfer considered "stalled" */
-#define STALLTIME 5
+static const int STALLTIME = 5;
#endif
int wget_main(int argc, char **argv)
@@ -515,7 +515,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.17 2001/01/22 22:48:42 andersen Exp $
+ * $Id: wget.c,v 1.18 2001/01/23 22:30:04 markw Exp $
*/