From bc68cd14ccaebc17e7e03a08e51fddfb91007624 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 10 Mar 2006 19:22:06 +0000 Subject: Patch from Denis Vlasenko turning static const int (which gets emitted into the busybox binary) into enums (which don't). --- networking/dnsd.c | 16 +++++++++------- networking/fakeidentd.c | 2 +- networking/ping.c | 16 +++++++++------- networking/ping6.c | 16 +++++++++------- networking/telnet.c | 14 +++++++------- networking/zcip.c | 24 +++++++++++++----------- 6 files changed, 48 insertions(+), 40 deletions(-) (limited to 'networking') diff --git a/networking/dnsd.c b/networking/dnsd.c index 433b12443..9ca4105d3 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -27,11 +27,12 @@ static char *fileconf = "/etc/dnsd.conf"; #define LOCK_FILE "/var/run/dnsd.lock" #define LOG_FILE "/var/log/dnsd.log" -#define MAX_HOST_LEN 16 // longest host name allowed is 15 -#define IP_STRING_LEN 18 // .xxx.xxx.xxx.xxx\0 +enum { + MAX_HOST_LEN = 16, // longest host name allowed is 15 + IP_STRING_LEN = 18, // .xxx.xxx.xxx.xxx\0 //must be strlen('.in-addr.arpa') larger than IP_STRING_LEN -static const int MAX_NAME_LEN = (IP_STRING_LEN + 13); + MAX_NAME_LEN = (IP_STRING_LEN + 13), /* Cannot get bigger packets than 512 per RFC1035 In practice this can be set considerably smaller: @@ -39,12 +40,13 @@ static const int MAX_NAME_LEN = (IP_STRING_LEN + 13); ttl(4B) + rlen(2B) + r (MAX_NAME_LEN =21B) + 2*querystring (2 MAX_NAME_LEN= 42B), all together 90 Byte */ -static const int MAX_PACK_LEN = 512 + 1; + MAX_PACK_LEN = 512 + 1, -#define DEFAULT_TTL 30; // increase this when not testing? + DEFAULT_TTL = 30, // increase this when not testing? -static const int REQ_A = 1; -static const int REQ_PTR = 12; + REQ_A = 1, + REQ_PTR = 12 +}; struct dns_repl { // resource record, add 0 or 1 to accepted dns_msg in resp uint16_t rlen; diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index c7fb42fc4..5442c22c2 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c @@ -51,7 +51,7 @@ #define MAXIDLETIME 45 static const char ident_substr[] = " : USERID : UNIX : "; -static const int ident_substr_len = sizeof(ident_substr) - 1; +enum { ident_substr_len = sizeof(ident_substr) - 1 }; #define PIDFILE "/var/run/identd.pid" /* diff --git a/networking/ping.c b/networking/ping.c index 47b9f8f52..ecfd125ae 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -33,13 +33,15 @@ #include "busybox.h" -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) -static const int MAXWAIT = 10; -static const int PINGINTERVAL = 1; /* second */ +enum { + DEFDATALEN = 56, + MAXIPLEN = 60, + MAXICMPLEN = 76, + MAXPACKET = 65468, + MAX_DUP_CHK = (8 * 128), + MAXWAIT = 10, + PINGINTERVAL = 1 /* second */ +}; #define O_QUIET (1 << 0) diff --git a/networking/ping6.c b/networking/ping6.c index 42cf2785c..72d1d667a 100644 --- a/networking/ping6.c +++ b/networking/ping6.c @@ -56,13 +56,15 @@ #include /* offsetof */ #include "busybox.h" -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) -static const int MAXWAIT = 10; -static const int PINGINTERVAL = 1; /* second */ +enum { + DEFDATALEN = 56, + MAXIPLEN = 60, + MAXICMPLEN = 76, + MAXPACKET = 65468, + MAX_DUP_CHK = (8 * 128), + MAXWAIT = 10, + PINGINTERVAL = 1 /* second */ +}; #define O_QUIET (1 << 0) #define O_VERBOSE (1 << 1) diff --git a/networking/telnet.c b/networking/telnet.c index ca4896bf0..2ad44d429 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -35,7 +35,7 @@ #include "busybox.h" #if 0 -static const int DOTRACE = 1; +enum { DOTRACE = 1 }; #endif #ifdef DOTRACE @@ -55,14 +55,14 @@ static const int DOTRACE = 1; #define DATABUFSIZE 128 #define IACBUFSIZE 128 -static const int CHM_TRY = 0; -static const int CHM_ON = 1; -static const int CHM_OFF = 2; +enum { + CHM_TRY = 0, + CHM_ON = 1, + CHM_OFF = 2, -static const int UF_ECHO = 0x01; -static const int UF_SGA = 0x02; + UF_ECHO = 0x01, + UF_SGA = 0x02, -enum { TS_0 = 1, TS_IAC = 2, TS_OPT = 3, diff --git a/networking/zcip.c b/networking/zcip.c index 11b2db526..716c4a5e1 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -62,20 +62,22 @@ struct arp_packet { struct in_addr target_ip; } ATTRIBUTE_PACKED; +enum { /* 169.254.0.0 */ -static const uint32_t LINKLOCAL_ADDR = 0xa9fe0000; + LINKLOCAL_ADDR = 0xa9fe0000, /* protocol timeout parameters, specified in seconds */ -static const unsigned PROBE_WAIT = 1; -static const unsigned PROBE_MIN = 1; -static const unsigned PROBE_MAX = 2; -static const unsigned PROBE_NUM = 3; -static const unsigned MAX_CONFLICTS = 10; -static const unsigned RATE_LIMIT_INTERVAL = 60; -static const unsigned ANNOUNCE_WAIT = 2; -static const unsigned ANNOUNCE_NUM = 2; -static const unsigned ANNOUNCE_INTERVAL = 2; -static const time_t DEFEND_INTERVAL = 10; + PROBE_WAIT = 1, + PROBE_MIN = 1, + PROBE_MAX = 2, + PROBE_NUM = 3, + MAX_CONFLICTS = 10, + RATE_LIMIT_INTERVAL = 60, + ANNOUNCE_WAIT = 2, + ANNOUNCE_NUM = 2, + ANNOUNCE_INTERVAL = 2, + DEFEND_INTERVAL = 10 +}; static const unsigned char ZCIP_VERSION[] = "0.75 (18 April 2005)"; static char *prog; -- cgit v1.2.3