Patch from Denis Vlasenko turning static const int (which gets emitted into
authorRob Landley <rob@landley.net>
Fri, 10 Mar 2006 19:22:06 +0000 (19:22 -0000)
committerRob Landley <rob@landley.net>
Fri, 10 Mar 2006 19:22:06 +0000 (19:22 -0000)
the busybox binary) into enums (which don't).

28 files changed:
archival/gzip.c
archival/libunarchive/decompress_unzip.c
console-tools/chvt.c
console-tools/deallocvt.c
console-tools/loadfont.c
console-tools/setkeycodes.c
coreutils/cut.c
coreutils/stty.c
editors/awk.c
editors/vi.c
init/init.c
libbb/get_console.c
libbb/speed_table.c
libbb/xreadlink.c
modutils/insmod.c
modutils/lsmod.c
networking/dnsd.c
networking/fakeidentd.c
networking/ping.c
networking/ping6.c
networking/telnet.c
networking/zcip.c
shell/lash.c
util-linux/fbset.c
util-linux/fsck_minix.c
util-linux/getopt.c
util-linux/mkswap.c
util-linux/nfsmount.c

index 783a453..fa6e85b 100644 (file)
@@ -732,25 +732,26 @@ static unsigned match_start;      /* start of matching string */
 static int eofile;             /* flag set at end of input file */
 static unsigned lookahead;     /* number of valid bytes ahead in window */
 
-static const unsigned max_chain_length = 4096;
+enum {
+       max_chain_length = 4096,
 
 /* To speed up deflation, hash chains are never searched beyond this length.
  * A higher limit improves compression ratio but degrades the speed.
  */
 
-static const unsigned int max_lazy_match = 258;
+       max_lazy_match = 258,
 
 /* Attempt to find a better match only when the current match is strictly
  * smaller than this value. This mechanism is used only for compression
  * levels >= 4.
  */
-#define max_insert_length  max_lazy_match
+       max_insert_length = max_lazy_match,
 /* Insert new strings in the hash table only if the match length
  * is not greater than this length. This saves time but degrades compression.
  * max_insert_length is used only for compression levels <= 3.
  */
 
-static const unsigned good_match = 32;
+       good_match = 32,
 
 /* Use a faster search when the previous match is longer than this */
 
@@ -761,12 +762,13 @@ static const unsigned good_match = 32;
  * found for specific files.
  */
 
-static const int nice_match = 258;     /* Stop searching when current match exceeds this */
+       nice_match = 258        /* Stop searching when current match exceeds this */
 
 /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
  * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
  * meaning.
  */
+};
 
 #define EQUAL 0
 /* result of memcmp for equal strings */
index 7776dee..7c43bed 100644 (file)
@@ -92,7 +92,7 @@ static unsigned int gunzip_outbuf_count;      /* bytes in output buffer */
 
 /* gunzip_window size--must be a power of two, and
  *  at least 32K for zip's deflate method */
-static const unsigned int gunzip_wsize = 0x8000;
+enum { gunzip_wsize = 0x8000 };
 static unsigned char *gunzip_window;
 
 static unsigned int *gunzip_crc_table;
index b1a429e..252aed7 100644 (file)
 #include "busybox.h"
 
 /* From <linux/vt.h> */
-static const int VT_ACTIVATE = 0x5606;  /* make vt active */
-static const int VT_WAITACTIVE = 0x5607;  /* wait for vt active */
+enum {
+       VT_ACTIVATE = 0x5606,   /* make vt active */
+       VT_WAITACTIVE = 0x5607  /* wait for vt active */
+};
 
 int chvt_main(int argc, char **argv)
 {
index 00ddf42..ad3cebf 100644 (file)
@@ -30,7 +30,7 @@
 #include "busybox.h"
 
 /* From <linux/vt.h> */
-static const int VT_DISALLOCATE = 0x5608;  /* free memory associated to vt */
+enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
 
 int deallocvt_main(int argc, char *argv[])
 {
index 31c6d24..31221e0 100644 (file)
 #include <endian.h>
 #include "busybox.h"
 
-static const int PSF_MAGIC1 = 0x36;
-static const int PSF_MAGIC2 = 0x04;
-
-static const int PSF_MODE512 = 0x01;
-static const int PSF_MODEHASTAB = 0x02;
-static const int PSF_MAXMODE = 0x03;
-static const int PSF_SEPARATOR = 0xFFFF;
+enum{
+       PSF_MAGIC1 = 0x36,
+       PSF_MAGIC2 = 0x04,
+
+       PSF_MODE512 = 0x01,
+       PSF_MODEHASTAB = 0x02,
+       PSF_MAXMODE = 0x03,
+       PSF_SEPARATOR = 0xFFFF
+};
 
 struct psf_header {
        unsigned char magic1, magic2;   /* Magic number */
index efb6e65..dacf37b 100644 (file)
@@ -33,7 +33,9 @@
 struct kbkeycode {
        unsigned int scancode, keycode;
 };
-static const int KDSETKEYCODE = 0x4B4D;  /* write kernel keycode table entry */
+enum {
+       KDSETKEYCODE = 0x4B4D  /* write kernel keycode table entry */
+};
 
 extern int
 setkeycodes_main(int argc, char** argv)
index 526a993..11e9d5e 100644 (file)
@@ -45,9 +45,11 @@ struct cut_list {
        int endpos;
 };
 
-static const int BOL = 0;
-static const int EOL = INT_MAX;
-static const int NON_RANGE = -1;
+enum {
+       BOL = 0,
+       EOL = INT_MAX,
+       NON_RANGE = -1
+};
 
 static struct cut_list *cut_lists = NULL; /* growable array holding a series of lists */
 static unsigned int nlists = 0; /* number of elements in above list */
index a352613..8b70af6 100644 (file)
@@ -343,9 +343,10 @@ static const struct  mode_info mode_info[] = {
        MI_ENTRY(stty_dec,   combination, OMIT,              0,          0 ),
 };
 
-static const int NUM_mode_info =
-
-       (sizeof(mode_info) / sizeof(struct mode_info));
+enum {
+       NUM_mode_info =
+       (sizeof(mode_info) / sizeof(struct mode_info))
+};
 
 /* Control character settings.  */
 struct control_info {
@@ -395,8 +396,10 @@ static const struct  control_info control_info[] = {
        {stty_time,  0,       VTIME},
 };
 
-static const int NUM_control_info =
-       (sizeof(control_info) / sizeof(struct control_info));
+enum {
+       NUM_control_info =
+       (sizeof(control_info) / sizeof(struct control_info))
+};
 
 #define EMT(t) ((enum mode_type)(t))
 
index 65856aa..cce3b56 100644 (file)
@@ -392,7 +392,7 @@ static char * vValues =
 /* hash size may grow to these values */
 #define FIRST_PRIME 61;
 static const unsigned int PRIMES[] = { 251, 1021, 4093, 16381, 65521 };
-static const unsigned int NPRIMES = sizeof(PRIMES) / sizeof(unsigned int);
+enum { NPRIMES = sizeof(PRIMES) / sizeof(unsigned int) };
 
 /* globals */
 
index 4dcef68..3bf9ac3 100644 (file)
@@ -138,18 +138,20 @@ static const char CMup[] = "\033[A";
 static const char CMdown[] = "\n";
 
 
-static const int YANKONLY = FALSE;
-static const int YANKDEL = TRUE;
-static const int FORWARD = 1;  // code depends on "1"  for array index
-static const int BACK = -1;    // code depends on "-1" for array index
-static const int LIMITED = 0;  // how much of text[] in char_search
-static const int FULL = 1;     // how much of text[] in char_search
-
-static const int S_BEFORE_WS = 1;      // used in skip_thing() for moving "dot"
-static const int S_TO_WS = 2;          // used in skip_thing() for moving "dot"
-static const int S_OVER_WS = 3;                // used in skip_thing() for moving "dot"
-static const int S_END_PUNCT = 4;      // used in skip_thing() for moving "dot"
-static const int S_END_ALNUM = 5;      // used in skip_thing() for moving "dot"
+enum {
+       YANKONLY = FALSE,
+       YANKDEL = TRUE,
+       FORWARD = 1,    // code depends on "1"  for array index
+       BACK = -1,      // code depends on "-1" for array index
+       LIMITED = 0,    // how much of text[] in char_search
+       FULL = 1,       // how much of text[] in char_search
+
+       S_BEFORE_WS = 1,        // used in skip_thing() for moving "dot"
+       S_TO_WS = 2,            // used in skip_thing() for moving "dot"
+       S_OVER_WS = 3,          // used in skip_thing() for moving "dot"
+       S_END_PUNCT = 4,        // used in skip_thing() for moving "dot"
+       S_END_ALNUM = 5         // used in skip_thing() for moving "dot"
+};
 
 typedef unsigned char Byte;
 
index b7bc7ef..2ddcef9 100644 (file)
@@ -47,7 +47,7 @@ struct vt_stat {
        unsigned short v_signal;        /* signal to send */
        unsigned short v_state; /* vt bitmask */
 };
-static const int VT_GETSTATE = 0x5603; /* get global vt state info */
+enum { VT_GETSTATE = 0x5603 }; /* get global vt state info */
 
 /* From <linux/serial.h> */
 struct serial_struct {
@@ -145,22 +145,25 @@ static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE;
 static char *log_console = VC_5;
 #endif
 static sig_atomic_t got_cont = 0;
-static const int LOG = 0x1;
-static const int CONSOLE = 0x2;
+
+enum {
+       LOG = 0x1,
+       CONSOLE = 0x2,
 
 #if defined CONFIG_FEATURE_EXTRA_QUIET
-static const int MAYBE_CONSOLE = 0x0;
+       MAYBE_CONSOLE = 0x0,
 #else
-#define MAYBE_CONSOLE  CONSOLE
+       MAYBE_CONSOLE = CONSOLE,
 #endif
-#ifndef RB_HALT_SYSTEM
-static const int RB_HALT_SYSTEM = 0xcdef0123;
-static const int RB_ENABLE_CAD = 0x89abcdef;
-static const int RB_DISABLE_CAD = 0;
 
-#define RB_POWER_OFF    0x4321fedc
-static const int RB_AUTOBOOT = 0x01234567;
+#ifndef RB_HALT_SYSTEM
+       RB_HALT_SYSTEM = 0xcdef0123,
+       RB_ENABLE_CAD = 0x89abcdef,
+       RB_DISABLE_CAD = 0,
+       RB_POWER_OFF = 0x4321fedc,
+       RB_AUTOBOOT = 0x01234567,
 #endif
+};
 
 static const char * const environment[] = {
        "HOME=/",
index bfb7468..a5903d0 100644 (file)
@@ -30,7 +30,7 @@
 
 
 /* From <linux/kd.h> */
-static const int KDGKBTYPE = 0x4B33;  /* get keyboard type */
+enum { KDGKBTYPE = 0x4B33 };  /* get keyboard type */
 
 
 static int open_a_console(const char *fnam)
index b04429e..4075562 100644 (file)
@@ -67,7 +67,7 @@ static const struct speed_map speeds[] = {
 #endif
 };
 
-static const int NUM_SPEEDS = (sizeof(speeds) / sizeof(struct speed_map));
+enum { NUM_SPEEDS = (sizeof(speeds) / sizeof(struct speed_map)) };
 
 unsigned long bb_baud_to_value(speed_t speed)
 {
index 1bc166b..c7227d1 100644 (file)
@@ -15,7 +15,7 @@
 
 char *xreadlink(const char *path)
 {
-       static const int GROWBY = 80; /* how large we will grow strings by */
+       enum { GROWBY = 80 }; /* how large we will grow strings by */
 
        char *buf = NULL;
        int bufsize = 0, readsize = 0;
index 8b11278..26dd978 100644 (file)
@@ -343,7 +343,7 @@ extern int insmod_ng_main( int argc, char **argv);
 
 
 #ifndef MODUTILS_MODULE_H
-static const int MODUTILS_MODULE_H = 1;
+/* Why? static const int MODUTILS_MODULE_H = 1;*/
 
 #ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $"
 
@@ -364,9 +364,11 @@ static const int MODUTILS_MODULE_H = 1;
 #undef tgt_sizeof_char_p
 #undef tgt_sizeof_void_p
 #undef tgt_long
-static const int tgt_sizeof_long = 8;
-static const int tgt_sizeof_char_p = 8;
-static const int tgt_sizeof_void_p = 8;
+enum {
+       tgt_sizeof_long = 8,
+       tgt_sizeof_char_p = 8,
+       tgt_sizeof_void_p = 8
+};
 #define tgt_long               long long
 #endif
 
@@ -441,23 +443,26 @@ struct new_module_info
 };
 
 /* Bits of module.flags.  */
-static const int NEW_MOD_RUNNING = 1;
-static const int NEW_MOD_DELETED = 2;
-static const int NEW_MOD_AUTOCLEAN = 4;
-static const int NEW_MOD_VISITED = 8;
-static const int NEW_MOD_USED_ONCE = 16;
+enum {
+       NEW_MOD_RUNNING = 1,
+       NEW_MOD_DELETED = 2,
+       NEW_MOD_AUTOCLEAN = 4,
+       NEW_MOD_VISITED = 8,
+       NEW_MOD_USED_ONCE = 16
+};
 
 int init_module(const char *name, const struct new_module *);
 int query_module(const char *name, int which, void *buf,
                size_t bufsize, size_t *ret);
 
 /* Values for query_module's which.  */
-
-static const int QM_MODULES = 1;
-static const int QM_DEPS = 2;
-static const int QM_REFS = 3;
-static const int QM_SYMBOLS = 4;
-static const int QM_INFO = 5;
+enum {
+       QM_MODULES = 1,
+       QM_DEPS = 2,
+       QM_REFS = 3,
+       QM_SYMBOLS = 4,
+       QM_INFO = 5
+};
 
 /*======================================================================*/
 /* The system calls unchanged between 2.0 and 2.1.  */
@@ -501,7 +506,7 @@ int delete_module(const char *);
 
 
 #ifndef MODUTILS_OBJ_H
-static const int MODUTILS_OBJ_H = 1;
+/* Why? static const int MODUTILS_OBJ_H = 1; */
 
 #ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $"
 
@@ -700,7 +705,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license);
 
 
 #define _PATH_MODULES  "/lib/modules"
-static const int STRVERSIONLEN = 32;
+enum { STRVERSIONLEN = 32 };
 
 /*======================================================================*/
 
index 82136dd..3bbf89e 100644 (file)
@@ -82,20 +82,22 @@ struct module_info
 
 int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);
 
+enum {
 /* Values for query_module's which.  */
-static const int QM_MODULES = 1;
-static const int QM_DEPS = 2;
-static const int QM_REFS = 3;
-static const int QM_SYMBOLS = 4;
-static const int QM_INFO = 5;
+       QM_MODULES = 1,
+       QM_DEPS = 2,
+       QM_REFS = 3,
+       QM_SYMBOLS = 4,
+       QM_INFO = 5,
 
 /* Bits of module.flags.  */
-static const int NEW_MOD_RUNNING = 1;
-static const int NEW_MOD_DELETED = 2;
-static const int NEW_MOD_AUTOCLEAN = 4;
-static const int NEW_MOD_VISITED = 8;
-static const int NEW_MOD_USED_ONCE = 16;
-static const int NEW_MOD_INITIALIZING = 64;
+       NEW_MOD_RUNNING = 1,
+       NEW_MOD_DELETED = 2,
+       NEW_MOD_AUTOCLEAN = 4,
+       NEW_MOD_VISITED = 8,
+       NEW_MOD_USED_ONCE = 16,
+       NEW_MOD_INITIALIZING = 64
+};
 
 int lsmod_main(int argc, char **argv)
 {
index 433b124..9ca4105 100644 (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;
index c7fb42f..5442c22 100644 (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"
 
 /*
index 47b9f8f..ecfd125 100644 (file)
 #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)
 
index 42cf278..72d1d66 100644 (file)
 #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)
index ca4896b..2ad44d4 100644 (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;
+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,
index 11b2db5..716c4a5 100644 (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;
index 968396e..8e8d45a 100644 (file)
@@ -57,11 +57,13 @@ enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE,
 };
 #endif
 
-static const unsigned int DEFAULT_CONTEXT=0x1;
-static const unsigned int IF_TRUE_CONTEXT=0x2;
-static const unsigned int IF_FALSE_CONTEXT=0x4;
-static const unsigned int THEN_EXP_CONTEXT=0x8;
-static const unsigned int ELSE_EXP_CONTEXT=0x10;
+enum {
+       DEFAULT_CONTEXT = 0x1,
+       IF_TRUE_CONTEXT = 0x2,
+       IF_FALSE_CONTEXT = 0x4,
+       THEN_EXP_CONTEXT = 0x8,
+       ELSE_EXP_CONTEXT = 0x10
+};
 
 #ifdef CONFIG_LASH_PIPE_N_REDIRECTS
 struct redir_struct {
index 2e895be..d2667cf 100644 (file)
 #define DEFAULTFBDEV  FB_0
 #define DEFAULTFBMODE "/etc/fb.modes"
 
-static const int OPT_CHANGE   = (1 << 0);
-static const int OPT_INFO     = (1 << 1);
-static const int OPT_READMODE = (1 << 2);
-
 enum {
+       OPT_CHANGE   = (1 << 0),
+       OPT_INFO     = (1 << 1),
+       OPT_READMODE = (1 << 2),
+
        CMD_FB = 1,
        CMD_DB = 2,
        CMD_GEOMETRY = 3,
@@ -84,8 +84,10 @@ enum {
 static unsigned int g_options = 0;
 
 /* Stuff stolen from the kernel's fb.h */
-static const int FBIOGET_VSCREENINFO = 0x4600;
-static const int FBIOPUT_VSCREENINFO = 0x4601;
+enum {
+       FBIOGET_VSCREENINFO = 0x4600,
+       FBIOPUT_VSCREENINFO = 0x4601
+};
 struct fb_bitfield {
        uint32_t offset;                        /* beginning of bitfield        */
        uint32_t length;                        /* length of bitfield           */
@@ -179,12 +181,14 @@ static const struct cmdoptions_t {
 
 #ifdef CONFIG_FEATURE_FBSET_READMODE
 /* taken from linux/fb.h */
-static const int FB_VMODE_INTERLACED = 1;      /* interlaced   */
-static const int FB_VMODE_DOUBLE = 2;  /* double scan */
-static const int FB_SYNC_HOR_HIGH_ACT = 1;     /* horizontal sync high active  */
-static const int FB_SYNC_VERT_HIGH_ACT = 2;    /* vertical sync high active    */
-static const int FB_SYNC_EXT = 4;      /* external sync                */
-static const int FB_SYNC_COMP_HIGH_ACT = 8;    /* composite sync high active   */
+enum {
+       FB_VMODE_INTERLACED = 1,        /* interlaced   */
+       FB_VMODE_DOUBLE = 2,    /* double scan */
+       FB_SYNC_HOR_HIGH_ACT = 1,       /* horizontal sync high active  */
+       FB_SYNC_VERT_HIGH_ACT = 2,      /* vertical sync high active    */
+       FB_SYNC_EXT = 4,        /* external sync                */
+       FB_SYNC_COMP_HIGH_ACT = 8       /* composite sync high active   */
+};
 #endif
 static int readmode(struct fb_var_screeninfo *base, const char *fn,
                                        const char *mode)
index 1d3e90a..d7d81f1 100644 (file)
 #include <sys/param.h>
 #include "busybox.h"
 
-static const int MINIX_ROOT_INO = 1;
-static const int MINIX_LINK_MAX = 250;
-static const int MINIX2_LINK_MAX = 65530;
-
-static const int MINIX_I_MAP_SLOTS = 8;
-static const int MINIX_Z_MAP_SLOTS = 64;
-static const int MINIX_SUPER_MAGIC = 0x137F;           /* original minix fs */
-static const int MINIX_SUPER_MAGIC2 = 0x138F;          /* minix fs, 30 char names */
-static const int MINIX2_SUPER_MAGIC = 0x2468;          /* minix V2 fs */
-static const int MINIX2_SUPER_MAGIC2 = 0x2478;         /* minix V2 fs, 30 char names */
-static const int MINIX_VALID_FS = 0x0001;              /* Clean fs. */
-static const int MINIX_ERROR_FS = 0x0002;              /* fs has errors. */
-
-#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
-#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
-
-static const int MINIX_V1 = 0x0001;            /* original minix fs */
-static const int MINIX_V2 = 0x0002;            /* minix V2 fs */
-
-#define INODE_VERSION(inode)   inode->i_sb->u.minix_sb.s_version
+#define BLOCK_SIZE_BITS 10
+#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
 
 /*
  * This is the original minix inode layout on disk.
@@ -151,6 +133,29 @@ struct minix2_inode {
        uint32_t i_zone[10];
 };
 
+enum {
+       MINIX_ROOT_INO = 1,
+       MINIX_LINK_MAX = 250,
+       MINIX2_LINK_MAX = 65530,
+
+       MINIX_I_MAP_SLOTS = 8,
+       MINIX_Z_MAP_SLOTS = 64,
+       MINIX_SUPER_MAGIC = 0x137F,             /* original minix fs */
+       MINIX_SUPER_MAGIC2 = 0x138F,            /* minix fs, 30 char names */
+       MINIX2_SUPER_MAGIC = 0x2468,            /* minix V2 fs */
+       MINIX2_SUPER_MAGIC2 = 0x2478,           /* minix V2 fs, 30 char names */
+       MINIX_VALID_FS = 0x0001,                /* Clean fs. */
+       MINIX_ERROR_FS = 0x0002,                /* fs has errors. */
+
+       MINIX_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix_inode))),
+       MINIX2_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix2_inode))),
+
+       MINIX_V1 = 0x0001,              /* original minix fs */
+       MINIX_V2 = 0x0002               /* minix V2 fs */
+};
+
+#define INODE_VERSION(inode)   inode->i_sb->u.minix_sb.s_version
+
 /*
  * minix super-block data on disk
  */
@@ -172,8 +177,6 @@ struct minix_dir_entry {
        char name[0];
 };
 
-#define BLOCK_SIZE_BITS 10
-#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
 
 #define NAME_MAX         255   /* # chars in a file name */
 
@@ -187,7 +190,7 @@ struct minix_dir_entry {
 #define volatile
 #endif
 
-static const int ROOT_INO = 1;
+enum { ROOT_INO = 1 };
 
 #define UPPER(size,n) ((size+((n)-1))/(n))
 #define INODE_SIZE (sizeof(struct minix_inode))
@@ -219,7 +222,7 @@ static struct termios termios;
 static int termios_set = 0;
 
 /* File-name data */
-static const int MAX_DEPTH = 32;
+enum { MAX_DEPTH = 32 };
 static int name_depth = 0;
 // static char name_list[MAX_DEPTH][BUFSIZ + 1];
 static char **name_list = NULL;
index 16dcbbc..9e33b79 100644 (file)
 
 /* NON_OPT is the code that is returned when a non-option is found in '+'
    mode */
-static const int NON_OPT = 1;
+enum {
+       NON_OPT = 1,
 /* LONG_OPT is the code that is returned when a long option is found. */
-static const int LONG_OPT = 2;
+       LONG_OPT = 2
+};
 
 /* The shells recognized. */
 typedef enum {BASH,TCSH} shell_t;
@@ -195,7 +197,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
 static struct option *long_options;
 static int long_options_length; /* Length of array */
 static int long_options_nr; /* Nr of used elements in array */
-static const int LONG_OPTIONS_INCR = 10;
+enum { LONG_OPTIONS_INCR = 10 };
 #define init_longopt() add_longopt(NULL,0)
 
 /* Register a long option. The contents of name is copied. */
index e203f0d..4107329 100644 (file)
@@ -48,7 +48,7 @@
 
 #ifndef _IO
 /* pre-1.3.45 */
-static const int BLKGETSIZE = 0x1260;
+enum { BLKGETSIZE = 0x1260 };
 #else
 /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
 #define BLKGETSIZE _IO(0x12,96)
index a51fe81..1acec60 100644 (file)
@@ -105,13 +105,14 @@ enum nfs_stat {
 #define NFS_PROGRAM    100003
 
 
-
+enum {
 #ifndef NFS_FHSIZE
-static const int NFS_FHSIZE = 32;
+       NFS_FHSIZE = 32,
 #endif
 #ifndef NFS_PORT
-static const int NFS_PORT = 2049;
+       NFS_PORT = 2049
 #endif
+};
 
 /* Disable the nls stuff */
 # undef bindtextdomain
@@ -119,19 +120,21 @@ static const int NFS_PORT = 2049;
 # undef textdomain
 # define textdomain(Domain) /* empty */
 
-static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
-static const int MS_RDONLY = 1;      /* Mount read-only */
-static const int MS_NOSUID = 2;      /* Ignore suid and sgid bits */
-static const int MS_NODEV = 4;      /* Disallow access to device special files */
-static const int MS_NOEXEC = 8;      /* Disallow program execution */
-static const int MS_SYNCHRONOUS = 16;      /* Writes are synced at once */
-static const int MS_REMOUNT = 32;      /* Alter flags of a mounted FS */
-static const int MS_MANDLOCK = 64;      /* Allow mandatory locks on an FS */
-static const int S_QUOTA = 128;     /* Quota initialized for file/directory/symlink */
-static const int S_APPEND = 256;     /* Append-only file */
-static const int S_IMMUTABLE = 512;     /* Immutable file */
-static const int MS_NOATIME = 1024;    /* Do not update access times. */
-static const int MS_NODIRATIME = 2048;    /* Do not update directory access times */
+enum {
+       MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
+       MS_RDONLY = 1,      /* Mount read-only */
+       MS_NOSUID = 2,      /* Ignore suid and sgid bits */
+       MS_NODEV = 4,      /* Disallow access to device special files */
+       MS_NOEXEC = 8,      /* Disallow program execution */
+       MS_SYNCHRONOUS = 16,      /* Writes are synced at once */
+       MS_REMOUNT = 32,      /* Alter flags of a mounted FS */
+       MS_MANDLOCK = 64,      /* Allow mandatory locks on an FS */
+       S_QUOTA = 128,     /* Quota initialized for file/directory/symlink */
+       S_APPEND = 256,     /* Append-only file */
+       S_IMMUTABLE = 512,     /* Immutable file */
+       MS_NOATIME = 1024,    /* Do not update access times. */
+       MS_NODIRATIME = 2048    /* Do not update directory access times */
+};
 
 
 /*
@@ -177,17 +180,18 @@ struct nfs_mount_data {
 };
 
 /* bits in the flags field */
-
-static const int NFS_MOUNT_SOFT = 0x0001;      /* 1 */
-static const int NFS_MOUNT_INTR = 0x0002;      /* 1 */
-static const int NFS_MOUNT_SECURE = 0x0004;    /* 1 */
-static const int NFS_MOUNT_POSIX = 0x0008;     /* 1 */
-static const int NFS_MOUNT_NOCTO = 0x0010;     /* 1 */
-static const int NFS_MOUNT_NOAC = 0x0020;      /* 1 */
-static const int NFS_MOUNT_TCP = 0x0040;       /* 2 */
-static const int NFS_MOUNT_VER3 = 0x0080;      /* 3 */
-static const int NFS_MOUNT_KERBEROS = 0x0100;  /* 3 */
-static const int NFS_MOUNT_NONLM = 0x0200;     /* 3 */
+enum {
+       NFS_MOUNT_SOFT = 0x0001,        /* 1 */
+       NFS_MOUNT_INTR = 0x0002,        /* 1 */
+       NFS_MOUNT_SECURE = 0x0004,      /* 1 */
+       NFS_MOUNT_POSIX = 0x0008,       /* 1 */
+       NFS_MOUNT_NOCTO = 0x0010,       /* 1 */
+       NFS_MOUNT_NOAC = 0x0020,        /* 1 */
+       NFS_MOUNT_TCP = 0x0040,         /* 2 */
+       NFS_MOUNT_VER3 = 0x0080,        /* 3 */
+       NFS_MOUNT_KERBEROS = 0x0100,    /* 3 */
+       NFS_MOUNT_NONLM = 0x0200        /* 3 */
+};
 
 
 #define UTIL_LINUX_VERSION "2.10m"
@@ -213,8 +217,10 @@ static char *nfs_strerror(int status);
 #define MAKE_VERSION(p,q,r)    (65536*(p) + 256*(q) + (r))
 #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
 
-static const int EX_FAIL = 32;       /* mount failure */
-static const int EX_BG = 256;       /* retry in background (internal only) */
+enum {
+       EX_FAIL = 32,       /* mount failure */
+       EX_BG = 256        /* retry in background (internal only) */
+};
 
 
 /*