aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/gunzip.c51
-rw-r--r--archival/tar.c8
-rw-r--r--chvt.c4
-rw-r--r--cmdedit.c9
-rw-r--r--console-tools/chvt.c4
-rw-r--r--console-tools/deallocvt.c2
-rw-r--r--console-tools/dumpkmap.c6
-rw-r--r--console-tools/loadfont.c12
-rw-r--r--console-tools/loadkmap.c6
-rw-r--r--console-tools/setkeycodes.c2
-rw-r--r--coreutils/ln.c6
-rw-r--r--coreutils/ls.c75
-rw-r--r--coreutils/md5sum.c6
-rw-r--r--coreutils/printf.c2
-rw-r--r--coreutils/tr.c40
-rw-r--r--coreutils/uname.c12
-rw-r--r--cp_mv.c10
-rw-r--r--deallocvt.c2
-rw-r--r--dumpkmap.c6
-rw-r--r--fbset.c94
-rw-r--r--fsck_minix.c38
-rw-r--r--getopt.c6
-rw-r--r--gunzip.c51
-rw-r--r--init.c14
-rw-r--r--init/init.c14
-rw-r--r--insmod.c38
-rw-r--r--kill.c4
-rw-r--r--lash.c4
-rw-r--r--ln.c6
-rw-r--r--loadfont.c12
-rw-r--r--loadkmap.c6
-rw-r--r--ls.c75
-rw-r--r--lsmod.c22
-rw-r--r--md5sum.c6
-rw-r--r--mkswap.c2
-rw-r--r--modutils/insmod.c38
-rw-r--r--modutils/lsmod.c22
-rw-r--r--mount.c30
-rw-r--r--networking/ping.c20
-rw-r--r--networking/telnet.c28
-rw-r--r--networking/wget.c4
-rw-r--r--nfsmount.c61
-rw-r--r--ping.c20
-rw-r--r--printf.c2
-rw-r--r--procps/kill.c4
-rw-r--r--procps/ps.c2
-rw-r--r--procps/uptime.c2
-rw-r--r--ps.c2
-rw-r--r--rdate.c2
-rw-r--r--rpmunpack.c18
-rw-r--r--setkeycodes.c2
-rw-r--r--sh.c4
-rw-r--r--shell/cmdedit.c9
-rw-r--r--shell/lash.c4
-rw-r--r--swaponoff.c4
-rw-r--r--sysklogd/syslogd.c4
-rw-r--r--syslogd.c4
-rw-r--r--tar.c8
-rw-r--r--telnet.c28
-rw-r--r--tr.c40
-rw-r--r--umount.c8
-rw-r--r--uname.c12
-rw-r--r--uptime.c2
-rw-r--r--util-linux/fbset.c94
-rw-r--r--util-linux/fsck_minix.c38
-rw-r--r--util-linux/getopt.c6
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/mount.c30
-rw-r--r--util-linux/nfsmount.c61
-rw-r--r--util-linux/rdate.c2
-rw-r--r--util-linux/swaponoff.c4
-rw-r--r--util-linux/umount.c8
-rw-r--r--utility.c10
-rw-r--r--wget.c4
74 files changed, 674 insertions, 624 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 8558573ba..194921682 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -76,40 +76,40 @@ static char *license_msg[] = {
76#define bb_need_name_too_long 76#define bb_need_name_too_long
77#include "messages.c" 77#include "messages.c"
78 78
79#define RECORD_IO 0 79static const int RECORD_IO = 0;
80 80
81/* Return codes from gzip */ 81/* Return codes from gzip */
82#define OK 0 82static const int OK = 0;
83#define ERROR 1 83static const int ERROR = 1;
84#define WARNING 2 84static const int WARNING = 2;
85 85
86#define DEFLATED 8 86static const int DEFLATED = 8;
87#define INBUFSIZ 0x2000 /* input buffer size */ 87static const int INBUFSIZ = 0x2000; /* input buffer size */
88#define INBUF_EXTRA 64 /* required by unlzw() */ 88static const int INBUF_EXTRA = 64; /* required by unlzw() */
89#define OUTBUFSIZ 8192 /* output buffer size */ 89static const int OUTBUFSIZ = 8192; /* output buffer size */
90#define OUTBUF_EXTRA 2048 /* required by unlzw() */ 90static const int OUTBUF_EXTRA = 2048; /* required by unlzw() */
91#define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */ 91static const int DIST_BUFSIZE = 0x2000; /* buffer for distances, see trees.c */
92 92
93#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */ 93#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
94 94
95/* gzip flag byte */ 95/* gzip flag byte */
96#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ 96static const int EXTRA_FIELD = 0x04; /* bit 2 set: extra field present */
97#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ 97static const int ORIG_NAME = 0x08; /* bit 3 set: original file name present */
98#define COMMENT 0x10 /* bit 4 set: file comment present */ 98static const int COMMENT = 0x10; /* bit 4 set: file comment present */
99#define WSIZE 0x8000 /* window size--must be a power of two, and */ 99static const int WSIZE = 0x8000; /* window size--must be a power of two, and */
100 /* at least 32K for zip's deflate method */ 100 /* at least 32K for zip's deflate method */
101 101
102/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ 102/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
103#define BMAX 16 /* maximum bit length of any code (16 for explode) */ 103static const int BMAX = 16; /* maximum bit length of any code (16 for explode) */
104#define N_MAX 288 /* maximum number of codes in any set */ 104static const int N_MAX = 288; /* maximum number of codes in any set */
105 105
106/* PKZIP header definitions */ 106/* PKZIP header definitions */
107#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ 107static const int LOCSIG = 0x04034b50L; /* four-byte lead-in (lsb first) */
108#define LOCCRC 14 /* offset of crc */ 108static const int LOCCRC = 14; /* offset of crc */
109#define LOCLEN 22 /* offset of uncompressed length */ 109static const int LOCLEN = 22; /* offset of uncompressed length */
110#define EXTHDR 16 /* size of extended local header, inc sig */ 110static const int EXTHDR = 16; /* size of extended local header, inc sig */
111 111
112#define BITS 16 112static const int BITS = 16;
113 113
114/* Diagnostic functions */ 114/* Diagnostic functions */
115#ifdef DEBUG 115#ifdef DEBUG
@@ -132,7 +132,7 @@ static char *license_msg[] = {
132# ifdef BUFSIZ 132# ifdef BUFSIZ
133# define MAX_PATH_LEN BUFSIZ 133# define MAX_PATH_LEN BUFSIZ
134# else 134# else
135# define MAX_PATH_LEN 1024 135static const int MAX_PATH_LEN = 1024;
136# endif 136# endif
137#endif 137#endif
138 138
@@ -165,8 +165,8 @@ static ush *tab_prefix1;
165/* local variables */ 165/* local variables */
166static int test_mode = 0; /* check file integrity option */ 166static int test_mode = 0; /* check file integrity option */
167static int foreground; /* set if program run in foreground */ 167static int foreground; /* set if program run in foreground */
168static int method = DEFLATED; /* compression method */ 168static int method; /* compression method */
169static int exit_code = OK; /* program exit code */ 169static int exit_code; /* program exit code */
170static int last_member; /* set for .zip and .Z files */ 170static int last_member; /* set for .zip and .Z files */
171static int part_nb; /* number of parts in .gz file */ 171static int part_nb; /* number of parts in .gz file */
172static long ifile_size; /* input file size, -1 for devices (debug only) */ 172static long ifile_size; /* input file size, -1 for devices (debug only) */
@@ -1225,6 +1225,9 @@ int gunzip_main(int argc, char **argv)
1225 char ifname[MAX_PATH_LEN + 1]; /* input file name */ 1225 char ifname[MAX_PATH_LEN + 1]; /* input file name */
1226 char ofname[MAX_PATH_LEN + 1]; /* output file name */ 1226 char ofname[MAX_PATH_LEN + 1]; /* output file name */
1227 1227
1228 method = DEFLATED; /* default compression method */
1229 exit_code = OK; /* let's go out on a limb and assume everything will run fine (wink wink) */
1230
1228 if (strcmp(applet_name, "zcat") == 0) { 1231 if (strcmp(applet_name, "zcat") == 0) {
1229 force = 1; 1232 force = 1;
1230 tostdout = 1; 1233 tostdout = 1;
diff --git a/archival/tar.c b/archival/tar.c
index 2699550ec..51a857d71 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -64,7 +64,7 @@ extern int gunzip_init();
64#define MINOR(dev) ((dev)&0xff) 64#define MINOR(dev) ((dev)&0xff)
65#endif 65#endif
66 66
67#define NAME_SIZE 100 67enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
68 68
69/* POSIX tar Header Block, from POSIX 1003.1-1990 */ 69/* POSIX tar Header Block, from POSIX 1003.1-1990 */
70struct TarHeader 70struct TarHeader
@@ -94,9 +94,9 @@ typedef struct TarHeader TarHeader;
94/* A few useful constants */ 94/* A few useful constants */
95#define TAR_MAGIC "ustar" /* ustar and a null */ 95#define TAR_MAGIC "ustar" /* ustar and a null */
96#define TAR_VERSION " " /* Be compatable with GNU tar format */ 96#define TAR_VERSION " " /* Be compatable with GNU tar format */
97#define TAR_MAGIC_LEN 6 97static const int TAR_MAGIC_LEN = 6;
98#define TAR_VERSION_LEN 2 98static const int TAR_VERSION_LEN = 2;
99#define TAR_BLOCK_SIZE 512 99static const int TAR_BLOCK_SIZE = 512;
100 100
101/* A nice enum with all the possible tar file content types */ 101/* A nice enum with all the possible tar file content types */
102enum TarFileType 102enum TarFileType
diff --git a/chvt.c b/chvt.c
index 76d4b53a6..c715e67de 100644
--- a/chvt.c
+++ b/chvt.c
@@ -12,8 +12,8 @@
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13 13
14/* From <linux/vt.h> */ 14/* From <linux/vt.h> */
15#define VT_ACTIVATE 0x5606 /* make vt active */ 15static const int VT_ACTIVATE = 0x5606; /* make vt active */
16#define VT_WAITACTIVE 0x5607 /* wait for vt active */ 16static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
17 17
18int chvt_main(int argc, char **argv) 18int chvt_main(int argc, char **argv)
19{ 19{
diff --git a/cmdedit.c b/cmdedit.c
index 722a36a50..12c78dc76 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -44,10 +44,13 @@
44#include <signal.h> 44#include <signal.h>
45 45
46 46
47#define MAX_HISTORY 15 /* Maximum length of the linked list for the command line history */ 47static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */
48
49enum {
50 ESC = 27,
51 DEL = 127,
52};
48 53
49#define ESC 27
50#define DEL 127
51#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0) 54#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
52#define whitespace(c) (((c) == ' ') || ((c) == '\t')) 55#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
53 56
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 76d4b53a6..c715e67de 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -12,8 +12,8 @@
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13 13
14/* From <linux/vt.h> */ 14/* From <linux/vt.h> */
15#define VT_ACTIVATE 0x5606 /* make vt active */ 15static const int VT_ACTIVATE = 0x5606; /* make vt active */
16#define VT_WAITACTIVE 0x5607 /* wait for vt active */ 16static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
17 17
18int chvt_main(int argc, char **argv) 18int chvt_main(int argc, char **argv)
19{ 19{
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 3dd90c0e9..fad7a2bb2 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -11,7 +11,7 @@
11#include <sys/ioctl.h> 11#include <sys/ioctl.h>
12 12
13/* From <linux/vt.h> */ 13/* From <linux/vt.h> */
14#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ 14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
15 15
16int deallocvt_main(int argc, char *argv[]) 16int deallocvt_main(int argc, char *argv[])
17{ 17{
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index c5a2ea74e..b438ba271 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -32,11 +32,11 @@ struct kbentry {
32 unsigned char kb_index; 32 unsigned char kb_index;
33 unsigned short kb_value; 33 unsigned short kb_value;
34}; 34};
35#define KDGKBENT 0x4B46 /* gets one entry in translation table */ 35static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
36 36
37/* From <linux/keyboard.h> */ 37/* From <linux/keyboard.h> */
38#define NR_KEYS 128 38static const int NR_KEYS = 128;
39#define MAX_NR_KEYMAPS 256 39static const int MAX_NR_KEYMAPS = 256;
40 40
41int dumpkmap_main(int argc, char **argv) 41int dumpkmap_main(int argc, char **argv)
42{ 42{
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 13a196fb0..08e07618e 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -21,13 +21,13 @@
21#include <sys/kd.h> 21#include <sys/kd.h>
22#include <endian.h> 22#include <endian.h>
23 23
24#define PSF_MAGIC1 0x36 24static const int PSF_MAGIC1 = 0x36;
25#define PSF_MAGIC2 0x04 25static const int PSF_MAGIC2 = 0x04;
26 26
27#define PSF_MODE512 0x01 27static const int PSF_MODE512 = 0x01;
28#define PSF_MODEHASTAB 0x02 28static const int PSF_MODEHASTAB = 0x02;
29#define PSF_MAXMODE 0x03 29static const int PSF_MAXMODE = 0x03;
30#define PSF_SEPARATOR 0xFFFF 30static const int PSF_SEPARATOR = 0xFFFF;
31 31
32struct psf_header { 32struct psf_header {
33 unsigned char magic1, magic2; /* Magic number */ 33 unsigned char magic1, magic2; /* Magic number */
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index fc2439864..43c1cc795 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -34,11 +34,11 @@ struct kbentry {
34 unsigned char kb_index; 34 unsigned char kb_index;
35 unsigned short kb_value; 35 unsigned short kb_value;
36}; 36};
37#define KDSKBENT 0x4B47 /* sets one entry in translation table */ 37static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
38 38
39/* From <linux/keyboard.h> */ 39/* From <linux/keyboard.h> */
40#define NR_KEYS 128 40static const int NR_KEYS = 128;
41#define MAX_NR_KEYMAPS 256 41static const int MAX_NR_KEYMAPS = 256;
42 42
43int loadkmap_main(int argc, char **argv) 43int loadkmap_main(int argc, char **argv)
44{ 44{
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index 7db398d77..be9b1b797 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -33,7 +33,7 @@
33struct kbkeycode { 33struct kbkeycode {
34 unsigned int scancode, keycode; 34 unsigned int scancode, keycode;
35}; 35};
36#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ 36static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
37 37
38extern int 38extern int
39setkeycodes_main(int argc, char** argv) 39setkeycodes_main(int argc, char** argv)
diff --git a/coreutils/ln.c b/coreutils/ln.c
index ead5322fa..e69cb024a 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -30,9 +30,9 @@
30#include <dirent.h> 30#include <dirent.h>
31#include <errno.h> 31#include <errno.h>
32 32
33#define LN_SYMLINK 1 33static const int LN_SYMLINK = 1;
34#define LN_FORCE 2 34static const int LN_FORCE = 2;
35#define LN_NODEREFERENCE 4 35static const int LN_NODEREFERENCE = 4;
36 36
37/* 37/*
38 * linkDestName is where the link points to, 38 * linkDestName is where the link points to,
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 754a6d450..080768027 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -41,9 +41,9 @@
41 * 1. requires lstat (BSD) - how do you do it without? 41 * 1. requires lstat (BSD) - how do you do it without?
42 */ 42 */
43 43
44#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ 44static const int TERMINAL_WIDTH = 80; /* use 79 if your terminal has linefold bug */
45#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ 45static const int COLUMN_WIDTH = 14; /* default if AUTOWIDTH not defined */
46#define COLUMN_GAP 2 /* includes the file type char, if present */ 46static const int COLUMN_GAP = 2; /* includes the file type char, if present */
47 47
48/************************************************************************/ 48/************************************************************************/
49 49
@@ -66,10 +66,12 @@
66#endif 66#endif
67 67
68/* what is the overall style of the listing */ 68/* what is the overall style of the listing */
69#define STYLE_AUTO 0 69enum {
70#define STYLE_LONG 1 /* one record per line, extended info */ 70STYLE_AUTO = 0,
71#define STYLE_SINGLE 2 /* one record per line */ 71STYLE_LONG = 1, /* one record per line, extended info */
72#define STYLE_COLUMNS 3 /* fill columns */ 72STYLE_SINGLE = 2, /* one record per line */
73STYLE_COLUMNS = 3 /* fill columns */
74};
73 75
74/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ 76/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */
75/* what file information will be listed */ 77/* what file information will be listed */
@@ -99,23 +101,23 @@
99 101
100#ifdef BB_FEATURE_LS_SORTFILES 102#ifdef BB_FEATURE_LS_SORTFILES
101/* how will the files be sorted */ 103/* how will the files be sorted */
102#define SORT_FORWARD 0 /* sort in reverse order */ 104static const int SORT_FORWARD = 0; /* sort in reverse order */
103#define SORT_REVERSE 1 /* sort in reverse order */ 105static const int SORT_REVERSE = 1; /* sort in reverse order */
104#define SORT_NAME 2 /* sort by file name */ 106static const int SORT_NAME = 2; /* sort by file name */
105#define SORT_SIZE 3 /* sort by file size */ 107static const int SORT_SIZE = 3; /* sort by file size */
106#define SORT_ATIME 4 /* sort by last access time */ 108static const int SORT_ATIME = 4; /* sort by last access time */
107#define SORT_CTIME 5 /* sort by last change time */ 109static const int SORT_CTIME = 5; /* sort by last change time */
108#define SORT_MTIME 6 /* sort by last modification time */ 110static const int SORT_MTIME = 6; /* sort by last modification time */
109#define SORT_VERSION 7 /* sort by version */ 111static const int SORT_VERSION = 7; /* sort by version */
110#define SORT_EXT 8 /* sort by file name extension */ 112static const int SORT_EXT = 8; /* sort by file name extension */
111#define SORT_DIR 9 /* sort by file or directory */ 113static const int SORT_DIR = 9; /* sort by file or directory */
112#endif 114#endif
113 115
114#ifdef BB_FEATURE_LS_TIMESTAMPS 116#ifdef BB_FEATURE_LS_TIMESTAMPS
115/* which of the three times will be used */ 117/* which of the three times will be used */
116#define TIME_MOD 0 118static const int TIME_MOD = 0;
117#define TIME_CHANGE 1 119static const int TIME_CHANGE = 1;
118#define TIME_ACCESS 2 120static const int TIME_ACCESS = 2;
119#endif 121#endif
120 122
121#define LIST_SHORT (LIST_FILENAME) 123#define LIST_SHORT (LIST_FILENAME)
@@ -125,9 +127,9 @@
125 LIST_SYMLINK) 127 LIST_SYMLINK)
126#define LIST_ILONG (LIST_INO | LIST_LONG) 128#define LIST_ILONG (LIST_INO | LIST_LONG)
127 129
128#define SPLIT_DIR 0 130static const int SPLIT_DIR = 0;
129#define SPLIT_FILE 1 131static const int SPLIT_FILE = 1;
130#define SPLIT_SUBDIR 2 132static const int SPLIT_SUBDIR = 2;
131 133
132#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) 134#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
133#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) 135#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
@@ -150,15 +152,15 @@ struct dnode **list_dir(char *);
150struct dnode **dnalloc(int); 152struct dnode **dnalloc(int);
151int list_single(struct dnode *); 153int list_single(struct dnode *);
152 154
153static unsigned int disp_opts= DISP_NORMAL; 155static unsigned int disp_opts;
154static unsigned int style_fmt= STYLE_AUTO ; 156static unsigned int style_fmt;
155static unsigned int list_fmt= LIST_SHORT ; 157static unsigned int list_fmt;
156#ifdef BB_FEATURE_LS_SORTFILES 158#ifdef BB_FEATURE_LS_SORTFILES
157static unsigned int sort_opts= SORT_FORWARD; 159static unsigned int sort_opts;
158static unsigned int sort_order= SORT_FORWARD; 160static unsigned int sort_order;
159#endif 161#endif
160#ifdef BB_FEATURE_LS_TIMESTAMPS 162#ifdef BB_FEATURE_LS_TIMESTAMPS
161static unsigned int time_fmt= TIME_MOD; 163static unsigned int time_fmt;
162#endif 164#endif
163#ifdef BB_FEATURE_LS_FOLLOWLINKS 165#ifdef BB_FEATURE_LS_FOLLOWLINKS
164static unsigned int follow_links=FALSE; 166static unsigned int follow_links=FALSE;
@@ -166,12 +168,9 @@ static unsigned int follow_links=FALSE;
166 168
167static unsigned short column = 0; 169static unsigned short column = 0;
168#ifdef BB_FEATURE_AUTOWIDTH 170#ifdef BB_FEATURE_AUTOWIDTH
169static unsigned short terminal_width = TERMINAL_WIDTH; 171static unsigned short terminal_width;
170static unsigned short column_width = COLUMN_WIDTH; 172static unsigned short column_width;
171static unsigned short tabstops = 8; 173static unsigned short tabstops;
172#else
173#define terminal_width TERMINAL_WIDTH
174#define column_width COLUMN_WIDTH
175#endif 174#endif
176 175
177static int status = EXIT_SUCCESS; 176static int status = EXIT_SUCCESS;
@@ -710,10 +709,16 @@ extern int ls_main(int argc, char **argv)
710 list_fmt= LIST_SHORT; 709 list_fmt= LIST_SHORT;
711#ifdef BB_FEATURE_LS_SORTFILES 710#ifdef BB_FEATURE_LS_SORTFILES
712 sort_opts= SORT_NAME; 711 sort_opts= SORT_NAME;
712 sort_order= SORT_FORWARD;
713#endif 713#endif
714#ifdef BB_FEATURE_LS_TIMESTAMPS 714#ifdef BB_FEATURE_LS_TIMESTAMPS
715 time_fmt= TIME_MOD; 715 time_fmt= TIME_MOD;
716#endif 716#endif
717#ifdef BB_FEATURE_AUTOWIDTH
718 terminal_width = TERMINAL_WIDTH;
719 column_width = COLUMN_WIDTH;
720 tabstops = 8;
721#endif
717 nfiles=0; 722 nfiles=0;
718 723
719 /* process options */ 724 /* process options */
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index 3458f2e05..ad4078040 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -91,7 +91,7 @@
91 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 91 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
92 92
93#ifndef _MD5_H 93#ifndef _MD5_H
94#define _MD5_H 1 94static const int _MD5_H = 1;
95 95
96#include <stdio.h> 96#include <stdio.h>
97 97
@@ -251,7 +251,7 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
251int md5_stream(FILE *stream, void *resblock) 251int md5_stream(FILE *stream, void *resblock)
252{ 252{
253 /* Important: BLOCKSIZE must be a multiple of 64. */ 253 /* Important: BLOCKSIZE must be a multiple of 64. */
254#define BLOCKSIZE 4096 254static const int BLOCKSIZE = 4096;
255 struct md5_ctx ctx; 255 struct md5_ctx ctx;
256 char buffer[BLOCKSIZE + 72]; 256 char buffer[BLOCKSIZE + 72];
257 size_t sum; 257 size_t sum;
@@ -529,7 +529,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
529/* The minimum length of a valid digest line in a file produced 529/* The minimum length of a valid digest line in a file produced
530 by `md5sum FILE' and read by `md5sum -c'. This length does 530 by `md5sum FILE' and read by `md5sum -c'. This length does
531 not include any newline character at the end of a line. */ 531 not include any newline character at the end of a line. */
532#define MIN_DIGEST_LINE_LENGTH 35 /* 32 - message digest length 532static const int MIN_DIGEST_LINE_LENGTH = 35; /* 32 - message digest length
533 2 - blank and binary indicator 533 2 - blank and binary indicator
534 1 - minimum filename length */ 534 1 - minimum filename length */
535 535
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 832ca13d6..72bc7ae89 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -59,7 +59,7 @@
59 59
60 60
61#ifndef S_IFMT 61#ifndef S_IFMT
62# define S_IFMT 0170000 62static const int S_IFMT = 0170000;
63#endif 63#endif
64#if !defined(S_ISBLK) && defined(S_IFBLK) 64#if !defined(S_ISBLK) && defined(S_IFBLK)
65# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 65# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
diff --git a/coreutils/tr.c b/coreutils/tr.c
index fd547b87d..d21e672fe 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -34,14 +34,15 @@
34#define bb_need_write_error 34#define bb_need_write_error
35#include "messages.c" 35#include "messages.c"
36 36
37#define ASCII 0377 37static const int ASCII = 0377;
38 38
39/* some glabals shared across this file */ 39/* some glabals shared across this file */
40static char com_fl, del_fl, sq_fl; 40static char com_fl, del_fl, sq_fl;
41static unsigned char output[BUFSIZ], input[BUFSIZ];
42static unsigned char vector[ASCII + 1];
43static char invec[ASCII + 1], outvec[ASCII + 1];
44static short in_index, out_index; 41static short in_index, out_index;
42/* these last are pointers to static buffers declared in tr_main */
43static unsigned char *poutput, *pinput;
44static unsigned char *pvector;
45static char *pinvec, *poutvec;
45 46
46 47
47static void convert() 48static void convert()
@@ -52,22 +53,22 @@ static void convert()
52 53
53 for (;;) { 54 for (;;) {
54 if (in_index == read_chars) { 55 if (in_index == read_chars) {
55 if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) { 56 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
56 if (write(1, (char *) output, out_index) != out_index) 57 if (write(1, (char *) poutput, out_index) != out_index)
57 write(2, write_error, strlen(write_error)); 58 write(2, write_error, strlen(write_error));
58 exit(0); 59 exit(0);
59 } 60 }
60 in_index = 0; 61 in_index = 0;
61 } 62 }
62 c = input[in_index++]; 63 c = pinput[in_index++];
63 coded = vector[c]; 64 coded = pvector[c];
64 if (del_fl && invec[c]) 65 if (del_fl && pinvec[c])
65 continue; 66 continue;
66 if (sq_fl && last == coded && (invec[c] || outvec[coded])) 67 if (sq_fl && last == coded && (pinvec[c] || poutvec[coded]))
67 continue; 68 continue;
68 output[out_index++] = last = coded; 69 poutput[out_index++] = last = coded;
69 if (out_index == BUFSIZ) { 70 if (out_index == BUFSIZ) {
70 if (write(1, (char *) output, out_index) != out_index) { 71 if (write(1, (char *) poutput, out_index) != out_index) {
71 write(2, write_error, strlen(write_error)); 72 write(2, write_error, strlen(write_error));
72 exit(1); 73 exit(1);
73 } 74 }
@@ -86,9 +87,9 @@ static void map(register unsigned char *string1, unsigned int string1_len,
86 87
87 for (j = 0, i = 0; i < string1_len; i++) { 88 for (j = 0, i = 0; i < string1_len; i++) {
88 if (string2_len <= j) 89 if (string2_len <= j)
89 vector[string1[i]] = last; 90 pvector[string1[i]] = last;
90 else 91 else
91 vector[string1[i]] = last = string2[j++]; 92 pvector[string1[i]] = last = string2[j++];
92 } 93 }
93} 94}
94 95
@@ -143,6 +144,17 @@ extern int tr_main(int argc, char **argv)
143 int output_length=0, input_length; 144 int output_length=0, input_length;
144 int index = 1; 145 int index = 1;
145 int i; 146 int i;
147 /* set up big arrays here (better than making a bunch of static arrays up top) */
148 unsigned char output[BUFSIZ], input[BUFSIZ];
149 unsigned char vector[ASCII + 1];
150 char invec[ASCII + 1], outvec[ASCII + 1];
151
152 /* ... but make them available globally */
153 poutput = output;
154 pinput = input;
155 pvector = vector;
156 pinvec = invec;
157 poutvec = outvec;
146 158
147 if (argc > 1 && argv[index][0] == '-') { 159 if (argc > 1 && argv[index][0] == '-') {
148 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { 160 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
diff --git a/coreutils/uname.c b/coreutils/uname.c
index e7e9ff331..4f7c643f9 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -44,22 +44,22 @@ static void print_element(unsigned int mask, char *element);
44 44
45/* Values that are bitwise or'd into `toprint'. */ 45/* Values that are bitwise or'd into `toprint'. */
46/* Operating system name. */ 46/* Operating system name. */
47#define PRINT_SYSNAME 1 47static const int PRINT_SYSNAME = 1;
48 48
49/* Node name on a communications network. */ 49/* Node name on a communications network. */
50#define PRINT_NODENAME 2 50static const int PRINT_NODENAME = 2;
51 51
52/* Operating system release. */ 52/* Operating system release. */
53#define PRINT_RELEASE 4 53static const int PRINT_RELEASE = 4;
54 54
55/* Operating system version. */ 55/* Operating system version. */
56#define PRINT_VERSION 8 56static const int PRINT_VERSION = 8;
57 57
58/* Machine hardware name. */ 58/* Machine hardware name. */
59#define PRINT_MACHINE 16 59static const int PRINT_MACHINE = 16;
60 60
61 /* Host processor type. */ 61 /* Host processor type. */
62#define PRINT_PROCESSOR 32 62static const int PRINT_PROCESSOR = 32;
63 63
64/* Mask indicating which elements of the name to print. */ 64/* Mask indicating which elements of the name to print. */
65static unsigned char toprint; 65static unsigned char toprint;
diff --git a/cp_mv.c b/cp_mv.c
index 0b3288276..55483505f 100644
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -43,8 +43,8 @@
43#include <errno.h> 43#include <errno.h>
44#include <getopt.h> 44#include <getopt.h>
45 45
46#define is_cp 0 46static const int is_cp = 0;
47#define is_mv 1 47static const int is_mv = 1;
48static int dz_i; /* index into cp_mv_usage */ 48static int dz_i; /* index into cp_mv_usage */
49 49
50static const char *cp_mv_usage[] = /* .rodata */ 50static const char *cp_mv_usage[] = /* .rodata */
@@ -62,7 +62,7 @@ static const char *baseSrcName;
62static int srcDirFlag; 62static int srcDirFlag;
63static struct stat srcStatBuf; 63static struct stat srcStatBuf;
64 64
65static char baseDestName[BUFSIZ + 1]; 65static char *pBaseDestName;
66static size_t baseDestLen; 66static size_t baseDestLen;
67static int destDirFlag; 67static int destDirFlag;
68static struct stat destStatBuf; 68static struct stat destStatBuf;
@@ -104,7 +104,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
104 const char *srcBasename; 104 const char *srcBasename;
105 char *name; 105 char *name;
106 106
107 strcpy(destName, baseDestName); 107 strcpy(destName, pBaseDestName);
108 destLen = strlen(destName); 108 destLen = strlen(destName);
109 109
110 if (srcDirFlag == TRUE) { 110 if (srcDirFlag == TRUE) {
@@ -175,6 +175,8 @@ extern int cp_mv_main(int argc, char **argv)
175{ 175{
176 volatile int i; 176 volatile int i;
177 int c; 177 int c;
178 char baseDestName[BUFSIZ + 1]; /* not declared globally == less bss used */
179 pBaseDestName = baseDestName; /* but available globally */
178 180
179 if (*applet_name == 'c' && *(applet_name + 1) == 'p') 181 if (*applet_name == 'c' && *(applet_name + 1) == 'p')
180 dz_i = is_cp; 182 dz_i = is_cp;
diff --git a/deallocvt.c b/deallocvt.c
index 3dd90c0e9..fad7a2bb2 100644
--- a/deallocvt.c
+++ b/deallocvt.c
@@ -11,7 +11,7 @@
11#include <sys/ioctl.h> 11#include <sys/ioctl.h>
12 12
13/* From <linux/vt.h> */ 13/* From <linux/vt.h> */
14#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ 14static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
15 15
16int deallocvt_main(int argc, char *argv[]) 16int deallocvt_main(int argc, char *argv[])
17{ 17{
diff --git a/dumpkmap.c b/dumpkmap.c
index c5a2ea74e..b438ba271 100644
--- a/dumpkmap.c
+++ b/dumpkmap.c
@@ -32,11 +32,11 @@ struct kbentry {
32 unsigned char kb_index; 32 unsigned char kb_index;
33 unsigned short kb_value; 33 unsigned short kb_value;
34}; 34};
35#define KDGKBENT 0x4B46 /* gets one entry in translation table */ 35static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
36 36
37/* From <linux/keyboard.h> */ 37/* From <linux/keyboard.h> */
38#define NR_KEYS 128 38static const int NR_KEYS = 128;
39#define MAX_NR_KEYMAPS 256 39static const int MAX_NR_KEYMAPS = 256;
40 40
41int dumpkmap_main(int argc, char **argv) 41int dumpkmap_main(int argc, char **argv)
42{ 42{
diff --git a/fbset.c b/fbset.c
index 40a907b07..845be8442 100644
--- a/fbset.c
+++ b/fbset.c
@@ -36,53 +36,55 @@
36#define DEFAULTFBDEV "/dev/fb0" 36#define DEFAULTFBDEV "/dev/fb0"
37#define DEFAULTFBMODE "/etc/fb.modes" 37#define DEFAULTFBMODE "/etc/fb.modes"
38 38
39#define OPT_CHANGE 1 39static const int OPT_CHANGE = (1 << 0);
40#define OPT_INFO (1 << 1) 40static const int OPT_INFO = (1 << 1);
41#define OPT_READMODE (1 << 2) 41static const int OPT_READMODE = (1 << 2);
42 42
43#define CMD_HELP 0 43enum {
44#define CMD_FB 1 44 CMD_HELP = 0,
45#define CMD_DB 2 45 CMD_FB = 1,
46#define CMD_GEOMETRY 3 46 CMD_DB = 2,
47#define CMD_TIMING 4 47 CMD_GEOMETRY = 3,
48#define CMD_ACCEL 5 48 CMD_TIMING = 4,
49#define CMD_HSYNC 6 49 CMD_ACCEL = 5,
50#define CMD_VSYNC 7 50 CMD_HSYNC = 6,
51#define CMD_LACED 8 51 CMD_VSYNC = 7,
52#define CMD_DOUBLE 9 52 CMD_LACED = 8,
53/* #define CMD_XCOMPAT 10 */ 53 CMD_DOUBLE = 9,
54#define CMD_ALL 11 54/* CMD_XCOMPAT = 10, */
55#define CMD_INFO 12 55 CMD_ALL = 11,
56#define CMD_CHANGE 13 56 CMD_INFO = 12,
57 CMD_CHANGE = 13,
57 58
58#ifdef BB_FEATURE_FBSET_FANCY 59#ifdef BB_FEATURE_FBSET_FANCY
59#define CMD_XRES 100 60 CMD_XRES = 100,
60#define CMD_YRES 101 61 CMD_YRES = 101,
61#define CMD_VXRES 102 62 CMD_VXRES = 102,
62#define CMD_VYRES 103 63 CMD_VYRES = 103,
63#define CMD_DEPTH 104 64 CMD_DEPTH = 104,
64#define CMD_MATCH 105 65 CMD_MATCH = 105,
65#define CMD_PIXCLOCK 106 66 CMD_PIXCLOCK = 106,
66#define CMD_LEFT 107 67 CMD_LEFT = 107,
67#define CMD_RIGHT 108 68 CMD_RIGHT = 108,
68#define CMD_UPPER 109 69 CMD_UPPER = 109,
69#define CMD_LOWER 110 70 CMD_LOWER = 110,
70#define CMD_HSLEN 111 71 CMD_HSLEN = 111,
71#define CMD_VSLEN 112 72 CMD_VSLEN = 112,
72#define CMD_CSYNC 113 73 CMD_CSYNC = 113,
73#define CMD_GSYNC 114 74 CMD_GSYNC = 114,
74#define CMD_EXTSYNC 115 75 CMD_EXTSYNC = 115,
75#define CMD_BCAST 116 76 CMD_BCAST = 116,
76#define CMD_RGBA 117 77 CMD_RGBA = 117,
77#define CMD_STEP 118 78 CMD_STEP = 118,
78#define CMD_MOVE 119 79 CMD_MOVE = 119,
79#endif 80#endif
81};
80 82
81static unsigned int g_options = 0; 83static unsigned int g_options = 0;
82 84
83/* Stuff stolen from the kernel's fb.h */ 85/* Stuff stolen from the kernel's fb.h */
84#define FBIOGET_VSCREENINFO 0x4600 86static const int FBIOGET_VSCREENINFO = 0x4600;
85#define FBIOPUT_VSCREENINFO 0x4601 87static const int FBIOPUT_VSCREENINFO = 0x4601;
86#define __u32 unsigned int 88#define __u32 unsigned int
87struct fb_bitfield { 89struct fb_bitfield {
88 __u32 offset; /* beginning of bitfield */ 90 __u32 offset; /* beginning of bitfield */
@@ -180,12 +182,12 @@ struct cmdoptions_t {
180 182
181#ifdef BB_FEATURE_FBSET_READMODE 183#ifdef BB_FEATURE_FBSET_READMODE
182/* taken from linux/fb.h */ 184/* taken from linux/fb.h */
183#define FB_VMODE_INTERLACED 1 /* interlaced */ 185static const int FB_VMODE_INTERLACED = 1; /* interlaced */
184#define FB_VMODE_DOUBLE 2 /* double scan */ 186static const int FB_VMODE_DOUBLE = 2; /* double scan */
185#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ 187static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */
186#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ 188static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */
187#define FB_SYNC_EXT 4 /* external sync */ 189static const int FB_SYNC_EXT = 4; /* external sync */
188#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ 190static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */
189#endif 191#endif
190static int readmode(struct fb_var_screeninfo *base, const char *fn, 192static int readmode(struct fb_var_screeninfo *base, const char *fn,
191 const char *mode) 193 const char *mode)
diff --git a/fsck_minix.c b/fsck_minix.c
index b35e6bb07..18841ec56 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -104,24 +104,24 @@ typedef unsigned short u16;
104typedef unsigned int u32; 104typedef unsigned int u32;
105 105
106 106
107#define MINIX_ROOT_INO 1 107static const int MINIX_ROOT_INO = 1;
108#define MINIX_LINK_MAX 250 108static const int MINIX_LINK_MAX = 250;
109#define MINIX2_LINK_MAX 65530 109static const int MINIX2_LINK_MAX = 65530;
110 110
111#define MINIX_I_MAP_SLOTS 8 111static const int MINIX_I_MAP_SLOTS = 8;
112#define MINIX_Z_MAP_SLOTS 64 112static const int MINIX_Z_MAP_SLOTS = 64;
113#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 113static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
114#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ 114static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
115#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ 115static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
116#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ 116static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
117#define MINIX_VALID_FS 0x0001 /* Clean fs. */ 117static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
118#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ 118static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
119 119
120#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) 120#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
121#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) 121#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
122 122
123#define MINIX_V1 0x0001 /* original minix fs */ 123static const int MINIX_V1 = 0x0001; /* original minix fs */
124#define MINIX_V2 0x0002 /* minix V2 fs */ 124static const int MINIX_V2 = 0x0002; /* minix V2 fs */
125 125
126#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version 126#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
127 127
@@ -185,12 +185,6 @@ struct minix_dir_entry {
185 185
186#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) 186#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
187 187
188#define MINIX_VALID_FS 0x0001 /* Clean fs. */
189#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
190
191#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
192#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
193
194#ifndef BLKGETSIZE 188#ifndef BLKGETSIZE
195#define BLKGETSIZE _IO(0x12,96) /* return device size */ 189#define BLKGETSIZE _IO(0x12,96) /* return device size */
196#endif 190#endif
@@ -199,7 +193,7 @@ struct minix_dir_entry {
199#define volatile 193#define volatile
200#endif 194#endif
201 195
202#define ROOT_INO 1 196static const int ROOT_INO = 1;
203 197
204#define UPPER(size,n) ((size+((n)-1))/(n)) 198#define UPPER(size,n) ((size+((n)-1))/(n))
205#define INODE_SIZE (sizeof(struct minix_inode)) 199#define INODE_SIZE (sizeof(struct minix_inode))
@@ -231,7 +225,7 @@ static struct termios termios;
231static int termios_set = 0; 225static int termios_set = 0;
232 226
233/* File-name data */ 227/* File-name data */
234#define MAX_DEPTH 32 228static const int MAX_DEPTH = 32;
235static int name_depth = 0; 229static int name_depth = 0;
236// static char name_list[MAX_DEPTH][BUFSIZ + 1]; 230// static char name_list[MAX_DEPTH][BUFSIZ + 1];
237static char **name_list = NULL; 231static char **name_list = NULL;
diff --git a/getopt.c b/getopt.c
index 0ebf9df08..ff55a3e3c 100644
--- a/getopt.c
+++ b/getopt.c
@@ -53,9 +53,9 @@
53 53
54/* NON_OPT is the code that is returned when a non-option is found in '+' 54/* NON_OPT is the code that is returned when a non-option is found in '+'
55 mode */ 55 mode */
56#define NON_OPT 1 56static const int NON_OPT = 1;
57/* LONG_OPT is the code that is returned when a long option is found. */ 57/* LONG_OPT is the code that is returned when a long option is found. */
58#define LONG_OPT 2 58static const int LONG_OPT = 2;
59 59
60/* The shells recognized. */ 60/* The shells recognized. */
61typedef enum {BASH,TCSH} shell_t; 61typedef enum {BASH,TCSH} shell_t;
@@ -199,7 +199,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
199static struct option *long_options=NULL; 199static struct option *long_options=NULL;
200static int long_options_length=0; /* Length of array */ 200static int long_options_length=0; /* Length of array */
201static int long_options_nr=0; /* Nr of used elements in array */ 201static int long_options_nr=0; /* Nr of used elements in array */
202#define LONG_OPTIONS_INCR 10 202static const int LONG_OPTIONS_INCR = 10;
203#define init_longopt() add_longopt(NULL,0) 203#define init_longopt() add_longopt(NULL,0)
204 204
205/* Register a long option. The contents of name is copied. */ 205/* Register a long option. The contents of name is copied. */
diff --git a/gunzip.c b/gunzip.c
index 8558573ba..194921682 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -76,40 +76,40 @@ static char *license_msg[] = {
76#define bb_need_name_too_long 76#define bb_need_name_too_long
77#include "messages.c" 77#include "messages.c"
78 78
79#define RECORD_IO 0 79static const int RECORD_IO = 0;
80 80
81/* Return codes from gzip */ 81/* Return codes from gzip */
82#define OK 0 82static const int OK = 0;
83#define ERROR 1 83static const int ERROR = 1;
84#define WARNING 2 84static const int WARNING = 2;
85 85
86#define DEFLATED 8 86static const int DEFLATED = 8;
87#define INBUFSIZ 0x2000 /* input buffer size */ 87static const int INBUFSIZ = 0x2000; /* input buffer size */
88#define INBUF_EXTRA 64 /* required by unlzw() */ 88static const int INBUF_EXTRA = 64; /* required by unlzw() */
89#define OUTBUFSIZ 8192 /* output buffer size */ 89static const int OUTBUFSIZ = 8192; /* output buffer size */
90#define OUTBUF_EXTRA 2048 /* required by unlzw() */ 90static const int OUTBUF_EXTRA = 2048; /* required by unlzw() */
91#define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */ 91static const int DIST_BUFSIZE = 0x2000; /* buffer for distances, see trees.c */
92 92
93#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */ 93#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
94 94
95/* gzip flag byte */ 95/* gzip flag byte */
96#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ 96static const int EXTRA_FIELD = 0x04; /* bit 2 set: extra field present */
97#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ 97static const int ORIG_NAME = 0x08; /* bit 3 set: original file name present */
98#define COMMENT 0x10 /* bit 4 set: file comment present */ 98static const int COMMENT = 0x10; /* bit 4 set: file comment present */
99#define WSIZE 0x8000 /* window size--must be a power of two, and */ 99static const int WSIZE = 0x8000; /* window size--must be a power of two, and */
100 /* at least 32K for zip's deflate method */ 100 /* at least 32K for zip's deflate method */
101 101
102/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ 102/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
103#define BMAX 16 /* maximum bit length of any code (16 for explode) */ 103static const int BMAX = 16; /* maximum bit length of any code (16 for explode) */
104#define N_MAX 288 /* maximum number of codes in any set */ 104static const int N_MAX = 288; /* maximum number of codes in any set */
105 105
106/* PKZIP header definitions */ 106/* PKZIP header definitions */
107#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ 107static const int LOCSIG = 0x04034b50L; /* four-byte lead-in (lsb first) */
108#define LOCCRC 14 /* offset of crc */ 108static const int LOCCRC = 14; /* offset of crc */
109#define LOCLEN 22 /* offset of uncompressed length */ 109static const int LOCLEN = 22; /* offset of uncompressed length */
110#define EXTHDR 16 /* size of extended local header, inc sig */ 110static const int EXTHDR = 16; /* size of extended local header, inc sig */
111 111
112#define BITS 16 112static const int BITS = 16;
113 113
114/* Diagnostic functions */ 114/* Diagnostic functions */
115#ifdef DEBUG 115#ifdef DEBUG
@@ -132,7 +132,7 @@ static char *license_msg[] = {
132# ifdef BUFSIZ 132# ifdef BUFSIZ
133# define MAX_PATH_LEN BUFSIZ 133# define MAX_PATH_LEN BUFSIZ
134# else 134# else
135# define MAX_PATH_LEN 1024 135static const int MAX_PATH_LEN = 1024;
136# endif 136# endif
137#endif 137#endif
138 138
@@ -165,8 +165,8 @@ static ush *tab_prefix1;
165/* local variables */ 165/* local variables */
166static int test_mode = 0; /* check file integrity option */ 166static int test_mode = 0; /* check file integrity option */
167static int foreground; /* set if program run in foreground */ 167static int foreground; /* set if program run in foreground */
168static int method = DEFLATED; /* compression method */ 168static int method; /* compression method */
169static int exit_code = OK; /* program exit code */ 169static int exit_code; /* program exit code */
170static int last_member; /* set for .zip and .Z files */ 170static int last_member; /* set for .zip and .Z files */
171static int part_nb; /* number of parts in .gz file */ 171static int part_nb; /* number of parts in .gz file */
172static long ifile_size; /* input file size, -1 for devices (debug only) */ 172static long ifile_size; /* input file size, -1 for devices (debug only) */
@@ -1225,6 +1225,9 @@ int gunzip_main(int argc, char **argv)
1225 char ifname[MAX_PATH_LEN + 1]; /* input file name */ 1225 char ifname[MAX_PATH_LEN + 1]; /* input file name */
1226 char ofname[MAX_PATH_LEN + 1]; /* output file name */ 1226 char ofname[MAX_PATH_LEN + 1]; /* output file name */
1227 1227
1228 method = DEFLATED; /* default compression method */
1229 exit_code = OK; /* let's go out on a limb and assume everything will run fine (wink wink) */
1230
1228 if (strcmp(applet_name, "zcat") == 0) { 1231 if (strcmp(applet_name, "zcat") == 0) {
1229 force = 1; 1232 force = 1;
1230 tostdout = 1; 1233 tostdout = 1;
diff --git a/init.c b/init.c
index 0e9b74195..ac0f72bfc 100644
--- a/init.c
+++ b/init.c
@@ -56,7 +56,7 @@ struct vt_stat {
56 unsigned short v_signal; /* signal to send */ 56 unsigned short v_signal; /* signal to send */
57 unsigned short v_state; /* vt bitmask */ 57 unsigned short v_state; /* vt bitmask */
58}; 58};
59#define VT_GETSTATE 0x5603 /* get global vt state info */ 59static const int VT_GETSTATE = 0x5603; /* get global vt state info */
60 60
61/* From <linux/serial.h> */ 61/* From <linux/serial.h> */
62struct serial_struct { 62struct serial_struct {
@@ -79,11 +79,11 @@ struct serial_struct {
79 79
80 80
81#ifndef RB_HALT_SYSTEM 81#ifndef RB_HALT_SYSTEM
82#define RB_HALT_SYSTEM 0xcdef0123 82static const int RB_HALT_SYSTEM = 0xcdef0123;
83#define RB_ENABLE_CAD 0x89abcdef 83static const int RB_ENABLE_CAD = 0x89abcdef;
84#define RB_DISABLE_CAD 0 84static const int RB_DISABLE_CAD = 0;
85#define RB_POWER_OFF 0x4321fedc 85#define RB_POWER_OFF 0x4321fedc
86#define RB_AUTOBOOT 0x01234567 86static const int RB_AUTOBOOT = 0x01234567;
87#if defined(__GLIBC__) || defined (__UCLIBC__) 87#if defined(__GLIBC__) || defined (__UCLIBC__)
88#include <sys/reboot.h> 88#include <sys/reboot.h>
89 #define init_reboot(magic) reboot(magic) 89 #define init_reboot(magic) reboot(magic)
@@ -131,8 +131,8 @@ static _syscall2(int, bdflush, int, func, int, data);
131#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ 131#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
132#endif 132#endif
133 133
134#define LOG 0x1 134static const int LOG = 0x1;
135#define CONSOLE 0x2 135static const int CONSOLE = 0x2;
136 136
137/* Allowed init action types */ 137/* Allowed init action types */
138typedef enum { 138typedef enum {
diff --git a/init/init.c b/init/init.c
index 0e9b74195..ac0f72bfc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -56,7 +56,7 @@ struct vt_stat {
56 unsigned short v_signal; /* signal to send */ 56 unsigned short v_signal; /* signal to send */
57 unsigned short v_state; /* vt bitmask */ 57 unsigned short v_state; /* vt bitmask */
58}; 58};
59#define VT_GETSTATE 0x5603 /* get global vt state info */ 59static const int VT_GETSTATE = 0x5603; /* get global vt state info */
60 60
61/* From <linux/serial.h> */ 61/* From <linux/serial.h> */
62struct serial_struct { 62struct serial_struct {
@@ -79,11 +79,11 @@ struct serial_struct {
79 79
80 80
81#ifndef RB_HALT_SYSTEM 81#ifndef RB_HALT_SYSTEM
82#define RB_HALT_SYSTEM 0xcdef0123 82static const int RB_HALT_SYSTEM = 0xcdef0123;
83#define RB_ENABLE_CAD 0x89abcdef 83static const int RB_ENABLE_CAD = 0x89abcdef;
84#define RB_DISABLE_CAD 0 84static const int RB_DISABLE_CAD = 0;
85#define RB_POWER_OFF 0x4321fedc 85#define RB_POWER_OFF 0x4321fedc
86#define RB_AUTOBOOT 0x01234567 86static const int RB_AUTOBOOT = 0x01234567;
87#if defined(__GLIBC__) || defined (__UCLIBC__) 87#if defined(__GLIBC__) || defined (__UCLIBC__)
88#include <sys/reboot.h> 88#include <sys/reboot.h>
89 #define init_reboot(magic) reboot(magic) 89 #define init_reboot(magic) reboot(magic)
@@ -131,8 +131,8 @@ static _syscall2(int, bdflush, int, func, int, data);
131#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ 131#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
132#endif 132#endif
133 133
134#define LOG 0x1 134static const int LOG = 0x1;
135#define CONSOLE 0x2 135static const int CONSOLE = 0x2;
136 136
137/* Allowed init action types */ 137/* Allowed init action types */
138typedef enum { 138typedef enum {
diff --git a/insmod.c b/insmod.c
index a499bcdaa..be27a1f2b 100644
--- a/insmod.c
+++ b/insmod.c
@@ -76,9 +76,9 @@
76 76
77 77
78#ifndef MODUTILS_MODULE_H 78#ifndef MODUTILS_MODULE_H
79#define MODUTILS_MODULE_H 1 79static const int MODUTILS_MODULE_H = 1;
80 80
81#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" 81#ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
82 82
83/* This file contains the structures used by the 2.0 and 2.1 kernels. 83/* This file contains the structures used by the 2.0 and 2.1 kernels.
84 We do not use the kernel headers directly because we do not wish 84 We do not use the kernel headers directly because we do not wish
@@ -135,7 +135,7 @@ struct old_module
135}; 135};
136 136
137/* Sent to init_module(2) or'ed into the code size parameter. */ 137/* Sent to init_module(2) or'ed into the code size parameter. */
138#define OLD_MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ 138static const int OLD_MOD_AUTOCLEAN = 0x40000000; /* big enough, but no sign problems... */
139 139
140int get_kernel_syms(struct old_kernel_sym *); 140int get_kernel_syms(struct old_kernel_sym *);
141int old_sys_init_module(const char *name, char *code, unsigned codesize, 141int old_sys_init_module(const char *name, char *code, unsigned codesize,
@@ -158,9 +158,9 @@ int old_sys_init_module(const char *name, char *code, unsigned codesize,
158#undef tgt_sizeof_char_p 158#undef tgt_sizeof_char_p
159#undef tgt_sizeof_void_p 159#undef tgt_sizeof_void_p
160#undef tgt_long 160#undef tgt_long
161#define tgt_sizeof_long 8 161static const int tgt_sizeof_long = 8;
162#define tgt_sizeof_char_p 8 162static const int tgt_sizeof_char_p = 8;
163#define tgt_sizeof_void_p 8 163static const int tgt_sizeof_void_p = 8;
164#define tgt_long long long 164#define tgt_long long long
165#endif 165#endif
166 166
@@ -222,11 +222,11 @@ struct new_module_info
222}; 222};
223 223
224/* Bits of module.flags. */ 224/* Bits of module.flags. */
225#define NEW_MOD_RUNNING 1 225static const int NEW_MOD_RUNNING = 1;
226#define NEW_MOD_DELETED 2 226static const int NEW_MOD_DELETED = 2;
227#define NEW_MOD_AUTOCLEAN 4 227static const int NEW_MOD_AUTOCLEAN = 4;
228#define NEW_MOD_VISITED 8 228static const int NEW_MOD_VISITED = 8;
229#define NEW_MOD_USED_ONCE 16 229static const int NEW_MOD_USED_ONCE = 16;
230 230
231int new_sys_init_module(const char *name, const struct new_module *); 231int new_sys_init_module(const char *name, const struct new_module *);
232int query_module(const char *name, int which, void *buf, size_t bufsize, 232int query_module(const char *name, int which, void *buf, size_t bufsize,
@@ -234,11 +234,11 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
234 234
235/* Values for query_module's which. */ 235/* Values for query_module's which. */
236 236
237#define QM_MODULES 1 237static const int QM_MODULES = 1;
238#define QM_DEPS 2 238static const int QM_DEPS = 2;
239#define QM_REFS 3 239static const int QM_REFS = 3;
240#define QM_SYMBOLS 4 240static const int QM_SYMBOLS = 4;
241#define QM_INFO 5 241static const int QM_INFO = 5;
242 242
243/*======================================================================*/ 243/*======================================================================*/
244/* The system calls unchanged between 2.0 and 2.1. */ 244/* The system calls unchanged between 2.0 and 2.1. */
@@ -282,9 +282,9 @@ int delete_module(const char *);
282 282
283 283
284#ifndef MODUTILS_OBJ_H 284#ifndef MODUTILS_OBJ_H
285#define MODUTILS_OBJ_H 1 285static const int MODUTILS_OBJ_H = 1;
286 286
287#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" 287#ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
288 288
289/* The relocatable object is manipulated using elfin types. */ 289/* The relocatable object is manipulated using elfin types. */
290 290
@@ -517,7 +517,7 @@ int arch_init_module (struct obj_file *f, struct new_module *);
517 517
518 518
519#define _PATH_MODULES "/lib/modules" 519#define _PATH_MODULES "/lib/modules"
520#define STRVERSIONLEN 32 520static const int STRVERSIONLEN = 32;
521 521
522#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL) 522#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
523#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined" 523#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"
diff --git a/kill.c b/kill.c
index 8fa9da77d..19ca187a7 100644
--- a/kill.c
+++ b/kill.c
@@ -30,8 +30,8 @@
30#include <ctype.h> 30#include <ctype.h>
31#include <unistd.h> 31#include <unistd.h>
32 32
33#define KILL 0 33static const int KILL = 0;
34#define KILLALL 1 34static const int KILLALL = 1;
35 35
36struct signal_name { 36struct signal_name {
37 const char *name; 37 const char *name;
diff --git a/lash.c b/lash.c
index 52c87ee7f..b9685ab31 100644
--- a/lash.c
+++ b/lash.c
@@ -64,8 +64,8 @@
64#include <getopt.h> 64#include <getopt.h>
65#include "cmdedit.h" 65#include "cmdedit.h"
66 66
67#define MAX_LINE 256 /* size of input buffer for cwd data */ 67static const int MAX_LINE = 256; /* size of input buffer for cwd data */
68#define MAX_READ 128 /* size of input buffer for `read' builtin */ 68static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
70extern size_t NUM_APPLETS; 70extern size_t NUM_APPLETS;
71 71
diff --git a/ln.c b/ln.c
index ead5322fa..e69cb024a 100644
--- a/ln.c
+++ b/ln.c
@@ -30,9 +30,9 @@
30#include <dirent.h> 30#include <dirent.h>
31#include <errno.h> 31#include <errno.h>
32 32
33#define LN_SYMLINK 1 33static const int LN_SYMLINK = 1;
34#define LN_FORCE 2 34static const int LN_FORCE = 2;
35#define LN_NODEREFERENCE 4 35static const int LN_NODEREFERENCE = 4;
36 36
37/* 37/*
38 * linkDestName is where the link points to, 38 * linkDestName is where the link points to,
diff --git a/loadfont.c b/loadfont.c
index 13a196fb0..08e07618e 100644
--- a/loadfont.c
+++ b/loadfont.c
@@ -21,13 +21,13 @@
21#include <sys/kd.h> 21#include <sys/kd.h>
22#include <endian.h> 22#include <endian.h>
23 23
24#define PSF_MAGIC1 0x36 24static const int PSF_MAGIC1 = 0x36;
25#define PSF_MAGIC2 0x04 25static const int PSF_MAGIC2 = 0x04;
26 26
27#define PSF_MODE512 0x01 27static const int PSF_MODE512 = 0x01;
28#define PSF_MODEHASTAB 0x02 28static const int PSF_MODEHASTAB = 0x02;
29#define PSF_MAXMODE 0x03 29static const int PSF_MAXMODE = 0x03;
30#define PSF_SEPARATOR 0xFFFF 30static const int PSF_SEPARATOR = 0xFFFF;
31 31
32struct psf_header { 32struct psf_header {
33 unsigned char magic1, magic2; /* Magic number */ 33 unsigned char magic1, magic2; /* Magic number */
diff --git a/loadkmap.c b/loadkmap.c
index fc2439864..43c1cc795 100644
--- a/loadkmap.c
+++ b/loadkmap.c
@@ -34,11 +34,11 @@ struct kbentry {
34 unsigned char kb_index; 34 unsigned char kb_index;
35 unsigned short kb_value; 35 unsigned short kb_value;
36}; 36};
37#define KDSKBENT 0x4B47 /* sets one entry in translation table */ 37static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
38 38
39/* From <linux/keyboard.h> */ 39/* From <linux/keyboard.h> */
40#define NR_KEYS 128 40static const int NR_KEYS = 128;
41#define MAX_NR_KEYMAPS 256 41static const int MAX_NR_KEYMAPS = 256;
42 42
43int loadkmap_main(int argc, char **argv) 43int loadkmap_main(int argc, char **argv)
44{ 44{
diff --git a/ls.c b/ls.c
index 754a6d450..080768027 100644
--- a/ls.c
+++ b/ls.c
@@ -41,9 +41,9 @@
41 * 1. requires lstat (BSD) - how do you do it without? 41 * 1. requires lstat (BSD) - how do you do it without?
42 */ 42 */
43 43
44#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ 44static const int TERMINAL_WIDTH = 80; /* use 79 if your terminal has linefold bug */
45#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ 45static const int COLUMN_WIDTH = 14; /* default if AUTOWIDTH not defined */
46#define COLUMN_GAP 2 /* includes the file type char, if present */ 46static const int COLUMN_GAP = 2; /* includes the file type char, if present */
47 47
48/************************************************************************/ 48/************************************************************************/
49 49
@@ -66,10 +66,12 @@
66#endif 66#endif
67 67
68/* what is the overall style of the listing */ 68/* what is the overall style of the listing */
69#define STYLE_AUTO 0 69enum {
70#define STYLE_LONG 1 /* one record per line, extended info */ 70STYLE_AUTO = 0,
71#define STYLE_SINGLE 2 /* one record per line */ 71STYLE_LONG = 1, /* one record per line, extended info */
72#define STYLE_COLUMNS 3 /* fill columns */ 72STYLE_SINGLE = 2, /* one record per line */
73STYLE_COLUMNS = 3 /* fill columns */
74};
73 75
74/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ 76/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */
75/* what file information will be listed */ 77/* what file information will be listed */
@@ -99,23 +101,23 @@
99 101
100#ifdef BB_FEATURE_LS_SORTFILES 102#ifdef BB_FEATURE_LS_SORTFILES
101/* how will the files be sorted */ 103/* how will the files be sorted */
102#define SORT_FORWARD 0 /* sort in reverse order */ 104static const int SORT_FORWARD = 0; /* sort in reverse order */
103#define SORT_REVERSE 1 /* sort in reverse order */ 105static const int SORT_REVERSE = 1; /* sort in reverse order */
104#define SORT_NAME 2 /* sort by file name */ 106static const int SORT_NAME = 2; /* sort by file name */
105#define SORT_SIZE 3 /* sort by file size */ 107static const int SORT_SIZE = 3; /* sort by file size */
106#define SORT_ATIME 4 /* sort by last access time */ 108static const int SORT_ATIME = 4; /* sort by last access time */
107#define SORT_CTIME 5 /* sort by last change time */ 109static const int SORT_CTIME = 5; /* sort by last change time */
108#define SORT_MTIME 6 /* sort by last modification time */ 110static const int SORT_MTIME = 6; /* sort by last modification time */
109#define SORT_VERSION 7 /* sort by version */ 111static const int SORT_VERSION = 7; /* sort by version */
110#define SORT_EXT 8 /* sort by file name extension */ 112static const int SORT_EXT = 8; /* sort by file name extension */
111#define SORT_DIR 9 /* sort by file or directory */ 113static const int SORT_DIR = 9; /* sort by file or directory */
112#endif 114#endif
113 115
114#ifdef BB_FEATURE_LS_TIMESTAMPS 116#ifdef BB_FEATURE_LS_TIMESTAMPS
115/* which of the three times will be used */ 117/* which of the three times will be used */
116#define TIME_MOD 0 118static const int TIME_MOD = 0;
117#define TIME_CHANGE 1 119static const int TIME_CHANGE = 1;
118#define TIME_ACCESS 2 120static const int TIME_ACCESS = 2;
119#endif 121#endif
120 122
121#define LIST_SHORT (LIST_FILENAME) 123#define LIST_SHORT (LIST_FILENAME)
@@ -125,9 +127,9 @@
125 LIST_SYMLINK) 127 LIST_SYMLINK)
126#define LIST_ILONG (LIST_INO | LIST_LONG) 128#define LIST_ILONG (LIST_INO | LIST_LONG)
127 129
128#define SPLIT_DIR 0 130static const int SPLIT_DIR = 0;
129#define SPLIT_FILE 1 131static const int SPLIT_FILE = 1;
130#define SPLIT_SUBDIR 2 132static const int SPLIT_SUBDIR = 2;
131 133
132#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) 134#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
133#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) 135#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
@@ -150,15 +152,15 @@ struct dnode **list_dir(char *);
150struct dnode **dnalloc(int); 152struct dnode **dnalloc(int);
151int list_single(struct dnode *); 153int list_single(struct dnode *);
152 154
153static unsigned int disp_opts= DISP_NORMAL; 155static unsigned int disp_opts;
154static unsigned int style_fmt= STYLE_AUTO ; 156static unsigned int style_fmt;
155static unsigned int list_fmt= LIST_SHORT ; 157static unsigned int list_fmt;
156#ifdef BB_FEATURE_LS_SORTFILES 158#ifdef BB_FEATURE_LS_SORTFILES
157static unsigned int sort_opts= SORT_FORWARD; 159static unsigned int sort_opts;
158static unsigned int sort_order= SORT_FORWARD; 160static unsigned int sort_order;
159#endif 161#endif
160#ifdef BB_FEATURE_LS_TIMESTAMPS 162#ifdef BB_FEATURE_LS_TIMESTAMPS
161static unsigned int time_fmt= TIME_MOD; 163static unsigned int time_fmt;
162#endif 164#endif
163#ifdef BB_FEATURE_LS_FOLLOWLINKS 165#ifdef BB_FEATURE_LS_FOLLOWLINKS
164static unsigned int follow_links=FALSE; 166static unsigned int follow_links=FALSE;
@@ -166,12 +168,9 @@ static unsigned int follow_links=FALSE;
166 168
167static unsigned short column = 0; 169static unsigned short column = 0;
168#ifdef BB_FEATURE_AUTOWIDTH 170#ifdef BB_FEATURE_AUTOWIDTH
169static unsigned short terminal_width = TERMINAL_WIDTH; 171static unsigned short terminal_width;
170static unsigned short column_width = COLUMN_WIDTH; 172static unsigned short column_width;
171static unsigned short tabstops = 8; 173static unsigned short tabstops;
172#else
173#define terminal_width TERMINAL_WIDTH
174#define column_width COLUMN_WIDTH
175#endif 174#endif
176 175
177static int status = EXIT_SUCCESS; 176static int status = EXIT_SUCCESS;
@@ -710,10 +709,16 @@ extern int ls_main(int argc, char **argv)
710 list_fmt= LIST_SHORT; 709 list_fmt= LIST_SHORT;
711#ifdef BB_FEATURE_LS_SORTFILES 710#ifdef BB_FEATURE_LS_SORTFILES
712 sort_opts= SORT_NAME; 711 sort_opts= SORT_NAME;
712 sort_order= SORT_FORWARD;
713#endif 713#endif
714#ifdef BB_FEATURE_LS_TIMESTAMPS 714#ifdef BB_FEATURE_LS_TIMESTAMPS
715 time_fmt= TIME_MOD; 715 time_fmt= TIME_MOD;
716#endif 716#endif
717#ifdef BB_FEATURE_AUTOWIDTH
718 terminal_width = TERMINAL_WIDTH;
719 column_width = COLUMN_WIDTH;
720 tabstops = 8;
721#endif
717 nfiles=0; 722 nfiles=0;
718 723
719 /* process options */ 724 /* process options */
diff --git a/lsmod.c b/lsmod.c
index 4c50bf4bd..586920d63 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -59,19 +59,19 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
59 size_t *ret); 59 size_t *ret);
60 60
61/* Values for query_module's which. */ 61/* Values for query_module's which. */
62#define QM_MODULES 1 62static const int QM_MODULES = 1;
63#define QM_DEPS 2 63static const int QM_DEPS = 2;
64#define QM_REFS 3 64static const int QM_REFS = 3;
65#define QM_SYMBOLS 4 65static const int QM_SYMBOLS = 4;
66#define QM_INFO 5 66static const int QM_INFO = 5;
67 67
68/* Bits of module.flags. */ 68/* Bits of module.flags. */
69#define NEW_MOD_RUNNING 1 69static const int NEW_MOD_RUNNING = 1;
70#define NEW_MOD_DELETED 2 70static const int NEW_MOD_DELETED = 2;
71#define NEW_MOD_AUTOCLEAN 4 71static const int NEW_MOD_AUTOCLEAN = 4;
72#define NEW_MOD_VISITED 8 72static const int NEW_MOD_VISITED = 8;
73#define NEW_MOD_USED_ONCE 16 73static const int NEW_MOD_USED_ONCE = 16;
74#define NEW_MOD_INITIALIZING 64 74static const int NEW_MOD_INITIALIZING = 64;
75 75
76 76
77extern int lsmod_main(int argc, char **argv) 77extern int lsmod_main(int argc, char **argv)
diff --git a/md5sum.c b/md5sum.c
index 3458f2e05..ad4078040 100644
--- a/md5sum.c
+++ b/md5sum.c
@@ -91,7 +91,7 @@
91 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 91 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
92 92
93#ifndef _MD5_H 93#ifndef _MD5_H
94#define _MD5_H 1 94static const int _MD5_H = 1;
95 95
96#include <stdio.h> 96#include <stdio.h>
97 97
@@ -251,7 +251,7 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
251int md5_stream(FILE *stream, void *resblock) 251int md5_stream(FILE *stream, void *resblock)
252{ 252{
253 /* Important: BLOCKSIZE must be a multiple of 64. */ 253 /* Important: BLOCKSIZE must be a multiple of 64. */
254#define BLOCKSIZE 4096 254static const int BLOCKSIZE = 4096;
255 struct md5_ctx ctx; 255 struct md5_ctx ctx;
256 char buffer[BLOCKSIZE + 72]; 256 char buffer[BLOCKSIZE + 72];
257 size_t sum; 257 size_t sum;
@@ -529,7 +529,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
529/* The minimum length of a valid digest line in a file produced 529/* The minimum length of a valid digest line in a file produced
530 by `md5sum FILE' and read by `md5sum -c'. This length does 530 by `md5sum FILE' and read by `md5sum -c'. This length does
531 not include any newline character at the end of a line. */ 531 not include any newline character at the end of a line. */
532#define MIN_DIGEST_LINE_LENGTH 35 /* 32 - message digest length 532static const int MIN_DIGEST_LINE_LENGTH = 35; /* 32 - message digest length
533 2 - blank and binary indicator 533 2 - blank and binary indicator
534 1 - minimum filename length */ 534 1 - minimum filename length */
535 535
diff --git a/mkswap.c b/mkswap.c
index e7fab4e07..5b908daa3 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -48,7 +48,7 @@
48 48
49#ifndef _IO 49#ifndef _IO
50/* pre-1.3.45 */ 50/* pre-1.3.45 */
51#define BLKGETSIZE 0x1260 51static const int BLKGETSIZE = 0x1260;
52#else 52#else
53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ 53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
54#define BLKGETSIZE _IO(0x12,96) 54#define BLKGETSIZE _IO(0x12,96)
diff --git a/modutils/insmod.c b/modutils/insmod.c
index a499bcdaa..be27a1f2b 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -76,9 +76,9 @@
76 76
77 77
78#ifndef MODUTILS_MODULE_H 78#ifndef MODUTILS_MODULE_H
79#define MODUTILS_MODULE_H 1 79static const int MODUTILS_MODULE_H = 1;
80 80
81#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" 81#ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
82 82
83/* This file contains the structures used by the 2.0 and 2.1 kernels. 83/* This file contains the structures used by the 2.0 and 2.1 kernels.
84 We do not use the kernel headers directly because we do not wish 84 We do not use the kernel headers directly because we do not wish
@@ -135,7 +135,7 @@ struct old_module
135}; 135};
136 136
137/* Sent to init_module(2) or'ed into the code size parameter. */ 137/* Sent to init_module(2) or'ed into the code size parameter. */
138#define OLD_MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ 138static const int OLD_MOD_AUTOCLEAN = 0x40000000; /* big enough, but no sign problems... */
139 139
140int get_kernel_syms(struct old_kernel_sym *); 140int get_kernel_syms(struct old_kernel_sym *);
141int old_sys_init_module(const char *name, char *code, unsigned codesize, 141int old_sys_init_module(const char *name, char *code, unsigned codesize,
@@ -158,9 +158,9 @@ int old_sys_init_module(const char *name, char *code, unsigned codesize,
158#undef tgt_sizeof_char_p 158#undef tgt_sizeof_char_p
159#undef tgt_sizeof_void_p 159#undef tgt_sizeof_void_p
160#undef tgt_long 160#undef tgt_long
161#define tgt_sizeof_long 8 161static const int tgt_sizeof_long = 8;
162#define tgt_sizeof_char_p 8 162static const int tgt_sizeof_char_p = 8;
163#define tgt_sizeof_void_p 8 163static const int tgt_sizeof_void_p = 8;
164#define tgt_long long long 164#define tgt_long long long
165#endif 165#endif
166 166
@@ -222,11 +222,11 @@ struct new_module_info
222}; 222};
223 223
224/* Bits of module.flags. */ 224/* Bits of module.flags. */
225#define NEW_MOD_RUNNING 1 225static const int NEW_MOD_RUNNING = 1;
226#define NEW_MOD_DELETED 2 226static const int NEW_MOD_DELETED = 2;
227#define NEW_MOD_AUTOCLEAN 4 227static const int NEW_MOD_AUTOCLEAN = 4;
228#define NEW_MOD_VISITED 8 228static const int NEW_MOD_VISITED = 8;
229#define NEW_MOD_USED_ONCE 16 229static const int NEW_MOD_USED_ONCE = 16;
230 230
231int new_sys_init_module(const char *name, const struct new_module *); 231int new_sys_init_module(const char *name, const struct new_module *);
232int query_module(const char *name, int which, void *buf, size_t bufsize, 232int query_module(const char *name, int which, void *buf, size_t bufsize,
@@ -234,11 +234,11 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
234 234
235/* Values for query_module's which. */ 235/* Values for query_module's which. */
236 236
237#define QM_MODULES 1 237static const int QM_MODULES = 1;
238#define QM_DEPS 2 238static const int QM_DEPS = 2;
239#define QM_REFS 3 239static const int QM_REFS = 3;
240#define QM_SYMBOLS 4 240static const int QM_SYMBOLS = 4;
241#define QM_INFO 5 241static const int QM_INFO = 5;
242 242
243/*======================================================================*/ 243/*======================================================================*/
244/* The system calls unchanged between 2.0 and 2.1. */ 244/* The system calls unchanged between 2.0 and 2.1. */
@@ -282,9 +282,9 @@ int delete_module(const char *);
282 282
283 283
284#ifndef MODUTILS_OBJ_H 284#ifndef MODUTILS_OBJ_H
285#define MODUTILS_OBJ_H 1 285static const int MODUTILS_OBJ_H = 1;
286 286
287#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" 287#ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
288 288
289/* The relocatable object is manipulated using elfin types. */ 289/* The relocatable object is manipulated using elfin types. */
290 290
@@ -517,7 +517,7 @@ int arch_init_module (struct obj_file *f, struct new_module *);
517 517
518 518
519#define _PATH_MODULES "/lib/modules" 519#define _PATH_MODULES "/lib/modules"
520#define STRVERSIONLEN 32 520static const int STRVERSIONLEN = 32;
521 521
522#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL) 522#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
523#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined" 523#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 4c50bf4bd..586920d63 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -59,19 +59,19 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
59 size_t *ret); 59 size_t *ret);
60 60
61/* Values for query_module's which. */ 61/* Values for query_module's which. */
62#define QM_MODULES 1 62static const int QM_MODULES = 1;
63#define QM_DEPS 2 63static const int QM_DEPS = 2;
64#define QM_REFS 3 64static const int QM_REFS = 3;
65#define QM_SYMBOLS 4 65static const int QM_SYMBOLS = 4;
66#define QM_INFO 5 66static const int QM_INFO = 5;
67 67
68/* Bits of module.flags. */ 68/* Bits of module.flags. */
69#define NEW_MOD_RUNNING 1 69static const int NEW_MOD_RUNNING = 1;
70#define NEW_MOD_DELETED 2 70static const int NEW_MOD_DELETED = 2;
71#define NEW_MOD_AUTOCLEAN 4 71static const int NEW_MOD_AUTOCLEAN = 4;
72#define NEW_MOD_VISITED 8 72static const int NEW_MOD_VISITED = 8;
73#define NEW_MOD_USED_ONCE 16 73static const int NEW_MOD_USED_ONCE = 16;
74#define NEW_MOD_INITIALIZING 64 74static const int NEW_MOD_INITIALIZING = 64;
75 75
76 76
77extern int lsmod_main(int argc, char **argv) 77extern int lsmod_main(int argc, char **argv)
diff --git a/mount.c b/mount.c
index 88e45fc72..f78786ebc 100644
--- a/mount.c
+++ b/mount.c
@@ -55,21 +55,21 @@
55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ 55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
56#endif 56#endif
57 57
58 58enum {
59#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
60#define MS_RDONLY 1 /* Mount read-only */ 60 MS_RDONLY = 1, /* Mount read-only */
61#define MS_NOSUID 2 /* Ignore suid and sgid bits */ 61 MS_NOSUID = 2, /* Ignore suid and sgid bits */
62#define MS_NODEV 4 /* Disallow access to device special files */ 62 MS_NODEV = 4, /* Disallow access to device special files */
63#define MS_NOEXEC 8 /* Disallow program execution */ 63 MS_NOEXEC = 8, /* Disallow program execution */
64#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ 64 MS_SYNCHRONOUS = 16, /* Writes are synced at once */
65#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ 65 MS_REMOUNT = 32, /* Alter flags of a mounted FS */
66#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ 66 MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
67#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ 67 S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
68#define S_APPEND 256 /* Append-only file */ 68 S_APPEND = 256, /* Append-only file */
69#define S_IMMUTABLE 512 /* Immutable file */ 69 S_IMMUTABLE = 512, /* Immutable file */
70#define MS_NOATIME 1024 /* Do not update access times. */ 70 MS_NOATIME = 1024, /* Do not update access times. */
71#define MS_NODIRATIME 2048 /* Do not update directory access times */ 71 MS_NODIRATIME = 2048, /* Do not update directory access times */
72 72};
73 73
74 74
75#if defined BB_FEATURE_MOUNT_LOOP 75#if defined BB_FEATURE_MOUNT_LOOP
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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $ 3 * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -58,7 +58,7 @@
58#if ! defined __GLIBC__ && ! defined __UCLIBC__ 58#if ! defined __GLIBC__ && ! defined __UCLIBC__
59typedef unsigned int socklen_t; 59typedef unsigned int socklen_t;
60 60
61#define ICMP_MINLEN 8 /* abs minimum */ 61static const int ICMP_MINLEN = 8; /* abs minimum */
62 62
63struct icmp_ra_addr 63struct icmp_ra_addr
64{ 64{
@@ -134,13 +134,13 @@ struct icmp
134}; 134};
135#endif 135#endif
136 136
137#define DEFDATALEN 56 137static const int DEFDATALEN = 56;
138#define MAXIPLEN 60 138static const int MAXIPLEN = 60;
139#define MAXICMPLEN 76 139static const int MAXICMPLEN = 76;
140#define MAXPACKET 65468 140static const int MAXPACKET = 65468;
141#define MAX_DUP_CHK (8 * 128) 141#define MAX_DUP_CHK (8 * 128)
142#define MAXWAIT 10 142static const int MAXWAIT = 10;
143#define PINGINTERVAL 1 /* second */ 143static const int PINGINTERVAL = 1; /* second */
144 144
145#define O_QUIET (1 << 0) 145#define O_QUIET (1 << 0)
146 146
@@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv)
262static char *hostname = NULL; 262static char *hostname = NULL;
263static struct sockaddr_in pingaddr; 263static struct sockaddr_in pingaddr;
264static int pingsock = -1; 264static int pingsock = -1;
265static int datalen = DEFDATALEN; 265static int datalen; /* intentionally uninitialized to work around gcc bug */
266 266
267static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; 267static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0;
268static int myid = 0, options = 0; 268static int myid = 0, options = 0;
@@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv)
508{ 508{
509 char *thisarg; 509 char *thisarg;
510 510
511 datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
512
511 argc--; 513 argc--;
512 argv++; 514 argv++;
513 options = 0; 515 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 @@
50#include <netdb.h> 50#include <netdb.h>
51 51
52#if 0 52#if 0
53#define DOTRACE 1 53static const int DOTRACE = 1;
54#endif 54#endif
55 55
56#ifdef DOTRACE 56#ifdef DOTRACE
@@ -67,21 +67,23 @@
67#include <sys/time.h> 67#include <sys/time.h>
68#endif 68#endif
69 69
70#define DATABUFSIZE 128 70static const int DATABUFSIZE = 128;
71#define IACBUFSIZE 128 71static const int IACBUFSIZE = 128;
72 72
73#define CHM_TRY 0 73static const int CHM_TRY = 0;
74#define CHM_ON 1 74static const int CHM_ON = 1;
75#define CHM_OFF 2 75static const int CHM_OFF = 2;
76 76
77#define UF_ECHO 0x01 77static const int UF_ECHO = 0x01;
78#define UF_SGA 0x02 78static const int UF_SGA = 0x02;
79 79
80#define TS_0 1 80enum {
81#define TS_IAC 2 81 TS_0 = 1,
82#define TS_OPT 3 82 TS_IAC = 2,
83#define TS_SUB1 4 83 TS_OPT = 3,
84#define TS_SUB2 5 84 TS_SUB1 = 4,
85 TS_SUB2 = 5,
86};
85 87
86#define WriteCS(fd, str) write(fd, str, sizeof str -1) 88#define WriteCS(fd, str) write(fd, str, sizeof str -1)
87 89
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. */
49static struct timeval start; /* Time a transfer started. */ 49static struct timeval start; /* Time a transfer started. */
50volatile unsigned long statbytes; /* Number of bytes transferred so far. */ 50volatile unsigned long statbytes; /* Number of bytes transferred so far. */
51/* For progressmeter() -- number of seconds before xfer considered "stalled" */ 51/* For progressmeter() -- number of seconds before xfer considered "stalled" */
52#define STALLTIME 5 52static const int STALLTIME = 5;
53#endif 53#endif
54 54
55int wget_main(int argc, char **argv) 55int wget_main(int argc, char **argv)
@@ -515,7 +515,7 @@ progressmeter(int flag)
515 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 515 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
516 * SUCH DAMAGE. 516 * SUCH DAMAGE.
517 * 517 *
518 * $Id: wget.c,v 1.17 2001/01/22 22:48:42 andersen Exp $ 518 * $Id: wget.c,v 1.18 2001/01/23 22:30:04 markw Exp $
519 */ 519 */
520 520
521 521
diff --git a/nfsmount.c b/nfsmount.c
index b5c38212a..d661a99a4 100644
--- a/nfsmount.c
+++ b/nfsmount.c
@@ -54,10 +54,10 @@
54#include <linux/nfs.h> /* For the kernels nfs stuff */ 54#include <linux/nfs.h> /* For the kernels nfs stuff */
55 55
56#ifndef NFS_FHSIZE 56#ifndef NFS_FHSIZE
57#define NFS_FHSIZE 32 57static const int NFS_FHSIZE = 32;
58#endif 58#endif
59#ifndef NFS_PORT 59#ifndef NFS_PORT
60#define NFS_PORT 2049 60static const int NFS_PORT = 2049;
61#endif 61#endif
62 62
63/* Disable the nls stuff */ 63/* Disable the nls stuff */
@@ -68,19 +68,19 @@
68# define _(Text) (Text) 68# define _(Text) (Text)
69# define N_(Text) (Text) 69# define N_(Text) (Text)
70 70
71#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 71static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
72#define MS_RDONLY 1 /* Mount read-only */ 72static const int MS_RDONLY = 1; /* Mount read-only */
73#define MS_NOSUID 2 /* Ignore suid and sgid bits */ 73static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */
74#define MS_NODEV 4 /* Disallow access to device special files */ 74static const int MS_NODEV = 4; /* Disallow access to device special files */
75#define MS_NOEXEC 8 /* Disallow program execution */ 75static const int MS_NOEXEC = 8; /* Disallow program execution */
76#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ 76static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */
77#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ 77static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */
78#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ 78static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */
79#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ 79static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */
80#define S_APPEND 256 /* Append-only file */ 80static const int S_APPEND = 256; /* Append-only file */
81#define S_IMMUTABLE 512 /* Immutable file */ 81static const int S_IMMUTABLE = 512; /* Immutable file */
82#define MS_NOATIME 1024 /* Do not update access times. */ 82static const int MS_NOATIME = 1024; /* Do not update access times. */
83#define MS_NODIRATIME 2048 /* Do not update directory access times */ 83static const int MS_NODIRATIME = 2048; /* Do not update directory access times */
84 84
85 85
86/* 86/*
@@ -93,7 +93,7 @@
93 * so it is easiest to ignore the kernel altogether (at compile time). 93 * so it is easiest to ignore the kernel altogether (at compile time).
94 */ 94 */
95 95
96#define NFS_MOUNT_VERSION 4 96static const int NFS_MOUNT_VERSION = 4;
97 97
98struct nfs2_fh { 98struct nfs2_fh {
99 char data[32]; 99 char data[32];
@@ -125,16 +125,16 @@ struct nfs_mount_data {
125 125
126/* bits in the flags field */ 126/* bits in the flags field */
127 127
128#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 128static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */
129#define NFS_MOUNT_INTR 0x0002 /* 1 */ 129static const int NFS_MOUNT_INTR = 0x0002; /* 1 */
130#define NFS_MOUNT_SECURE 0x0004 /* 1 */ 130static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */
131#define NFS_MOUNT_POSIX 0x0008 /* 1 */ 131static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */
132#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ 132static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */
133#define NFS_MOUNT_NOAC 0x0020 /* 1 */ 133static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */
134#define NFS_MOUNT_TCP 0x0040 /* 2 */ 134static const int NFS_MOUNT_TCP = 0x0040; /* 2 */
135#define NFS_MOUNT_VER3 0x0080 /* 3 */ 135static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */
136#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ 136static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */
137#define NFS_MOUNT_NONLM 0x0200 /* 3 */ 137static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */
138 138
139 139
140#define UTIL_LINUX_VERSION "2.10m" 140#define UTIL_LINUX_VERSION "2.10m"
@@ -160,14 +160,14 @@ static char *nfs_strerror(int stat);
160#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) 160#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
161#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) 161#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
162 162
163#define EX_FAIL 32 /* mount failure */ 163static const int EX_FAIL = 32; /* mount failure */
164#define EX_BG 256 /* retry in background (internal only) */ 164static const int EX_BG = 256; /* retry in background (internal only) */
165 165
166 166
167/* 167/*
168 * nfs_mount_version according to the sources seen at compile time. 168 * nfs_mount_version according to the sources seen at compile time.
169 */ 169 */
170int nfs_mount_version = NFS_MOUNT_VERSION; 170static int nfs_mount_version;
171 171
172/* 172/*
173 * Unfortunately, the kernel prints annoying console messages 173 * Unfortunately, the kernel prints annoying console messages
@@ -187,8 +187,9 @@ find_kernel_nfs_mount_version(void) {
187 if (kernel_version) 187 if (kernel_version)
188 return; 188 return;
189 189
190 kernel_version = get_kernel_revision(); 190 nfs_mount_version = NFS_MOUNT_VERSION; /* default */
191 191
192 kernel_version = get_kernel_revision();
192 if (kernel_version) { 193 if (kernel_version) {
193 if (kernel_version < MAKE_VERSION(2,1,32)) 194 if (kernel_version < MAKE_VERSION(2,1,32))
194 nfs_mount_version = 1; 195 nfs_mount_version = 1;
diff --git a/ping.c b/ping.c
index 8276dda4b..f5769b74e 100644
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $ 3 * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -58,7 +58,7 @@
58#if ! defined __GLIBC__ && ! defined __UCLIBC__ 58#if ! defined __GLIBC__ && ! defined __UCLIBC__
59typedef unsigned int socklen_t; 59typedef unsigned int socklen_t;
60 60
61#define ICMP_MINLEN 8 /* abs minimum */ 61static const int ICMP_MINLEN = 8; /* abs minimum */
62 62
63struct icmp_ra_addr 63struct icmp_ra_addr
64{ 64{
@@ -134,13 +134,13 @@ struct icmp
134}; 134};
135#endif 135#endif
136 136
137#define DEFDATALEN 56 137static const int DEFDATALEN = 56;
138#define MAXIPLEN 60 138static const int MAXIPLEN = 60;
139#define MAXICMPLEN 76 139static const int MAXICMPLEN = 76;
140#define MAXPACKET 65468 140static const int MAXPACKET = 65468;
141#define MAX_DUP_CHK (8 * 128) 141#define MAX_DUP_CHK (8 * 128)
142#define MAXWAIT 10 142static const int MAXWAIT = 10;
143#define PINGINTERVAL 1 /* second */ 143static const int PINGINTERVAL = 1; /* second */
144 144
145#define O_QUIET (1 << 0) 145#define O_QUIET (1 << 0)
146 146
@@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv)
262static char *hostname = NULL; 262static char *hostname = NULL;
263static struct sockaddr_in pingaddr; 263static struct sockaddr_in pingaddr;
264static int pingsock = -1; 264static int pingsock = -1;
265static int datalen = DEFDATALEN; 265static int datalen; /* intentionally uninitialized to work around gcc bug */
266 266
267static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; 267static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0;
268static int myid = 0, options = 0; 268static int myid = 0, options = 0;
@@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv)
508{ 508{
509 char *thisarg; 509 char *thisarg;
510 510
511 datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
512
511 argc--; 513 argc--;
512 argv++; 514 argv++;
513 options = 0; 515 options = 0;
diff --git a/printf.c b/printf.c
index 832ca13d6..72bc7ae89 100644
--- a/printf.c
+++ b/printf.c
@@ -59,7 +59,7 @@
59 59
60 60
61#ifndef S_IFMT 61#ifndef S_IFMT
62# define S_IFMT 0170000 62static const int S_IFMT = 0170000;
63#endif 63#endif
64#if !defined(S_ISBLK) && defined(S_IFBLK) 64#if !defined(S_ISBLK) && defined(S_IFBLK)
65# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 65# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
diff --git a/procps/kill.c b/procps/kill.c
index 8fa9da77d..19ca187a7 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -30,8 +30,8 @@
30#include <ctype.h> 30#include <ctype.h>
31#include <unistd.h> 31#include <unistd.h>
32 32
33#define KILL 0 33static const int KILL = 0;
34#define KILLALL 1 34static const int KILLALL = 1;
35 35
36struct signal_name { 36struct signal_name {
37 const char *name; 37 const char *name;
diff --git a/procps/ps.c b/procps/ps.c
index ec63bb548..cb4c21e32 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -40,7 +40,7 @@
40#define bb_need_help 40#define bb_need_help
41#include "messages.c" 41#include "messages.c"
42 42
43#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */ 43static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */
44 44
45 45
46 46
diff --git a/procps/uptime.c b/procps/uptime.c
index fb3d347c3..f5e12f1ee 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -33,7 +33,7 @@
33#include <time.h> 33#include <time.h>
34#include <errno.h> 34#include <errno.h>
35 35
36#define FSHIFT 16 /* nr of bits of precision */ 36static const int FSHIFT = 16; /* nr of bits of precision */
37#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 37#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
38#define LOAD_INT(x) ((x) >> FSHIFT) 38#define LOAD_INT(x) ((x) >> FSHIFT)
39#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) 39#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
diff --git a/ps.c b/ps.c
index ec63bb548..cb4c21e32 100644
--- a/ps.c
+++ b/ps.c
@@ -40,7 +40,7 @@
40#define bb_need_help 40#define bb_need_help
41#include "messages.c" 41#include "messages.c"
42 42
43#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */ 43static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */
44 44
45 45
46 46
diff --git a/rdate.c b/rdate.c
index bb5392746..954982ae9 100644
--- a/rdate.c
+++ b/rdate.c
@@ -33,7 +33,7 @@
33#include <getopt.h> 33#include <getopt.h>
34 34
35 35
36#define RFC_868_BIAS 2208988800UL 36static const int RFC_868_BIAS = 2208988800UL;
37 37
38int setdate= 0; 38int setdate= 0;
39int printdate= 0; 39int printdate= 0;
diff --git a/rpmunpack.c b/rpmunpack.c
index 249d223c0..512d63839 100644
--- a/rpmunpack.c
+++ b/rpmunpack.c
@@ -19,7 +19,7 @@
19/* 19/*
20 * Some general definitions 20 * Some general definitions
21 */ 21 */
22#define BUFSIZE 512 22
23#define RPM_MAGIC "\355\253\356\333" 23#define RPM_MAGIC "\355\253\356\333"
24#define GZ_MAGIC_1 '\037' 24#define GZ_MAGIC_1 '\037'
25#define GZ_MAGIC_2 '\213' 25#define GZ_MAGIC_2 '\213'
@@ -27,14 +27,13 @@
27/* 27/*
28 * Global variables 28 * Global variables
29 */ 29 */
30static char buffer[BUFSIZE];
31static char *progname; 30static char *progname;
32static int infile, outfile; 31static int infile, outfile;
33 32
34/* 33/*
35 * Read a specified number of bytes from input file 34 * Read a specified number of bytes from input file
36 */ 35 */
37static void myread(int num) 36static void myread(int num, char *buffer)
38{ 37{
39 int err; 38 int err;
40 39
@@ -52,6 +51,7 @@ static void myread(int num)
52int rpmunpack_main(int argc, char **argv) 51int rpmunpack_main(int argc, char **argv)
53{ 52{
54 int len, status = 0; 53 int len, status = 0;
54 char buffer[BUFSIZ];
55 55
56 /* Get our own program name */ 56 /* Get our own program name */
57 if ((progname = strrchr(argv[0], '/')) == NULL) 57 if ((progname = strrchr(argv[0], '/')) == NULL)
@@ -71,13 +71,13 @@ int rpmunpack_main(int argc, char **argv)
71 perror_msg_and_die("%s", argv[1]); 71 perror_msg_and_die("%s", argv[1]);
72 72
73 /* Read magic ID and output filename */ 73 /* Read magic ID and output filename */
74 myread(4); 74 myread(4, buffer);
75 if (strncmp(buffer, RPM_MAGIC, 4)) { 75 if (strncmp(buffer, RPM_MAGIC, 4)) {
76 fprintf(stderr, "Input file is not in RPM format!\n"); 76 fprintf(stderr, "Input file is not in RPM format!\n");
77 exit(1); 77 exit(1);
78 } 78 }
79 myread(6); /* Skip flags */ 79 myread(6, buffer); /* Skip flags */
80 myread(64); 80 myread(64, buffer);
81 buffer[64] = '\0'; 81 buffer[64] = '\0';
82 82
83 /* Open output file */ 83 /* Open output file */
@@ -97,9 +97,9 @@ int rpmunpack_main(int argc, char **argv)
97 * never appears before offset 0x200, so we skip these first couple of 97 * never appears before offset 0x200, so we skip these first couple of
98 * bytes to make the signature scan a little more reliable. 98 * bytes to make the signature scan a little more reliable.
99 */ 99 */
100 myread(0x200 - 74); 100 myread(0x200 - 74, buffer);
101 while (status < 2) { 101 while (status < 2) {
102 myread(1); 102 myread(1, buffer);
103 if (status == 0 && buffer[0] == GZ_MAGIC_1) 103 if (status == 0 && buffer[0] == GZ_MAGIC_1)
104 status++; 104 status++;
105 else if (status == 1 && buffer[0] == GZ_MAGIC_2) 105 else if (status == 1 && buffer[0] == GZ_MAGIC_2)
@@ -113,7 +113,7 @@ int rpmunpack_main(int argc, char **argv)
113 perror_msg_and_die("write"); 113 perror_msg_and_die("write");
114 114
115 /* Now simply copy the GZIP archive into the output file */ 115 /* Now simply copy the GZIP archive into the output file */
116 while ((len = read(infile, buffer, BUFSIZE)) > 0) { 116 while ((len = read(infile, buffer, BUFSIZ)) > 0) {
117 if (write(outfile, buffer, len) < 0) 117 if (write(outfile, buffer, len) < 0)
118 perror_msg_and_die("write"); 118 perror_msg_and_die("write");
119 } 119 }
diff --git a/setkeycodes.c b/setkeycodes.c
index 7db398d77..be9b1b797 100644
--- a/setkeycodes.c
+++ b/setkeycodes.c
@@ -33,7 +33,7 @@
33struct kbkeycode { 33struct kbkeycode {
34 unsigned int scancode, keycode; 34 unsigned int scancode, keycode;
35}; 35};
36#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ 36static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
37 37
38extern int 38extern int
39setkeycodes_main(int argc, char** argv) 39setkeycodes_main(int argc, char** argv)
diff --git a/sh.c b/sh.c
index 52c87ee7f..b9685ab31 100644
--- a/sh.c
+++ b/sh.c
@@ -64,8 +64,8 @@
64#include <getopt.h> 64#include <getopt.h>
65#include "cmdedit.h" 65#include "cmdedit.h"
66 66
67#define MAX_LINE 256 /* size of input buffer for cwd data */ 67static const int MAX_LINE = 256; /* size of input buffer for cwd data */
68#define MAX_READ 128 /* size of input buffer for `read' builtin */ 68static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
70extern size_t NUM_APPLETS; 70extern size_t NUM_APPLETS;
71 71
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 722a36a50..12c78dc76 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -44,10 +44,13 @@
44#include <signal.h> 44#include <signal.h>
45 45
46 46
47#define MAX_HISTORY 15 /* Maximum length of the linked list for the command line history */ 47static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */
48
49enum {
50 ESC = 27,
51 DEL = 127,
52};
48 53
49#define ESC 27
50#define DEL 127
51#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0) 54#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
52#define whitespace(c) (((c) == ' ') || ((c) == '\t')) 55#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
53 56
diff --git a/shell/lash.c b/shell/lash.c
index 52c87ee7f..b9685ab31 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -64,8 +64,8 @@
64#include <getopt.h> 64#include <getopt.h>
65#include "cmdedit.h" 65#include "cmdedit.h"
66 66
67#define MAX_LINE 256 /* size of input buffer for cwd data */ 67static const int MAX_LINE = 256; /* size of input buffer for cwd data */
68#define MAX_READ 128 /* size of input buffer for `read' builtin */ 68static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
70extern size_t NUM_APPLETS; 70extern size_t NUM_APPLETS;
71 71
diff --git a/swaponoff.c b/swaponoff.c
index 85f338932..eda15100b 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -35,8 +35,8 @@ _syscall1(int, swapoff, const char *, path);
35 35
36static int whichApp; 36static int whichApp;
37 37
38#define SWAPON_APP 1 38static const int SWAPON_APP = 1;
39#define SWAPOFF_APP 2 39static const int SWAPOFF_APP = 2;
40 40
41 41
42static void swap_enable_disable(char *device) 42static void swap_enable_disable(char *device)
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 4217c362f..114516e2f 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -165,7 +165,7 @@ static void logMessage (int pri, char *msg)
165#ifdef BB_FEATURE_REMOTE_LOG 165#ifdef BB_FEATURE_REMOTE_LOG
166 /* send message to remote logger */ 166 /* send message to remote logger */
167 if ( -1 != remotefd){ 167 if ( -1 != remotefd){
168#define IOV_COUNT 2 168static const int IOV_COUNT = 2;
169 struct iovec iov[IOV_COUNT]; 169 struct iovec iov[IOV_COUNT];
170 struct iovec *v = iov; 170 struct iovec *v = iov;
171 171
@@ -206,7 +206,7 @@ static void domark(int sig)
206 } 206 }
207} 207}
208 208
209#define BUFSIZE 1023 209static const int BUFSIZE = 1023;
210static int serveConnection (int conn) 210static int serveConnection (int conn)
211{ 211{
212 char buf[ BUFSIZE + 1 ]; 212 char buf[ BUFSIZE + 1 ];
diff --git a/syslogd.c b/syslogd.c
index 4217c362f..114516e2f 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -165,7 +165,7 @@ static void logMessage (int pri, char *msg)
165#ifdef BB_FEATURE_REMOTE_LOG 165#ifdef BB_FEATURE_REMOTE_LOG
166 /* send message to remote logger */ 166 /* send message to remote logger */
167 if ( -1 != remotefd){ 167 if ( -1 != remotefd){
168#define IOV_COUNT 2 168static const int IOV_COUNT = 2;
169 struct iovec iov[IOV_COUNT]; 169 struct iovec iov[IOV_COUNT];
170 struct iovec *v = iov; 170 struct iovec *v = iov;
171 171
@@ -206,7 +206,7 @@ static void domark(int sig)
206 } 206 }
207} 207}
208 208
209#define BUFSIZE 1023 209static const int BUFSIZE = 1023;
210static int serveConnection (int conn) 210static int serveConnection (int conn)
211{ 211{
212 char buf[ BUFSIZE + 1 ]; 212 char buf[ BUFSIZE + 1 ];
diff --git a/tar.c b/tar.c
index 2699550ec..51a857d71 100644
--- a/tar.c
+++ b/tar.c
@@ -64,7 +64,7 @@ extern int gunzip_init();
64#define MINOR(dev) ((dev)&0xff) 64#define MINOR(dev) ((dev)&0xff)
65#endif 65#endif
66 66
67#define NAME_SIZE 100 67enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
68 68
69/* POSIX tar Header Block, from POSIX 1003.1-1990 */ 69/* POSIX tar Header Block, from POSIX 1003.1-1990 */
70struct TarHeader 70struct TarHeader
@@ -94,9 +94,9 @@ typedef struct TarHeader TarHeader;
94/* A few useful constants */ 94/* A few useful constants */
95#define TAR_MAGIC "ustar" /* ustar and a null */ 95#define TAR_MAGIC "ustar" /* ustar and a null */
96#define TAR_VERSION " " /* Be compatable with GNU tar format */ 96#define TAR_VERSION " " /* Be compatable with GNU tar format */
97#define TAR_MAGIC_LEN 6 97static const int TAR_MAGIC_LEN = 6;
98#define TAR_VERSION_LEN 2 98static const int TAR_VERSION_LEN = 2;
99#define TAR_BLOCK_SIZE 512 99static const int TAR_BLOCK_SIZE = 512;
100 100
101/* A nice enum with all the possible tar file content types */ 101/* A nice enum with all the possible tar file content types */
102enum TarFileType 102enum TarFileType
diff --git a/telnet.c b/telnet.c
index 76956e9ac..ac6813e29 100644
--- a/telnet.c
+++ b/telnet.c
@@ -50,7 +50,7 @@
50#include <netdb.h> 50#include <netdb.h>
51 51
52#if 0 52#if 0
53#define DOTRACE 1 53static const int DOTRACE = 1;
54#endif 54#endif
55 55
56#ifdef DOTRACE 56#ifdef DOTRACE
@@ -67,21 +67,23 @@
67#include <sys/time.h> 67#include <sys/time.h>
68#endif 68#endif
69 69
70#define DATABUFSIZE 128 70static const int DATABUFSIZE = 128;
71#define IACBUFSIZE 128 71static const int IACBUFSIZE = 128;
72 72
73#define CHM_TRY 0 73static const int CHM_TRY = 0;
74#define CHM_ON 1 74static const int CHM_ON = 1;
75#define CHM_OFF 2 75static const int CHM_OFF = 2;
76 76
77#define UF_ECHO 0x01 77static const int UF_ECHO = 0x01;
78#define UF_SGA 0x02 78static const int UF_SGA = 0x02;
79 79
80#define TS_0 1 80enum {
81#define TS_IAC 2 81 TS_0 = 1,
82#define TS_OPT 3 82 TS_IAC = 2,
83#define TS_SUB1 4 83 TS_OPT = 3,
84#define TS_SUB2 5 84 TS_SUB1 = 4,
85 TS_SUB2 = 5,
86};
85 87
86#define WriteCS(fd, str) write(fd, str, sizeof str -1) 88#define WriteCS(fd, str) write(fd, str, sizeof str -1)
87 89
diff --git a/tr.c b/tr.c
index fd547b87d..d21e672fe 100644
--- a/tr.c
+++ b/tr.c
@@ -34,14 +34,15 @@
34#define bb_need_write_error 34#define bb_need_write_error
35#include "messages.c" 35#include "messages.c"
36 36
37#define ASCII 0377 37static const int ASCII = 0377;
38 38
39/* some glabals shared across this file */ 39/* some glabals shared across this file */
40static char com_fl, del_fl, sq_fl; 40static char com_fl, del_fl, sq_fl;
41static unsigned char output[BUFSIZ], input[BUFSIZ];
42static unsigned char vector[ASCII + 1];
43static char invec[ASCII + 1], outvec[ASCII + 1];
44static short in_index, out_index; 41static short in_index, out_index;
42/* these last are pointers to static buffers declared in tr_main */
43static unsigned char *poutput, *pinput;
44static unsigned char *pvector;
45static char *pinvec, *poutvec;
45 46
46 47
47static void convert() 48static void convert()
@@ -52,22 +53,22 @@ static void convert()
52 53
53 for (;;) { 54 for (;;) {
54 if (in_index == read_chars) { 55 if (in_index == read_chars) {
55 if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) { 56 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
56 if (write(1, (char *) output, out_index) != out_index) 57 if (write(1, (char *) poutput, out_index) != out_index)
57 write(2, write_error, strlen(write_error)); 58 write(2, write_error, strlen(write_error));
58 exit(0); 59 exit(0);
59 } 60 }
60 in_index = 0; 61 in_index = 0;
61 } 62 }
62 c = input[in_index++]; 63 c = pinput[in_index++];
63 coded = vector[c]; 64 coded = pvector[c];
64 if (del_fl && invec[c]) 65 if (del_fl && pinvec[c])
65 continue; 66 continue;
66 if (sq_fl && last == coded && (invec[c] || outvec[coded])) 67 if (sq_fl && last == coded && (pinvec[c] || poutvec[coded]))
67 continue; 68 continue;
68 output[out_index++] = last = coded; 69 poutput[out_index++] = last = coded;
69 if (out_index == BUFSIZ) { 70 if (out_index == BUFSIZ) {
70 if (write(1, (char *) output, out_index) != out_index) { 71 if (write(1, (char *) poutput, out_index) != out_index) {
71 write(2, write_error, strlen(write_error)); 72 write(2, write_error, strlen(write_error));
72 exit(1); 73 exit(1);
73 } 74 }
@@ -86,9 +87,9 @@ static void map(register unsigned char *string1, unsigned int string1_len,
86 87
87 for (j = 0, i = 0; i < string1_len; i++) { 88 for (j = 0, i = 0; i < string1_len; i++) {
88 if (string2_len <= j) 89 if (string2_len <= j)
89 vector[string1[i]] = last; 90 pvector[string1[i]] = last;
90 else 91 else
91 vector[string1[i]] = last = string2[j++]; 92 pvector[string1[i]] = last = string2[j++];
92 } 93 }
93} 94}
94 95
@@ -143,6 +144,17 @@ extern int tr_main(int argc, char **argv)
143 int output_length=0, input_length; 144 int output_length=0, input_length;
144 int index = 1; 145 int index = 1;
145 int i; 146 int i;
147 /* set up big arrays here (better than making a bunch of static arrays up top) */
148 unsigned char output[BUFSIZ], input[BUFSIZ];
149 unsigned char vector[ASCII + 1];
150 char invec[ASCII + 1], outvec[ASCII + 1];
151
152 /* ... but make them available globally */
153 poutput = output;
154 pinput = input;
155 pvector = vector;
156 pinvec = invec;
157 poutvec = outvec;
146 158
147 if (argc > 1 && argv[index][0] == '-') { 159 if (argc > 1 && argv[index][0] == '-') {
148 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { 160 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
diff --git a/umount.c b/umount.c
index 40d25f90a..2e2d95de4 100644
--- a/umount.c
+++ b/umount.c
@@ -28,10 +28,10 @@
28#include <errno.h> 28#include <errno.h>
29 29
30 30
31#define MNT_FORCE 1 31static const int MNT_FORCE = 1;
32#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 32static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
33#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */ 33static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS. */
34#define MS_RDONLY 1 /* Mount read-only. */ 34static const int MS_RDONLY = 1; /* Mount read-only. */
35 35
36extern int mount (__const char *__special_file, __const char *__dir, 36extern int mount (__const char *__special_file, __const char *__dir,
37 __const char *__fstype, unsigned long int __rwflag, 37 __const char *__fstype, unsigned long int __rwflag,
diff --git a/uname.c b/uname.c
index e7e9ff331..4f7c643f9 100644
--- a/uname.c
+++ b/uname.c
@@ -44,22 +44,22 @@ static void print_element(unsigned int mask, char *element);
44 44
45/* Values that are bitwise or'd into `toprint'. */ 45/* Values that are bitwise or'd into `toprint'. */
46/* Operating system name. */ 46/* Operating system name. */
47#define PRINT_SYSNAME 1 47static const int PRINT_SYSNAME = 1;
48 48
49/* Node name on a communications network. */ 49/* Node name on a communications network. */
50#define PRINT_NODENAME 2 50static const int PRINT_NODENAME = 2;
51 51
52/* Operating system release. */ 52/* Operating system release. */
53#define PRINT_RELEASE 4 53static const int PRINT_RELEASE = 4;
54 54
55/* Operating system version. */ 55/* Operating system version. */
56#define PRINT_VERSION 8 56static const int PRINT_VERSION = 8;
57 57
58/* Machine hardware name. */ 58/* Machine hardware name. */
59#define PRINT_MACHINE 16 59static const int PRINT_MACHINE = 16;
60 60
61 /* Host processor type. */ 61 /* Host processor type. */
62#define PRINT_PROCESSOR 32 62static const int PRINT_PROCESSOR = 32;
63 63
64/* Mask indicating which elements of the name to print. */ 64/* Mask indicating which elements of the name to print. */
65static unsigned char toprint; 65static unsigned char toprint;
diff --git a/uptime.c b/uptime.c
index fb3d347c3..f5e12f1ee 100644
--- a/uptime.c
+++ b/uptime.c
@@ -33,7 +33,7 @@
33#include <time.h> 33#include <time.h>
34#include <errno.h> 34#include <errno.h>
35 35
36#define FSHIFT 16 /* nr of bits of precision */ 36static const int FSHIFT = 16; /* nr of bits of precision */
37#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 37#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
38#define LOAD_INT(x) ((x) >> FSHIFT) 38#define LOAD_INT(x) ((x) >> FSHIFT)
39#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) 39#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 40a907b07..845be8442 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -36,53 +36,55 @@
36#define DEFAULTFBDEV "/dev/fb0" 36#define DEFAULTFBDEV "/dev/fb0"
37#define DEFAULTFBMODE "/etc/fb.modes" 37#define DEFAULTFBMODE "/etc/fb.modes"
38 38
39#define OPT_CHANGE 1 39static const int OPT_CHANGE = (1 << 0);
40#define OPT_INFO (1 << 1) 40static const int OPT_INFO = (1 << 1);
41#define OPT_READMODE (1 << 2) 41static const int OPT_READMODE = (1 << 2);
42 42
43#define CMD_HELP 0 43enum {
44#define CMD_FB 1 44 CMD_HELP = 0,
45#define CMD_DB 2 45 CMD_FB = 1,
46#define CMD_GEOMETRY 3 46 CMD_DB = 2,
47#define CMD_TIMING 4 47 CMD_GEOMETRY = 3,
48#define CMD_ACCEL 5 48 CMD_TIMING = 4,
49#define CMD_HSYNC 6 49 CMD_ACCEL = 5,
50#define CMD_VSYNC 7 50 CMD_HSYNC = 6,
51#define CMD_LACED 8 51 CMD_VSYNC = 7,
52#define CMD_DOUBLE 9 52 CMD_LACED = 8,
53/* #define CMD_XCOMPAT 10 */ 53 CMD_DOUBLE = 9,
54#define CMD_ALL 11 54/* CMD_XCOMPAT = 10, */
55#define CMD_INFO 12 55 CMD_ALL = 11,
56#define CMD_CHANGE 13 56 CMD_INFO = 12,
57 CMD_CHANGE = 13,
57 58
58#ifdef BB_FEATURE_FBSET_FANCY 59#ifdef BB_FEATURE_FBSET_FANCY
59#define CMD_XRES 100 60 CMD_XRES = 100,
60#define CMD_YRES 101 61 CMD_YRES = 101,
61#define CMD_VXRES 102 62 CMD_VXRES = 102,
62#define CMD_VYRES 103 63 CMD_VYRES = 103,
63#define CMD_DEPTH 104 64 CMD_DEPTH = 104,
64#define CMD_MATCH 105 65 CMD_MATCH = 105,
65#define CMD_PIXCLOCK 106 66 CMD_PIXCLOCK = 106,
66#define CMD_LEFT 107 67 CMD_LEFT = 107,
67#define CMD_RIGHT 108 68 CMD_RIGHT = 108,
68#define CMD_UPPER 109 69 CMD_UPPER = 109,
69#define CMD_LOWER 110 70 CMD_LOWER = 110,
70#define CMD_HSLEN 111 71 CMD_HSLEN = 111,
71#define CMD_VSLEN 112 72 CMD_VSLEN = 112,
72#define CMD_CSYNC 113 73 CMD_CSYNC = 113,
73#define CMD_GSYNC 114 74 CMD_GSYNC = 114,
74#define CMD_EXTSYNC 115 75 CMD_EXTSYNC = 115,
75#define CMD_BCAST 116 76 CMD_BCAST = 116,
76#define CMD_RGBA 117 77 CMD_RGBA = 117,
77#define CMD_STEP 118 78 CMD_STEP = 118,
78#define CMD_MOVE 119 79 CMD_MOVE = 119,
79#endif 80#endif
81};
80 82
81static unsigned int g_options = 0; 83static unsigned int g_options = 0;
82 84
83/* Stuff stolen from the kernel's fb.h */ 85/* Stuff stolen from the kernel's fb.h */
84#define FBIOGET_VSCREENINFO 0x4600 86static const int FBIOGET_VSCREENINFO = 0x4600;
85#define FBIOPUT_VSCREENINFO 0x4601 87static const int FBIOPUT_VSCREENINFO = 0x4601;
86#define __u32 unsigned int 88#define __u32 unsigned int
87struct fb_bitfield { 89struct fb_bitfield {
88 __u32 offset; /* beginning of bitfield */ 90 __u32 offset; /* beginning of bitfield */
@@ -180,12 +182,12 @@ struct cmdoptions_t {
180 182
181#ifdef BB_FEATURE_FBSET_READMODE 183#ifdef BB_FEATURE_FBSET_READMODE
182/* taken from linux/fb.h */ 184/* taken from linux/fb.h */
183#define FB_VMODE_INTERLACED 1 /* interlaced */ 185static const int FB_VMODE_INTERLACED = 1; /* interlaced */
184#define FB_VMODE_DOUBLE 2 /* double scan */ 186static const int FB_VMODE_DOUBLE = 2; /* double scan */
185#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ 187static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */
186#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ 188static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */
187#define FB_SYNC_EXT 4 /* external sync */ 189static const int FB_SYNC_EXT = 4; /* external sync */
188#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ 190static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */
189#endif 191#endif
190static int readmode(struct fb_var_screeninfo *base, const char *fn, 192static int readmode(struct fb_var_screeninfo *base, const char *fn,
191 const char *mode) 193 const char *mode)
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index b35e6bb07..18841ec56 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -104,24 +104,24 @@ typedef unsigned short u16;
104typedef unsigned int u32; 104typedef unsigned int u32;
105 105
106 106
107#define MINIX_ROOT_INO 1 107static const int MINIX_ROOT_INO = 1;
108#define MINIX_LINK_MAX 250 108static const int MINIX_LINK_MAX = 250;
109#define MINIX2_LINK_MAX 65530 109static const int MINIX2_LINK_MAX = 65530;
110 110
111#define MINIX_I_MAP_SLOTS 8 111static const int MINIX_I_MAP_SLOTS = 8;
112#define MINIX_Z_MAP_SLOTS 64 112static const int MINIX_Z_MAP_SLOTS = 64;
113#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 113static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
114#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ 114static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
115#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ 115static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
116#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ 116static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
117#define MINIX_VALID_FS 0x0001 /* Clean fs. */ 117static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
118#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ 118static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
119 119
120#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) 120#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
121#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) 121#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
122 122
123#define MINIX_V1 0x0001 /* original minix fs */ 123static const int MINIX_V1 = 0x0001; /* original minix fs */
124#define MINIX_V2 0x0002 /* minix V2 fs */ 124static const int MINIX_V2 = 0x0002; /* minix V2 fs */
125 125
126#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version 126#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
127 127
@@ -185,12 +185,6 @@ struct minix_dir_entry {
185 185
186#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) 186#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
187 187
188#define MINIX_VALID_FS 0x0001 /* Clean fs. */
189#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
190
191#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
192#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
193
194#ifndef BLKGETSIZE 188#ifndef BLKGETSIZE
195#define BLKGETSIZE _IO(0x12,96) /* return device size */ 189#define BLKGETSIZE _IO(0x12,96) /* return device size */
196#endif 190#endif
@@ -199,7 +193,7 @@ struct minix_dir_entry {
199#define volatile 193#define volatile
200#endif 194#endif
201 195
202#define ROOT_INO 1 196static const int ROOT_INO = 1;
203 197
204#define UPPER(size,n) ((size+((n)-1))/(n)) 198#define UPPER(size,n) ((size+((n)-1))/(n))
205#define INODE_SIZE (sizeof(struct minix_inode)) 199#define INODE_SIZE (sizeof(struct minix_inode))
@@ -231,7 +225,7 @@ static struct termios termios;
231static int termios_set = 0; 225static int termios_set = 0;
232 226
233/* File-name data */ 227/* File-name data */
234#define MAX_DEPTH 32 228static const int MAX_DEPTH = 32;
235static int name_depth = 0; 229static int name_depth = 0;
236// static char name_list[MAX_DEPTH][BUFSIZ + 1]; 230// static char name_list[MAX_DEPTH][BUFSIZ + 1];
237static char **name_list = NULL; 231static char **name_list = NULL;
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 0ebf9df08..ff55a3e3c 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -53,9 +53,9 @@
53 53
54/* NON_OPT is the code that is returned when a non-option is found in '+' 54/* NON_OPT is the code that is returned when a non-option is found in '+'
55 mode */ 55 mode */
56#define NON_OPT 1 56static const int NON_OPT = 1;
57/* LONG_OPT is the code that is returned when a long option is found. */ 57/* LONG_OPT is the code that is returned when a long option is found. */
58#define LONG_OPT 2 58static const int LONG_OPT = 2;
59 59
60/* The shells recognized. */ 60/* The shells recognized. */
61typedef enum {BASH,TCSH} shell_t; 61typedef enum {BASH,TCSH} shell_t;
@@ -199,7 +199,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
199static struct option *long_options=NULL; 199static struct option *long_options=NULL;
200static int long_options_length=0; /* Length of array */ 200static int long_options_length=0; /* Length of array */
201static int long_options_nr=0; /* Nr of used elements in array */ 201static int long_options_nr=0; /* Nr of used elements in array */
202#define LONG_OPTIONS_INCR 10 202static const int LONG_OPTIONS_INCR = 10;
203#define init_longopt() add_longopt(NULL,0) 203#define init_longopt() add_longopt(NULL,0)
204 204
205/* Register a long option. The contents of name is copied. */ 205/* Register a long option. The contents of name is copied. */
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index e7fab4e07..5b908daa3 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -48,7 +48,7 @@
48 48
49#ifndef _IO 49#ifndef _IO
50/* pre-1.3.45 */ 50/* pre-1.3.45 */
51#define BLKGETSIZE 0x1260 51static const int BLKGETSIZE = 0x1260;
52#else 52#else
53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ 53/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
54#define BLKGETSIZE _IO(0x12,96) 54#define BLKGETSIZE _IO(0x12,96)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 88e45fc72..f78786ebc 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -55,21 +55,21 @@
55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ 55#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
56#endif 56#endif
57 57
58 58enum {
59#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 59 MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
60#define MS_RDONLY 1 /* Mount read-only */ 60 MS_RDONLY = 1, /* Mount read-only */
61#define MS_NOSUID 2 /* Ignore suid and sgid bits */ 61 MS_NOSUID = 2, /* Ignore suid and sgid bits */
62#define MS_NODEV 4 /* Disallow access to device special files */ 62 MS_NODEV = 4, /* Disallow access to device special files */
63#define MS_NOEXEC 8 /* Disallow program execution */ 63 MS_NOEXEC = 8, /* Disallow program execution */
64#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ 64 MS_SYNCHRONOUS = 16, /* Writes are synced at once */
65#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ 65 MS_REMOUNT = 32, /* Alter flags of a mounted FS */
66#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ 66 MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
67#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ 67 S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
68#define S_APPEND 256 /* Append-only file */ 68 S_APPEND = 256, /* Append-only file */
69#define S_IMMUTABLE 512 /* Immutable file */ 69 S_IMMUTABLE = 512, /* Immutable file */
70#define MS_NOATIME 1024 /* Do not update access times. */ 70 MS_NOATIME = 1024, /* Do not update access times. */
71#define MS_NODIRATIME 2048 /* Do not update directory access times */ 71 MS_NODIRATIME = 2048, /* Do not update directory access times */
72 72};
73 73
74 74
75#if defined BB_FEATURE_MOUNT_LOOP 75#if defined BB_FEATURE_MOUNT_LOOP
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index b5c38212a..d661a99a4 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -54,10 +54,10 @@
54#include <linux/nfs.h> /* For the kernels nfs stuff */ 54#include <linux/nfs.h> /* For the kernels nfs stuff */
55 55
56#ifndef NFS_FHSIZE 56#ifndef NFS_FHSIZE
57#define NFS_FHSIZE 32 57static const int NFS_FHSIZE = 32;
58#endif 58#endif
59#ifndef NFS_PORT 59#ifndef NFS_PORT
60#define NFS_PORT 2049 60static const int NFS_PORT = 2049;
61#endif 61#endif
62 62
63/* Disable the nls stuff */ 63/* Disable the nls stuff */
@@ -68,19 +68,19 @@
68# define _(Text) (Text) 68# define _(Text) (Text)
69# define N_(Text) (Text) 69# define N_(Text) (Text)
70 70
71#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 71static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
72#define MS_RDONLY 1 /* Mount read-only */ 72static const int MS_RDONLY = 1; /* Mount read-only */
73#define MS_NOSUID 2 /* Ignore suid and sgid bits */ 73static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */
74#define MS_NODEV 4 /* Disallow access to device special files */ 74static const int MS_NODEV = 4; /* Disallow access to device special files */
75#define MS_NOEXEC 8 /* Disallow program execution */ 75static const int MS_NOEXEC = 8; /* Disallow program execution */
76#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ 76static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */
77#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ 77static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */
78#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ 78static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */
79#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ 79static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */
80#define S_APPEND 256 /* Append-only file */ 80static const int S_APPEND = 256; /* Append-only file */
81#define S_IMMUTABLE 512 /* Immutable file */ 81static const int S_IMMUTABLE = 512; /* Immutable file */
82#define MS_NOATIME 1024 /* Do not update access times. */ 82static const int MS_NOATIME = 1024; /* Do not update access times. */
83#define MS_NODIRATIME 2048 /* Do not update directory access times */ 83static const int MS_NODIRATIME = 2048; /* Do not update directory access times */
84 84
85 85
86/* 86/*
@@ -93,7 +93,7 @@
93 * so it is easiest to ignore the kernel altogether (at compile time). 93 * so it is easiest to ignore the kernel altogether (at compile time).
94 */ 94 */
95 95
96#define NFS_MOUNT_VERSION 4 96static const int NFS_MOUNT_VERSION = 4;
97 97
98struct nfs2_fh { 98struct nfs2_fh {
99 char data[32]; 99 char data[32];
@@ -125,16 +125,16 @@ struct nfs_mount_data {
125 125
126/* bits in the flags field */ 126/* bits in the flags field */
127 127
128#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 128static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */
129#define NFS_MOUNT_INTR 0x0002 /* 1 */ 129static const int NFS_MOUNT_INTR = 0x0002; /* 1 */
130#define NFS_MOUNT_SECURE 0x0004 /* 1 */ 130static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */
131#define NFS_MOUNT_POSIX 0x0008 /* 1 */ 131static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */
132#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ 132static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */
133#define NFS_MOUNT_NOAC 0x0020 /* 1 */ 133static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */
134#define NFS_MOUNT_TCP 0x0040 /* 2 */ 134static const int NFS_MOUNT_TCP = 0x0040; /* 2 */
135#define NFS_MOUNT_VER3 0x0080 /* 3 */ 135static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */
136#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ 136static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */
137#define NFS_MOUNT_NONLM 0x0200 /* 3 */ 137static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */
138 138
139 139
140#define UTIL_LINUX_VERSION "2.10m" 140#define UTIL_LINUX_VERSION "2.10m"
@@ -160,14 +160,14 @@ static char *nfs_strerror(int stat);
160#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) 160#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
161#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) 161#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
162 162
163#define EX_FAIL 32 /* mount failure */ 163static const int EX_FAIL = 32; /* mount failure */
164#define EX_BG 256 /* retry in background (internal only) */ 164static const int EX_BG = 256; /* retry in background (internal only) */
165 165
166 166
167/* 167/*
168 * nfs_mount_version according to the sources seen at compile time. 168 * nfs_mount_version according to the sources seen at compile time.
169 */ 169 */
170int nfs_mount_version = NFS_MOUNT_VERSION; 170static int nfs_mount_version;
171 171
172/* 172/*
173 * Unfortunately, the kernel prints annoying console messages 173 * Unfortunately, the kernel prints annoying console messages
@@ -187,8 +187,9 @@ find_kernel_nfs_mount_version(void) {
187 if (kernel_version) 187 if (kernel_version)
188 return; 188 return;
189 189
190 kernel_version = get_kernel_revision(); 190 nfs_mount_version = NFS_MOUNT_VERSION; /* default */
191 191
192 kernel_version = get_kernel_revision();
192 if (kernel_version) { 193 if (kernel_version) {
193 if (kernel_version < MAKE_VERSION(2,1,32)) 194 if (kernel_version < MAKE_VERSION(2,1,32))
194 nfs_mount_version = 1; 195 nfs_mount_version = 1;
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index bb5392746..954982ae9 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -33,7 +33,7 @@
33#include <getopt.h> 33#include <getopt.h>
34 34
35 35
36#define RFC_868_BIAS 2208988800UL 36static const int RFC_868_BIAS = 2208988800UL;
37 37
38int setdate= 0; 38int setdate= 0;
39int printdate= 0; 39int printdate= 0;
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 85f338932..eda15100b 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -35,8 +35,8 @@ _syscall1(int, swapoff, const char *, path);
35 35
36static int whichApp; 36static int whichApp;
37 37
38#define SWAPON_APP 1 38static const int SWAPON_APP = 1;
39#define SWAPOFF_APP 2 39static const int SWAPOFF_APP = 2;
40 40
41 41
42static void swap_enable_disable(char *device) 42static void swap_enable_disable(char *device)
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 40d25f90a..2e2d95de4 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -28,10 +28,10 @@
28#include <errno.h> 28#include <errno.h>
29 29
30 30
31#define MNT_FORCE 1 31static const int MNT_FORCE = 1;
32#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ 32static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
33#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */ 33static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS. */
34#define MS_RDONLY 1 /* Mount read-only. */ 34static const int MS_RDONLY = 1; /* Mount read-only. */
35 35
36extern int mount (__const char *__special_file, __const char *__dir, 36extern int mount (__const char *__special_file, __const char *__dir,
37 __const char *__fstype, unsigned long int __rwflag, 37 __const char *__fstype, unsigned long int __rwflag,
diff --git a/utility.c b/utility.c
index bff589a76..6b637de04 100644
--- a/utility.c
+++ b/utility.c
@@ -167,7 +167,7 @@ _syscall1(int, sysinfo, struct sysinfo *, info);
167#if defined BB_MOUNT || defined BB_UMOUNT 167#if defined BB_MOUNT || defined BB_UMOUNT
168 168
169#ifndef __NR_umount2 169#ifndef __NR_umount2
170#define __NR_umount2 52 170static const int __NR_umount2 = 52;
171#endif 171#endif
172 172
173/* Include our own version of <sys/mount.h>, since libc5 doesn't 173/* Include our own version of <sys/mount.h>, since libc5 doesn't
@@ -180,7 +180,7 @@ extern _syscall5(int, mount, const char *, special_file, const char *, dir,
180 180
181#if defined BB_INSMOD || defined BB_LSMOD 181#if defined BB_INSMOD || defined BB_LSMOD
182#ifndef __NR_query_module 182#ifndef __NR_query_module
183#define __NR_query_module 167 183static const int __NR_query_module = 167;
184#endif 184#endif
185_syscall5(int, query_module, const char *, name, int, which, 185_syscall5(int, query_module, const char *, name, int, which,
186 void *, buf, size_t, bufsize, size_t*, ret); 186 void *, buf, size_t, bufsize, size_t*, ret);
@@ -975,9 +975,9 @@ long my_getpwnamegid(char *name)
975#if (defined BB_CHVT) || (defined BB_DEALLOCVT) || (defined BB_SETKEYCODES) 975#if (defined BB_CHVT) || (defined BB_DEALLOCVT) || (defined BB_SETKEYCODES)
976 976
977/* From <linux/kd.h> */ 977/* From <linux/kd.h> */
978#define KDGKBTYPE 0x4B33 /* get keyboard type */ 978static const int KDGKBTYPE = 0x4B33; /* get keyboard type */
979#define KB_84 0x01 979static const int KB_84 = 0x01;
980#define KB_101 0x02 /* this is what we always answer */ 980static const int KB_101 = 0x02; /* this is what we always answer */
981 981
982int is_a_console(int fd) 982int is_a_console(int fd)
983{ 983{
diff --git a/wget.c b/wget.c
index a5c3e7baf..e3e6eed79 100644
--- a/wget.c
+++ b/wget.c
@@ -49,7 +49,7 @@ static char *curfile; /* Name of current file being transferred. */
49static struct timeval start; /* Time a transfer started. */ 49static struct timeval start; /* Time a transfer started. */
50volatile unsigned long statbytes; /* Number of bytes transferred so far. */ 50volatile unsigned long statbytes; /* Number of bytes transferred so far. */
51/* For progressmeter() -- number of seconds before xfer considered "stalled" */ 51/* For progressmeter() -- number of seconds before xfer considered "stalled" */
52#define STALLTIME 5 52static const int STALLTIME = 5;
53#endif 53#endif
54 54
55int wget_main(int argc, char **argv) 55int wget_main(int argc, char **argv)
@@ -515,7 +515,7 @@ progressmeter(int flag)
515 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 515 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
516 * SUCH DAMAGE. 516 * SUCH DAMAGE.
517 * 517 *
518 * $Id: wget.c,v 1.17 2001/01/22 22:48:42 andersen Exp $ 518 * $Id: wget.c,v 1.18 2001/01/23 22:30:04 markw Exp $
519 */ 519 */
520 520
521 521