Patch from Denis Vlasenko turning static const int (which gets emitted into

the busybox binary) into enums (which don't).
This commit is contained in:
Rob Landley
2006-03-10 19:22:06 +00:00
parent dae6aa2859
commit bc68cd14cc
28 changed files with 243 additions and 193 deletions

View File

@@ -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;

View File

@@ -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"
/*

View File

@@ -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)

View File

@@ -56,13 +56,15 @@
#include <stddef.h> /* 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)

View File

@@ -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;
static const int UF_ECHO = 0x01;
static const int UF_SGA = 0x02;
enum {
CHM_TRY = 0,
CHM_ON = 1,
CHM_OFF = 2,
UF_ECHO = 0x01,
UF_SGA = 0x02,
TS_0 = 1,
TS_IAC = 2,
TS_OPT = 3,

View File

@@ -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;