#define -> static const int. Also got rid of some big static buffers.

This commit is contained in:
Mark Whitley 2001-01-23 22:30:04 +00:00
parent 2b8d07c590
commit 59ab025363
74 changed files with 670 additions and 620 deletions

View File

@ -76,40 +76,40 @@ static char *license_msg[] = {
#define bb_need_name_too_long #define bb_need_name_too_long
#include "messages.c" #include "messages.c"
#define RECORD_IO 0 static const int RECORD_IO = 0;
/* Return codes from gzip */ /* Return codes from gzip */
#define OK 0 static const int OK = 0;
#define ERROR 1 static const int ERROR = 1;
#define WARNING 2 static const int WARNING = 2;
#define DEFLATED 8 static const int DEFLATED = 8;
#define INBUFSIZ 0x2000 /* input buffer size */ static const int INBUFSIZ = 0x2000; /* input buffer size */
#define INBUF_EXTRA 64 /* required by unlzw() */ static const int INBUF_EXTRA = 64; /* required by unlzw() */
#define OUTBUFSIZ 8192 /* output buffer size */ static const int OUTBUFSIZ = 8192; /* output buffer size */
#define OUTBUF_EXTRA 2048 /* required by unlzw() */ static const int OUTBUF_EXTRA = 2048; /* required by unlzw() */
#define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */ static const int DIST_BUFSIZE = 0x2000; /* buffer for distances, see trees.c */
#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */ #define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
/* gzip flag byte */ /* gzip flag byte */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ static const int EXTRA_FIELD = 0x04; /* bit 2 set: extra field present */
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ static const int ORIG_NAME = 0x08; /* bit 3 set: original file name present */
#define COMMENT 0x10 /* bit 4 set: file comment present */ static const int COMMENT = 0x10; /* bit 4 set: file comment present */
#define WSIZE 0x8000 /* window size--must be a power of two, and */ static const int WSIZE = 0x8000; /* window size--must be a power of two, and */
/* at least 32K for zip's deflate method */ /* at least 32K for zip's deflate method */
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
#define BMAX 16 /* maximum bit length of any code (16 for explode) */ static const int BMAX = 16; /* maximum bit length of any code (16 for explode) */
#define N_MAX 288 /* maximum number of codes in any set */ static const int N_MAX = 288; /* maximum number of codes in any set */
/* PKZIP header definitions */ /* PKZIP header definitions */
#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ static const int LOCSIG = 0x04034b50L; /* four-byte lead-in (lsb first) */
#define LOCCRC 14 /* offset of crc */ static const int LOCCRC = 14; /* offset of crc */
#define LOCLEN 22 /* offset of uncompressed length */ static const int LOCLEN = 22; /* offset of uncompressed length */
#define EXTHDR 16 /* size of extended local header, inc sig */ static const int EXTHDR = 16; /* size of extended local header, inc sig */
#define BITS 16 static const int BITS = 16;
/* Diagnostic functions */ /* Diagnostic functions */
#ifdef DEBUG #ifdef DEBUG
@ -132,7 +132,7 @@ static char *license_msg[] = {
# ifdef BUFSIZ # ifdef BUFSIZ
# define MAX_PATH_LEN BUFSIZ # define MAX_PATH_LEN BUFSIZ
# else # else
# define MAX_PATH_LEN 1024 static const int MAX_PATH_LEN = 1024;
# endif # endif
#endif #endif
@ -165,8 +165,8 @@ static ush *tab_prefix1;
/* local variables */ /* local variables */
static int test_mode = 0; /* check file integrity option */ static int test_mode = 0; /* check file integrity option */
static int foreground; /* set if program run in foreground */ static int foreground; /* set if program run in foreground */
static int method = DEFLATED; /* compression method */ static int method; /* compression method */
static int exit_code = OK; /* program exit code */ static int exit_code; /* program exit code */
static int last_member; /* set for .zip and .Z files */ static int last_member; /* set for .zip and .Z files */
static int part_nb; /* number of parts in .gz file */ static int part_nb; /* number of parts in .gz file */
static long ifile_size; /* input file size, -1 for devices (debug only) */ static long ifile_size; /* input file size, -1 for devices (debug only) */
@ -1225,6 +1225,9 @@ int gunzip_main(int argc, char **argv)
char ifname[MAX_PATH_LEN + 1]; /* input file name */ char ifname[MAX_PATH_LEN + 1]; /* input file name */
char ofname[MAX_PATH_LEN + 1]; /* output file name */ char ofname[MAX_PATH_LEN + 1]; /* output file name */
method = DEFLATED; /* default compression method */
exit_code = OK; /* let's go out on a limb and assume everything will run fine (wink wink) */
if (strcmp(applet_name, "zcat") == 0) { if (strcmp(applet_name, "zcat") == 0) {
force = 1; force = 1;
tostdout = 1; tostdout = 1;

View File

@ -64,7 +64,7 @@ extern int gunzip_init();
#define MINOR(dev) ((dev)&0xff) #define MINOR(dev) ((dev)&0xff)
#endif #endif
#define NAME_SIZE 100 enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
/* POSIX tar Header Block, from POSIX 1003.1-1990 */ /* POSIX tar Header Block, from POSIX 1003.1-1990 */
struct TarHeader struct TarHeader
@ -94,9 +94,9 @@ typedef struct TarHeader TarHeader;
/* A few useful constants */ /* A few useful constants */
#define TAR_MAGIC "ustar" /* ustar and a null */ #define TAR_MAGIC "ustar" /* ustar and a null */
#define TAR_VERSION " " /* Be compatable with GNU tar format */ #define TAR_VERSION " " /* Be compatable with GNU tar format */
#define TAR_MAGIC_LEN 6 static const int TAR_MAGIC_LEN = 6;
#define TAR_VERSION_LEN 2 static const int TAR_VERSION_LEN = 2;
#define TAR_BLOCK_SIZE 512 static const int TAR_BLOCK_SIZE = 512;
/* A nice enum with all the possible tar file content types */ /* A nice enum with all the possible tar file content types */
enum TarFileType enum TarFileType

4
chvt.c
View File

@ -12,8 +12,8 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
/* From <linux/vt.h> */ /* From <linux/vt.h> */
#define VT_ACTIVATE 0x5606 /* make vt active */ static const int VT_ACTIVATE = 0x5606; /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */ static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
int chvt_main(int argc, char **argv) int chvt_main(int argc, char **argv)
{ {

View File

@ -44,10 +44,13 @@
#include <signal.h> #include <signal.h>
#define MAX_HISTORY 15 /* Maximum length of the linked list for the command line history */ static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */
enum {
ESC = 27,
DEL = 127,
};
#define ESC 27
#define DEL 127
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0) #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
#define whitespace(c) (((c) == ' ') || ((c) == '\t')) #define whitespace(c) (((c) == ' ') || ((c) == '\t'))

View File

@ -12,8 +12,8 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
/* From <linux/vt.h> */ /* From <linux/vt.h> */
#define VT_ACTIVATE 0x5606 /* make vt active */ static const int VT_ACTIVATE = 0x5606; /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */ static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
int chvt_main(int argc, char **argv) int chvt_main(int argc, char **argv)
{ {

View File

@ -11,7 +11,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
/* From <linux/vt.h> */ /* From <linux/vt.h> */
#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
int deallocvt_main(int argc, char *argv[]) int deallocvt_main(int argc, char *argv[])
{ {

View File

@ -32,11 +32,11 @@ struct kbentry {
unsigned char kb_index; unsigned char kb_index;
unsigned short kb_value; unsigned short kb_value;
}; };
#define KDGKBENT 0x4B46 /* gets one entry in translation table */ static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
/* From <linux/keyboard.h> */ /* From <linux/keyboard.h> */
#define NR_KEYS 128 static const int NR_KEYS = 128;
#define MAX_NR_KEYMAPS 256 static const int MAX_NR_KEYMAPS = 256;
int dumpkmap_main(int argc, char **argv) int dumpkmap_main(int argc, char **argv)
{ {

View File

@ -21,13 +21,13 @@
#include <sys/kd.h> #include <sys/kd.h>
#include <endian.h> #include <endian.h>
#define PSF_MAGIC1 0x36 static const int PSF_MAGIC1 = 0x36;
#define PSF_MAGIC2 0x04 static const int PSF_MAGIC2 = 0x04;
#define PSF_MODE512 0x01 static const int PSF_MODE512 = 0x01;
#define PSF_MODEHASTAB 0x02 static const int PSF_MODEHASTAB = 0x02;
#define PSF_MAXMODE 0x03 static const int PSF_MAXMODE = 0x03;
#define PSF_SEPARATOR 0xFFFF static const int PSF_SEPARATOR = 0xFFFF;
struct psf_header { struct psf_header {
unsigned char magic1, magic2; /* Magic number */ unsigned char magic1, magic2; /* Magic number */

View File

@ -34,11 +34,11 @@ struct kbentry {
unsigned char kb_index; unsigned char kb_index;
unsigned short kb_value; unsigned short kb_value;
}; };
#define KDSKBENT 0x4B47 /* sets one entry in translation table */ static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
/* From <linux/keyboard.h> */ /* From <linux/keyboard.h> */
#define NR_KEYS 128 static const int NR_KEYS = 128;
#define MAX_NR_KEYMAPS 256 static const int MAX_NR_KEYMAPS = 256;
int loadkmap_main(int argc, char **argv) int loadkmap_main(int argc, char **argv)
{ {

View File

@ -33,7 +33,7 @@
struct kbkeycode { struct kbkeycode {
unsigned int scancode, keycode; unsigned int scancode, keycode;
}; };
#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
extern int extern int
setkeycodes_main(int argc, char** argv) setkeycodes_main(int argc, char** argv)

View File

@ -30,9 +30,9 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#define LN_SYMLINK 1 static const int LN_SYMLINK = 1;
#define LN_FORCE 2 static const int LN_FORCE = 2;
#define LN_NODEREFERENCE 4 static const int LN_NODEREFERENCE = 4;
/* /*
* linkDestName is where the link points to, * linkDestName is where the link points to,

View File

@ -41,9 +41,9 @@
* 1. requires lstat (BSD) - how do you do it without? * 1. requires lstat (BSD) - how do you do it without?
*/ */
#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ static const int TERMINAL_WIDTH = 80; /* use 79 if your terminal has linefold bug */
#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ static const int COLUMN_WIDTH = 14; /* default if AUTOWIDTH not defined */
#define COLUMN_GAP 2 /* includes the file type char, if present */ static const int COLUMN_GAP = 2; /* includes the file type char, if present */
/************************************************************************/ /************************************************************************/
@ -66,10 +66,12 @@
#endif #endif
/* what is the overall style of the listing */ /* what is the overall style of the listing */
#define STYLE_AUTO 0 enum {
#define STYLE_LONG 1 /* one record per line, extended info */ STYLE_AUTO = 0,
#define STYLE_SINGLE 2 /* one record per line */ STYLE_LONG = 1, /* one record per line, extended info */
#define STYLE_COLUMNS 3 /* fill columns */ STYLE_SINGLE = 2, /* one record per line */
STYLE_COLUMNS = 3 /* fill columns */
};
/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */
/* what file information will be listed */ /* what file information will be listed */
@ -99,23 +101,23 @@
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
/* how will the files be sorted */ /* how will the files be sorted */
#define SORT_FORWARD 0 /* sort in reverse order */ static const int SORT_FORWARD = 0; /* sort in reverse order */
#define SORT_REVERSE 1 /* sort in reverse order */ static const int SORT_REVERSE = 1; /* sort in reverse order */
#define SORT_NAME 2 /* sort by file name */ static const int SORT_NAME = 2; /* sort by file name */
#define SORT_SIZE 3 /* sort by file size */ static const int SORT_SIZE = 3; /* sort by file size */
#define SORT_ATIME 4 /* sort by last access time */ static const int SORT_ATIME = 4; /* sort by last access time */
#define SORT_CTIME 5 /* sort by last change time */ static const int SORT_CTIME = 5; /* sort by last change time */
#define SORT_MTIME 6 /* sort by last modification time */ static const int SORT_MTIME = 6; /* sort by last modification time */
#define SORT_VERSION 7 /* sort by version */ static const int SORT_VERSION = 7; /* sort by version */
#define SORT_EXT 8 /* sort by file name extension */ static const int SORT_EXT = 8; /* sort by file name extension */
#define SORT_DIR 9 /* sort by file or directory */ static const int SORT_DIR = 9; /* sort by file or directory */
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
/* which of the three times will be used */ /* which of the three times will be used */
#define TIME_MOD 0 static const int TIME_MOD = 0;
#define TIME_CHANGE 1 static const int TIME_CHANGE = 1;
#define TIME_ACCESS 2 static const int TIME_ACCESS = 2;
#endif #endif
#define LIST_SHORT (LIST_FILENAME) #define LIST_SHORT (LIST_FILENAME)
@ -125,9 +127,9 @@
LIST_SYMLINK) LIST_SYMLINK)
#define LIST_ILONG (LIST_INO | LIST_LONG) #define LIST_ILONG (LIST_INO | LIST_LONG)
#define SPLIT_DIR 0 static const int SPLIT_DIR = 0;
#define SPLIT_FILE 1 static const int SPLIT_FILE = 1;
#define SPLIT_SUBDIR 2 static const int SPLIT_SUBDIR = 2;
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
@ -150,15 +152,15 @@ struct dnode **list_dir(char *);
struct dnode **dnalloc(int); struct dnode **dnalloc(int);
int list_single(struct dnode *); int list_single(struct dnode *);
static unsigned int disp_opts= DISP_NORMAL; static unsigned int disp_opts;
static unsigned int style_fmt= STYLE_AUTO ; static unsigned int style_fmt;
static unsigned int list_fmt= LIST_SHORT ; static unsigned int list_fmt;
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
static unsigned int sort_opts= SORT_FORWARD; static unsigned int sort_opts;
static unsigned int sort_order= SORT_FORWARD; static unsigned int sort_order;
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
static unsigned int time_fmt= TIME_MOD; static unsigned int time_fmt;
#endif #endif
#ifdef BB_FEATURE_LS_FOLLOWLINKS #ifdef BB_FEATURE_LS_FOLLOWLINKS
static unsigned int follow_links=FALSE; static unsigned int follow_links=FALSE;
@ -166,12 +168,9 @@ static unsigned int follow_links=FALSE;
static unsigned short column = 0; static unsigned short column = 0;
#ifdef BB_FEATURE_AUTOWIDTH #ifdef BB_FEATURE_AUTOWIDTH
static unsigned short terminal_width = TERMINAL_WIDTH; static unsigned short terminal_width;
static unsigned short column_width = COLUMN_WIDTH; static unsigned short column_width;
static unsigned short tabstops = 8; static unsigned short tabstops;
#else
#define terminal_width TERMINAL_WIDTH
#define column_width COLUMN_WIDTH
#endif #endif
static int status = EXIT_SUCCESS; static int status = EXIT_SUCCESS;
@ -710,9 +709,15 @@ extern int ls_main(int argc, char **argv)
list_fmt= LIST_SHORT; list_fmt= LIST_SHORT;
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
sort_opts= SORT_NAME; sort_opts= SORT_NAME;
sort_order= SORT_FORWARD;
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
time_fmt= TIME_MOD; time_fmt= TIME_MOD;
#endif
#ifdef BB_FEATURE_AUTOWIDTH
terminal_width = TERMINAL_WIDTH;
column_width = COLUMN_WIDTH;
tabstops = 8;
#endif #endif
nfiles=0; nfiles=0;

View File

@ -91,7 +91,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _MD5_H #ifndef _MD5_H
#define _MD5_H 1 static const int _MD5_H = 1;
#include <stdio.h> #include <stdio.h>
@ -251,7 +251,7 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
int md5_stream(FILE *stream, void *resblock) int md5_stream(FILE *stream, void *resblock)
{ {
/* Important: BLOCKSIZE must be a multiple of 64. */ /* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096 static const int BLOCKSIZE = 4096;
struct md5_ctx ctx; struct md5_ctx ctx;
char buffer[BLOCKSIZE + 72]; char buffer[BLOCKSIZE + 72];
size_t sum; size_t sum;
@ -529,7 +529,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
/* The minimum length of a valid digest line in a file produced /* The minimum length of a valid digest line in a file produced
by `md5sum FILE' and read by `md5sum -c'. This length does by `md5sum FILE' and read by `md5sum -c'. This length does
not include any newline character at the end of a line. */ not include any newline character at the end of a line. */
#define MIN_DIGEST_LINE_LENGTH 35 /* 32 - message digest length static const int MIN_DIGEST_LINE_LENGTH = 35; /* 32 - message digest length
2 - blank and binary indicator 2 - blank and binary indicator
1 - minimum filename length */ 1 - minimum filename length */

View File

@ -59,7 +59,7 @@
#ifndef S_IFMT #ifndef S_IFMT
# define S_IFMT 0170000 static const int S_IFMT = 0170000;
#endif #endif
#if !defined(S_ISBLK) && defined(S_IFBLK) #if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)

View File

@ -34,14 +34,15 @@
#define bb_need_write_error #define bb_need_write_error
#include "messages.c" #include "messages.c"
#define ASCII 0377 static const int ASCII = 0377;
/* some glabals shared across this file */ /* some glabals shared across this file */
static char com_fl, del_fl, sq_fl; static char com_fl, del_fl, sq_fl;
static unsigned char output[BUFSIZ], input[BUFSIZ];
static unsigned char vector[ASCII + 1];
static char invec[ASCII + 1], outvec[ASCII + 1];
static short in_index, out_index; static short in_index, out_index;
/* these last are pointers to static buffers declared in tr_main */
static unsigned char *poutput, *pinput;
static unsigned char *pvector;
static char *pinvec, *poutvec;
static void convert() static void convert()
@ -52,22 +53,22 @@ static void convert()
for (;;) { for (;;) {
if (in_index == read_chars) { if (in_index == read_chars) {
if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) { if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
if (write(1, (char *) output, out_index) != out_index) if (write(1, (char *) poutput, out_index) != out_index)
write(2, write_error, strlen(write_error)); write(2, write_error, strlen(write_error));
exit(0); exit(0);
} }
in_index = 0; in_index = 0;
} }
c = input[in_index++]; c = pinput[in_index++];
coded = vector[c]; coded = pvector[c];
if (del_fl && invec[c]) if (del_fl && pinvec[c])
continue; continue;
if (sq_fl && last == coded && (invec[c] || outvec[coded])) if (sq_fl && last == coded && (pinvec[c] || poutvec[coded]))
continue; continue;
output[out_index++] = last = coded; poutput[out_index++] = last = coded;
if (out_index == BUFSIZ) { if (out_index == BUFSIZ) {
if (write(1, (char *) output, out_index) != out_index) { if (write(1, (char *) poutput, out_index) != out_index) {
write(2, write_error, strlen(write_error)); write(2, write_error, strlen(write_error));
exit(1); exit(1);
} }
@ -86,9 +87,9 @@ static void map(register unsigned char *string1, unsigned int string1_len,
for (j = 0, i = 0; i < string1_len; i++) { for (j = 0, i = 0; i < string1_len; i++) {
if (string2_len <= j) if (string2_len <= j)
vector[string1[i]] = last; pvector[string1[i]] = last;
else else
vector[string1[i]] = last = string2[j++]; pvector[string1[i]] = last = string2[j++];
} }
} }
@ -143,6 +144,17 @@ extern int tr_main(int argc, char **argv)
int output_length=0, input_length; int output_length=0, input_length;
int index = 1; int index = 1;
int i; int i;
/* set up big arrays here (better than making a bunch of static arrays up top) */
unsigned char output[BUFSIZ], input[BUFSIZ];
unsigned char vector[ASCII + 1];
char invec[ASCII + 1], outvec[ASCII + 1];
/* ... but make them available globally */
poutput = output;
pinput = input;
pvector = vector;
pinvec = invec;
poutvec = outvec;
if (argc > 1 && argv[index][0] == '-') { if (argc > 1 && argv[index][0] == '-') {
for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {

View File

@ -44,22 +44,22 @@ static void print_element(unsigned int mask, char *element);
/* Values that are bitwise or'd into `toprint'. */ /* Values that are bitwise or'd into `toprint'. */
/* Operating system name. */ /* Operating system name. */
#define PRINT_SYSNAME 1 static const int PRINT_SYSNAME = 1;
/* Node name on a communications network. */ /* Node name on a communications network. */
#define PRINT_NODENAME 2 static const int PRINT_NODENAME = 2;
/* Operating system release. */ /* Operating system release. */
#define PRINT_RELEASE 4 static const int PRINT_RELEASE = 4;
/* Operating system version. */ /* Operating system version. */
#define PRINT_VERSION 8 static const int PRINT_VERSION = 8;
/* Machine hardware name. */ /* Machine hardware name. */
#define PRINT_MACHINE 16 static const int PRINT_MACHINE = 16;
/* Host processor type. */ /* Host processor type. */
#define PRINT_PROCESSOR 32 static const int PRINT_PROCESSOR = 32;
/* Mask indicating which elements of the name to print. */ /* Mask indicating which elements of the name to print. */
static unsigned char toprint; static unsigned char toprint;

10
cp_mv.c
View File

@ -43,8 +43,8 @@
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#define is_cp 0 static const int is_cp = 0;
#define is_mv 1 static const int is_mv = 1;
static int dz_i; /* index into cp_mv_usage */ static int dz_i; /* index into cp_mv_usage */
static const char *cp_mv_usage[] = /* .rodata */ static const char *cp_mv_usage[] = /* .rodata */
@ -62,7 +62,7 @@ static const char *baseSrcName;
static int srcDirFlag; static int srcDirFlag;
static struct stat srcStatBuf; static struct stat srcStatBuf;
static char baseDestName[BUFSIZ + 1]; static char *pBaseDestName;
static size_t baseDestLen; static size_t baseDestLen;
static int destDirFlag; static int destDirFlag;
static struct stat destStatBuf; static struct stat destStatBuf;
@ -104,7 +104,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
const char *srcBasename; const char *srcBasename;
char *name; char *name;
strcpy(destName, baseDestName); strcpy(destName, pBaseDestName);
destLen = strlen(destName); destLen = strlen(destName);
if (srcDirFlag == TRUE) { if (srcDirFlag == TRUE) {
@ -175,6 +175,8 @@ extern int cp_mv_main(int argc, char **argv)
{ {
volatile int i; volatile int i;
int c; int c;
char baseDestName[BUFSIZ + 1]; /* not declared globally == less bss used */
pBaseDestName = baseDestName; /* but available globally */
if (*applet_name == 'c' && *(applet_name + 1) == 'p') if (*applet_name == 'c' && *(applet_name + 1) == 'p')
dz_i = is_cp; dz_i = is_cp;

View File

@ -11,7 +11,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
/* From <linux/vt.h> */ /* From <linux/vt.h> */
#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
int deallocvt_main(int argc, char *argv[]) int deallocvt_main(int argc, char *argv[])
{ {

View File

@ -32,11 +32,11 @@ struct kbentry {
unsigned char kb_index; unsigned char kb_index;
unsigned short kb_value; unsigned short kb_value;
}; };
#define KDGKBENT 0x4B46 /* gets one entry in translation table */ static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
/* From <linux/keyboard.h> */ /* From <linux/keyboard.h> */
#define NR_KEYS 128 static const int NR_KEYS = 128;
#define MAX_NR_KEYMAPS 256 static const int MAX_NR_KEYMAPS = 256;
int dumpkmap_main(int argc, char **argv) int dumpkmap_main(int argc, char **argv)
{ {

92
fbset.c
View File

@ -36,53 +36,55 @@
#define DEFAULTFBDEV "/dev/fb0" #define DEFAULTFBDEV "/dev/fb0"
#define DEFAULTFBMODE "/etc/fb.modes" #define DEFAULTFBMODE "/etc/fb.modes"
#define OPT_CHANGE 1 static const int OPT_CHANGE = (1 << 0);
#define OPT_INFO (1 << 1) static const int OPT_INFO = (1 << 1);
#define OPT_READMODE (1 << 2) static const int OPT_READMODE = (1 << 2);
#define CMD_HELP 0 enum {
#define CMD_FB 1 CMD_HELP = 0,
#define CMD_DB 2 CMD_FB = 1,
#define CMD_GEOMETRY 3 CMD_DB = 2,
#define CMD_TIMING 4 CMD_GEOMETRY = 3,
#define CMD_ACCEL 5 CMD_TIMING = 4,
#define CMD_HSYNC 6 CMD_ACCEL = 5,
#define CMD_VSYNC 7 CMD_HSYNC = 6,
#define CMD_LACED 8 CMD_VSYNC = 7,
#define CMD_DOUBLE 9 CMD_LACED = 8,
/* #define CMD_XCOMPAT 10 */ CMD_DOUBLE = 9,
#define CMD_ALL 11 /* CMD_XCOMPAT = 10, */
#define CMD_INFO 12 CMD_ALL = 11,
#define CMD_CHANGE 13 CMD_INFO = 12,
CMD_CHANGE = 13,
#ifdef BB_FEATURE_FBSET_FANCY #ifdef BB_FEATURE_FBSET_FANCY
#define CMD_XRES 100 CMD_XRES = 100,
#define CMD_YRES 101 CMD_YRES = 101,
#define CMD_VXRES 102 CMD_VXRES = 102,
#define CMD_VYRES 103 CMD_VYRES = 103,
#define CMD_DEPTH 104 CMD_DEPTH = 104,
#define CMD_MATCH 105 CMD_MATCH = 105,
#define CMD_PIXCLOCK 106 CMD_PIXCLOCK = 106,
#define CMD_LEFT 107 CMD_LEFT = 107,
#define CMD_RIGHT 108 CMD_RIGHT = 108,
#define CMD_UPPER 109 CMD_UPPER = 109,
#define CMD_LOWER 110 CMD_LOWER = 110,
#define CMD_HSLEN 111 CMD_HSLEN = 111,
#define CMD_VSLEN 112 CMD_VSLEN = 112,
#define CMD_CSYNC 113 CMD_CSYNC = 113,
#define CMD_GSYNC 114 CMD_GSYNC = 114,
#define CMD_EXTSYNC 115 CMD_EXTSYNC = 115,
#define CMD_BCAST 116 CMD_BCAST = 116,
#define CMD_RGBA 117 CMD_RGBA = 117,
#define CMD_STEP 118 CMD_STEP = 118,
#define CMD_MOVE 119 CMD_MOVE = 119,
#endif #endif
};
static unsigned int g_options = 0; static unsigned int g_options = 0;
/* Stuff stolen from the kernel's fb.h */ /* Stuff stolen from the kernel's fb.h */
#define FBIOGET_VSCREENINFO 0x4600 static const int FBIOGET_VSCREENINFO = 0x4600;
#define FBIOPUT_VSCREENINFO 0x4601 static const int FBIOPUT_VSCREENINFO = 0x4601;
#define __u32 unsigned int #define __u32 unsigned int
struct fb_bitfield { struct fb_bitfield {
__u32 offset; /* beginning of bitfield */ __u32 offset; /* beginning of bitfield */
@ -180,12 +182,12 @@ struct cmdoptions_t {
#ifdef BB_FEATURE_FBSET_READMODE #ifdef BB_FEATURE_FBSET_READMODE
/* taken from linux/fb.h */ /* taken from linux/fb.h */
#define FB_VMODE_INTERLACED 1 /* interlaced */ static const int FB_VMODE_INTERLACED = 1; /* interlaced */
#define FB_VMODE_DOUBLE 2 /* double scan */ static const int FB_VMODE_DOUBLE = 2; /* double scan */
#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */
#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */
#define FB_SYNC_EXT 4 /* external sync */ static const int FB_SYNC_EXT = 4; /* external sync */
#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */
#endif #endif
static int readmode(struct fb_var_screeninfo *base, const char *fn, static int readmode(struct fb_var_screeninfo *base, const char *fn,
const char *mode) const char *mode)

View File

@ -104,24 +104,24 @@ typedef unsigned short u16;
typedef unsigned int u32; typedef unsigned int u32;
#define MINIX_ROOT_INO 1 static const int MINIX_ROOT_INO = 1;
#define MINIX_LINK_MAX 250 static const int MINIX_LINK_MAX = 250;
#define MINIX2_LINK_MAX 65530 static const int MINIX2_LINK_MAX = 65530;
#define MINIX_I_MAP_SLOTS 8 static const int MINIX_I_MAP_SLOTS = 8;
#define MINIX_Z_MAP_SLOTS 64 static const int MINIX_Z_MAP_SLOTS = 64;
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
#define MINIX_VALID_FS 0x0001 /* Clean fs. */ static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) #define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
#define MINIX_V1 0x0001 /* original minix fs */ static const int MINIX_V1 = 0x0001; /* original minix fs */
#define MINIX_V2 0x0002 /* minix V2 fs */ static const int MINIX_V2 = 0x0002; /* minix V2 fs */
#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version #define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
@ -185,12 +185,6 @@ struct minix_dir_entry {
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
#define MINIX_VALID_FS 0x0001 /* Clean fs. */
#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
#ifndef BLKGETSIZE #ifndef BLKGETSIZE
#define BLKGETSIZE _IO(0x12,96) /* return device size */ #define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif #endif
@ -199,7 +193,7 @@ struct minix_dir_entry {
#define volatile #define volatile
#endif #endif
#define ROOT_INO 1 static const int ROOT_INO = 1;
#define UPPER(size,n) ((size+((n)-1))/(n)) #define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode)) #define INODE_SIZE (sizeof(struct minix_inode))
@ -231,7 +225,7 @@ static struct termios termios;
static int termios_set = 0; static int termios_set = 0;
/* File-name data */ /* File-name data */
#define MAX_DEPTH 32 static const int MAX_DEPTH = 32;
static int name_depth = 0; static int name_depth = 0;
// static char name_list[MAX_DEPTH][BUFSIZ + 1]; // static char name_list[MAX_DEPTH][BUFSIZ + 1];
static char **name_list = NULL; static char **name_list = NULL;

View File

@ -53,9 +53,9 @@
/* NON_OPT is the code that is returned when a non-option is found in '+' /* NON_OPT is the code that is returned when a non-option is found in '+'
mode */ mode */
#define NON_OPT 1 static const int NON_OPT = 1;
/* LONG_OPT is the code that is returned when a long option is found. */ /* LONG_OPT is the code that is returned when a long option is found. */
#define LONG_OPT 2 static const int LONG_OPT = 2;
/* The shells recognized. */ /* The shells recognized. */
typedef enum {BASH,TCSH} shell_t; typedef enum {BASH,TCSH} shell_t;
@ -199,7 +199,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
static struct option *long_options=NULL; static struct option *long_options=NULL;
static int long_options_length=0; /* Length of array */ static int long_options_length=0; /* Length of array */
static int long_options_nr=0; /* Nr of used elements in array */ static int long_options_nr=0; /* Nr of used elements in array */
#define LONG_OPTIONS_INCR 10 static const int LONG_OPTIONS_INCR = 10;
#define init_longopt() add_longopt(NULL,0) #define init_longopt() add_longopt(NULL,0)
/* Register a long option. The contents of name is copied. */ /* Register a long option. The contents of name is copied. */

View File

@ -76,40 +76,40 @@ static char *license_msg[] = {
#define bb_need_name_too_long #define bb_need_name_too_long
#include "messages.c" #include "messages.c"
#define RECORD_IO 0 static const int RECORD_IO = 0;
/* Return codes from gzip */ /* Return codes from gzip */
#define OK 0 static const int OK = 0;
#define ERROR 1 static const int ERROR = 1;
#define WARNING 2 static const int WARNING = 2;
#define DEFLATED 8 static const int DEFLATED = 8;
#define INBUFSIZ 0x2000 /* input buffer size */ static const int INBUFSIZ = 0x2000; /* input buffer size */
#define INBUF_EXTRA 64 /* required by unlzw() */ static const int INBUF_EXTRA = 64; /* required by unlzw() */
#define OUTBUFSIZ 8192 /* output buffer size */ static const int OUTBUFSIZ = 8192; /* output buffer size */
#define OUTBUF_EXTRA 2048 /* required by unlzw() */ static const int OUTBUF_EXTRA = 2048; /* required by unlzw() */
#define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */ static const int DIST_BUFSIZE = 0x2000; /* buffer for distances, see trees.c */
#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */ #define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B */
/* gzip flag byte */ /* gzip flag byte */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ static const int EXTRA_FIELD = 0x04; /* bit 2 set: extra field present */
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ static const int ORIG_NAME = 0x08; /* bit 3 set: original file name present */
#define COMMENT 0x10 /* bit 4 set: file comment present */ static const int COMMENT = 0x10; /* bit 4 set: file comment present */
#define WSIZE 0x8000 /* window size--must be a power of two, and */ static const int WSIZE = 0x8000; /* window size--must be a power of two, and */
/* at least 32K for zip's deflate method */ /* at least 32K for zip's deflate method */
/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
#define BMAX 16 /* maximum bit length of any code (16 for explode) */ static const int BMAX = 16; /* maximum bit length of any code (16 for explode) */
#define N_MAX 288 /* maximum number of codes in any set */ static const int N_MAX = 288; /* maximum number of codes in any set */
/* PKZIP header definitions */ /* PKZIP header definitions */
#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ static const int LOCSIG = 0x04034b50L; /* four-byte lead-in (lsb first) */
#define LOCCRC 14 /* offset of crc */ static const int LOCCRC = 14; /* offset of crc */
#define LOCLEN 22 /* offset of uncompressed length */ static const int LOCLEN = 22; /* offset of uncompressed length */
#define EXTHDR 16 /* size of extended local header, inc sig */ static const int EXTHDR = 16; /* size of extended local header, inc sig */
#define BITS 16 static const int BITS = 16;
/* Diagnostic functions */ /* Diagnostic functions */
#ifdef DEBUG #ifdef DEBUG
@ -132,7 +132,7 @@ static char *license_msg[] = {
# ifdef BUFSIZ # ifdef BUFSIZ
# define MAX_PATH_LEN BUFSIZ # define MAX_PATH_LEN BUFSIZ
# else # else
# define MAX_PATH_LEN 1024 static const int MAX_PATH_LEN = 1024;
# endif # endif
#endif #endif
@ -165,8 +165,8 @@ static ush *tab_prefix1;
/* local variables */ /* local variables */
static int test_mode = 0; /* check file integrity option */ static int test_mode = 0; /* check file integrity option */
static int foreground; /* set if program run in foreground */ static int foreground; /* set if program run in foreground */
static int method = DEFLATED; /* compression method */ static int method; /* compression method */
static int exit_code = OK; /* program exit code */ static int exit_code; /* program exit code */
static int last_member; /* set for .zip and .Z files */ static int last_member; /* set for .zip and .Z files */
static int part_nb; /* number of parts in .gz file */ static int part_nb; /* number of parts in .gz file */
static long ifile_size; /* input file size, -1 for devices (debug only) */ static long ifile_size; /* input file size, -1 for devices (debug only) */
@ -1225,6 +1225,9 @@ int gunzip_main(int argc, char **argv)
char ifname[MAX_PATH_LEN + 1]; /* input file name */ char ifname[MAX_PATH_LEN + 1]; /* input file name */
char ofname[MAX_PATH_LEN + 1]; /* output file name */ char ofname[MAX_PATH_LEN + 1]; /* output file name */
method = DEFLATED; /* default compression method */
exit_code = OK; /* let's go out on a limb and assume everything will run fine (wink wink) */
if (strcmp(applet_name, "zcat") == 0) { if (strcmp(applet_name, "zcat") == 0) {
force = 1; force = 1;
tostdout = 1; tostdout = 1;

14
init.c
View File

@ -56,7 +56,7 @@ struct vt_stat {
unsigned short v_signal; /* signal to send */ unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bitmask */ unsigned short v_state; /* vt bitmask */
}; };
#define VT_GETSTATE 0x5603 /* get global vt state info */ static const int VT_GETSTATE = 0x5603; /* get global vt state info */
/* From <linux/serial.h> */ /* From <linux/serial.h> */
struct serial_struct { struct serial_struct {
@ -79,11 +79,11 @@ struct serial_struct {
#ifndef RB_HALT_SYSTEM #ifndef RB_HALT_SYSTEM
#define RB_HALT_SYSTEM 0xcdef0123 static const int RB_HALT_SYSTEM = 0xcdef0123;
#define RB_ENABLE_CAD 0x89abcdef static const int RB_ENABLE_CAD = 0x89abcdef;
#define RB_DISABLE_CAD 0 static const int RB_DISABLE_CAD = 0;
#define RB_POWER_OFF 0x4321fedc #define RB_POWER_OFF 0x4321fedc
#define RB_AUTOBOOT 0x01234567 static const int RB_AUTOBOOT = 0x01234567;
#if defined(__GLIBC__) || defined (__UCLIBC__) #if defined(__GLIBC__) || defined (__UCLIBC__)
#include <sys/reboot.h> #include <sys/reboot.h>
#define init_reboot(magic) reboot(magic) #define init_reboot(magic) reboot(magic)
@ -131,8 +131,8 @@ static _syscall2(int, bdflush, int, func, int, data);
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
#endif #endif
#define LOG 0x1 static const int LOG = 0x1;
#define CONSOLE 0x2 static const int CONSOLE = 0x2;
/* Allowed init action types */ /* Allowed init action types */
typedef enum { typedef enum {

View File

@ -56,7 +56,7 @@ struct vt_stat {
unsigned short v_signal; /* signal to send */ unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bitmask */ unsigned short v_state; /* vt bitmask */
}; };
#define VT_GETSTATE 0x5603 /* get global vt state info */ static const int VT_GETSTATE = 0x5603; /* get global vt state info */
/* From <linux/serial.h> */ /* From <linux/serial.h> */
struct serial_struct { struct serial_struct {
@ -79,11 +79,11 @@ struct serial_struct {
#ifndef RB_HALT_SYSTEM #ifndef RB_HALT_SYSTEM
#define RB_HALT_SYSTEM 0xcdef0123 static const int RB_HALT_SYSTEM = 0xcdef0123;
#define RB_ENABLE_CAD 0x89abcdef static const int RB_ENABLE_CAD = 0x89abcdef;
#define RB_DISABLE_CAD 0 static const int RB_DISABLE_CAD = 0;
#define RB_POWER_OFF 0x4321fedc #define RB_POWER_OFF 0x4321fedc
#define RB_AUTOBOOT 0x01234567 static const int RB_AUTOBOOT = 0x01234567;
#if defined(__GLIBC__) || defined (__UCLIBC__) #if defined(__GLIBC__) || defined (__UCLIBC__)
#include <sys/reboot.h> #include <sys/reboot.h>
#define init_reboot(magic) reboot(magic) #define init_reboot(magic) reboot(magic)
@ -131,8 +131,8 @@ static _syscall2(int, bdflush, int, func, int, data);
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */ #define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
#endif #endif
#define LOG 0x1 static const int LOG = 0x1;
#define CONSOLE 0x2 static const int CONSOLE = 0x2;
/* Allowed init action types */ /* Allowed init action types */
typedef enum { typedef enum {

View File

@ -76,9 +76,9 @@
#ifndef MODUTILS_MODULE_H #ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1 static const int MODUTILS_MODULE_H = 1;
#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels. /* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish We do not use the kernel headers directly because we do not wish
@ -135,7 +135,7 @@ struct old_module
}; };
/* Sent to init_module(2) or'ed into the code size parameter. */ /* Sent to init_module(2) or'ed into the code size parameter. */
#define OLD_MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ static const int OLD_MOD_AUTOCLEAN = 0x40000000; /* big enough, but no sign problems... */
int get_kernel_syms(struct old_kernel_sym *); int get_kernel_syms(struct old_kernel_sym *);
int old_sys_init_module(const char *name, char *code, unsigned codesize, int 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,
#undef tgt_sizeof_char_p #undef tgt_sizeof_char_p
#undef tgt_sizeof_void_p #undef tgt_sizeof_void_p
#undef tgt_long #undef tgt_long
#define tgt_sizeof_long 8 static const int tgt_sizeof_long = 8;
#define tgt_sizeof_char_p 8 static const int tgt_sizeof_char_p = 8;
#define tgt_sizeof_void_p 8 static const int tgt_sizeof_void_p = 8;
#define tgt_long long long #define tgt_long long long
#endif #endif
@ -222,11 +222,11 @@ struct new_module_info
}; };
/* Bits of module.flags. */ /* Bits of module.flags. */
#define NEW_MOD_RUNNING 1 static const int NEW_MOD_RUNNING = 1;
#define NEW_MOD_DELETED 2 static const int NEW_MOD_DELETED = 2;
#define NEW_MOD_AUTOCLEAN 4 static const int NEW_MOD_AUTOCLEAN = 4;
#define NEW_MOD_VISITED 8 static const int NEW_MOD_VISITED = 8;
#define NEW_MOD_USED_ONCE 16 static const int NEW_MOD_USED_ONCE = 16;
int new_sys_init_module(const char *name, const struct new_module *); int new_sys_init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, size_t bufsize, int 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,
/* Values for query_module's which. */ /* Values for query_module's which. */
#define QM_MODULES 1 static const int QM_MODULES = 1;
#define QM_DEPS 2 static const int QM_DEPS = 2;
#define QM_REFS 3 static const int QM_REFS = 3;
#define QM_SYMBOLS 4 static const int QM_SYMBOLS = 4;
#define QM_INFO 5 static const int QM_INFO = 5;
/*======================================================================*/ /*======================================================================*/
/* The system calls unchanged between 2.0 and 2.1. */ /* The system calls unchanged between 2.0 and 2.1. */
@ -282,9 +282,9 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H #ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1 static const int MODUTILS_OBJ_H = 1;
#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
/* The relocatable object is manipulated using elfin types. */ /* The relocatable object is manipulated using elfin types. */
@ -517,7 +517,7 @@ int arch_init_module (struct obj_file *f, struct new_module *);
#define _PATH_MODULES "/lib/modules" #define _PATH_MODULES "/lib/modules"
#define STRVERSIONLEN 32 static const int STRVERSIONLEN = 32;
#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL) #if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined" #error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"

4
kill.c
View File

@ -30,8 +30,8 @@
#include <ctype.h> #include <ctype.h>
#include <unistd.h> #include <unistd.h>
#define KILL 0 static const int KILL = 0;
#define KILLALL 1 static const int KILLALL = 1;
struct signal_name { struct signal_name {
const char *name; const char *name;

4
lash.c
View File

@ -64,8 +64,8 @@
#include <getopt.h> #include <getopt.h>
#include "cmdedit.h" #include "cmdedit.h"
#define MAX_LINE 256 /* size of input buffer for cwd data */ static const int MAX_LINE = 256; /* size of input buffer for cwd data */
#define MAX_READ 128 /* size of input buffer for `read' builtin */ static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" #define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
extern size_t NUM_APPLETS; extern size_t NUM_APPLETS;

6
ln.c
View File

@ -30,9 +30,9 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#define LN_SYMLINK 1 static const int LN_SYMLINK = 1;
#define LN_FORCE 2 static const int LN_FORCE = 2;
#define LN_NODEREFERENCE 4 static const int LN_NODEREFERENCE = 4;
/* /*
* linkDestName is where the link points to, * linkDestName is where the link points to,

View File

@ -21,13 +21,13 @@
#include <sys/kd.h> #include <sys/kd.h>
#include <endian.h> #include <endian.h>
#define PSF_MAGIC1 0x36 static const int PSF_MAGIC1 = 0x36;
#define PSF_MAGIC2 0x04 static const int PSF_MAGIC2 = 0x04;
#define PSF_MODE512 0x01 static const int PSF_MODE512 = 0x01;
#define PSF_MODEHASTAB 0x02 static const int PSF_MODEHASTAB = 0x02;
#define PSF_MAXMODE 0x03 static const int PSF_MAXMODE = 0x03;
#define PSF_SEPARATOR 0xFFFF static const int PSF_SEPARATOR = 0xFFFF;
struct psf_header { struct psf_header {
unsigned char magic1, magic2; /* Magic number */ unsigned char magic1, magic2; /* Magic number */

View File

@ -34,11 +34,11 @@ struct kbentry {
unsigned char kb_index; unsigned char kb_index;
unsigned short kb_value; unsigned short kb_value;
}; };
#define KDSKBENT 0x4B47 /* sets one entry in translation table */ static const int KDSKBENT = 0x4B47; /* sets one entry in translation table */
/* From <linux/keyboard.h> */ /* From <linux/keyboard.h> */
#define NR_KEYS 128 static const int NR_KEYS = 128;
#define MAX_NR_KEYMAPS 256 static const int MAX_NR_KEYMAPS = 256;
int loadkmap_main(int argc, char **argv) int loadkmap_main(int argc, char **argv)
{ {

75
ls.c
View File

@ -41,9 +41,9 @@
* 1. requires lstat (BSD) - how do you do it without? * 1. requires lstat (BSD) - how do you do it without?
*/ */
#define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ static const int TERMINAL_WIDTH = 80; /* use 79 if your terminal has linefold bug */
#define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ static const int COLUMN_WIDTH = 14; /* default if AUTOWIDTH not defined */
#define COLUMN_GAP 2 /* includes the file type char, if present */ static const int COLUMN_GAP = 2; /* includes the file type char, if present */
/************************************************************************/ /************************************************************************/
@ -66,10 +66,12 @@
#endif #endif
/* what is the overall style of the listing */ /* what is the overall style of the listing */
#define STYLE_AUTO 0 enum {
#define STYLE_LONG 1 /* one record per line, extended info */ STYLE_AUTO = 0,
#define STYLE_SINGLE 2 /* one record per line */ STYLE_LONG = 1, /* one record per line, extended info */
#define STYLE_COLUMNS 3 /* fill columns */ STYLE_SINGLE = 2, /* one record per line */
STYLE_COLUMNS = 3 /* fill columns */
};
/* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */
/* what file information will be listed */ /* what file information will be listed */
@ -99,23 +101,23 @@
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
/* how will the files be sorted */ /* how will the files be sorted */
#define SORT_FORWARD 0 /* sort in reverse order */ static const int SORT_FORWARD = 0; /* sort in reverse order */
#define SORT_REVERSE 1 /* sort in reverse order */ static const int SORT_REVERSE = 1; /* sort in reverse order */
#define SORT_NAME 2 /* sort by file name */ static const int SORT_NAME = 2; /* sort by file name */
#define SORT_SIZE 3 /* sort by file size */ static const int SORT_SIZE = 3; /* sort by file size */
#define SORT_ATIME 4 /* sort by last access time */ static const int SORT_ATIME = 4; /* sort by last access time */
#define SORT_CTIME 5 /* sort by last change time */ static const int SORT_CTIME = 5; /* sort by last change time */
#define SORT_MTIME 6 /* sort by last modification time */ static const int SORT_MTIME = 6; /* sort by last modification time */
#define SORT_VERSION 7 /* sort by version */ static const int SORT_VERSION = 7; /* sort by version */
#define SORT_EXT 8 /* sort by file name extension */ static const int SORT_EXT = 8; /* sort by file name extension */
#define SORT_DIR 9 /* sort by file or directory */ static const int SORT_DIR = 9; /* sort by file or directory */
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
/* which of the three times will be used */ /* which of the three times will be used */
#define TIME_MOD 0 static const int TIME_MOD = 0;
#define TIME_CHANGE 1 static const int TIME_CHANGE = 1;
#define TIME_ACCESS 2 static const int TIME_ACCESS = 2;
#endif #endif
#define LIST_SHORT (LIST_FILENAME) #define LIST_SHORT (LIST_FILENAME)
@ -125,9 +127,9 @@
LIST_SYMLINK) LIST_SYMLINK)
#define LIST_ILONG (LIST_INO | LIST_LONG) #define LIST_ILONG (LIST_INO | LIST_LONG)
#define SPLIT_DIR 0 static const int SPLIT_DIR = 0;
#define SPLIT_FILE 1 static const int SPLIT_FILE = 1;
#define SPLIT_SUBDIR 2 static const int SPLIT_SUBDIR = 2;
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
@ -150,15 +152,15 @@ struct dnode **list_dir(char *);
struct dnode **dnalloc(int); struct dnode **dnalloc(int);
int list_single(struct dnode *); int list_single(struct dnode *);
static unsigned int disp_opts= DISP_NORMAL; static unsigned int disp_opts;
static unsigned int style_fmt= STYLE_AUTO ; static unsigned int style_fmt;
static unsigned int list_fmt= LIST_SHORT ; static unsigned int list_fmt;
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
static unsigned int sort_opts= SORT_FORWARD; static unsigned int sort_opts;
static unsigned int sort_order= SORT_FORWARD; static unsigned int sort_order;
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
static unsigned int time_fmt= TIME_MOD; static unsigned int time_fmt;
#endif #endif
#ifdef BB_FEATURE_LS_FOLLOWLINKS #ifdef BB_FEATURE_LS_FOLLOWLINKS
static unsigned int follow_links=FALSE; static unsigned int follow_links=FALSE;
@ -166,12 +168,9 @@ static unsigned int follow_links=FALSE;
static unsigned short column = 0; static unsigned short column = 0;
#ifdef BB_FEATURE_AUTOWIDTH #ifdef BB_FEATURE_AUTOWIDTH
static unsigned short terminal_width = TERMINAL_WIDTH; static unsigned short terminal_width;
static unsigned short column_width = COLUMN_WIDTH; static unsigned short column_width;
static unsigned short tabstops = 8; static unsigned short tabstops;
#else
#define terminal_width TERMINAL_WIDTH
#define column_width COLUMN_WIDTH
#endif #endif
static int status = EXIT_SUCCESS; static int status = EXIT_SUCCESS;
@ -710,9 +709,15 @@ extern int ls_main(int argc, char **argv)
list_fmt= LIST_SHORT; list_fmt= LIST_SHORT;
#ifdef BB_FEATURE_LS_SORTFILES #ifdef BB_FEATURE_LS_SORTFILES
sort_opts= SORT_NAME; sort_opts= SORT_NAME;
sort_order= SORT_FORWARD;
#endif #endif
#ifdef BB_FEATURE_LS_TIMESTAMPS #ifdef BB_FEATURE_LS_TIMESTAMPS
time_fmt= TIME_MOD; time_fmt= TIME_MOD;
#endif
#ifdef BB_FEATURE_AUTOWIDTH
terminal_width = TERMINAL_WIDTH;
column_width = COLUMN_WIDTH;
tabstops = 8;
#endif #endif
nfiles=0; nfiles=0;

22
lsmod.c
View File

@ -59,19 +59,19 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
size_t *ret); size_t *ret);
/* Values for query_module's which. */ /* Values for query_module's which. */
#define QM_MODULES 1 static const int QM_MODULES = 1;
#define QM_DEPS 2 static const int QM_DEPS = 2;
#define QM_REFS 3 static const int QM_REFS = 3;
#define QM_SYMBOLS 4 static const int QM_SYMBOLS = 4;
#define QM_INFO 5 static const int QM_INFO = 5;
/* Bits of module.flags. */ /* Bits of module.flags. */
#define NEW_MOD_RUNNING 1 static const int NEW_MOD_RUNNING = 1;
#define NEW_MOD_DELETED 2 static const int NEW_MOD_DELETED = 2;
#define NEW_MOD_AUTOCLEAN 4 static const int NEW_MOD_AUTOCLEAN = 4;
#define NEW_MOD_VISITED 8 static const int NEW_MOD_VISITED = 8;
#define NEW_MOD_USED_ONCE 16 static const int NEW_MOD_USED_ONCE = 16;
#define NEW_MOD_INITIALIZING 64 static const int NEW_MOD_INITIALIZING = 64;
extern int lsmod_main(int argc, char **argv) extern int lsmod_main(int argc, char **argv)

View File

@ -91,7 +91,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _MD5_H #ifndef _MD5_H
#define _MD5_H 1 static const int _MD5_H = 1;
#include <stdio.h> #include <stdio.h>
@ -251,7 +251,7 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
int md5_stream(FILE *stream, void *resblock) int md5_stream(FILE *stream, void *resblock)
{ {
/* Important: BLOCKSIZE must be a multiple of 64. */ /* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096 static const int BLOCKSIZE = 4096;
struct md5_ctx ctx; struct md5_ctx ctx;
char buffer[BLOCKSIZE + 72]; char buffer[BLOCKSIZE + 72];
size_t sum; size_t sum;
@ -529,7 +529,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
/* The minimum length of a valid digest line in a file produced /* The minimum length of a valid digest line in a file produced
by `md5sum FILE' and read by `md5sum -c'. This length does by `md5sum FILE' and read by `md5sum -c'. This length does
not include any newline character at the end of a line. */ not include any newline character at the end of a line. */
#define MIN_DIGEST_LINE_LENGTH 35 /* 32 - message digest length static const int MIN_DIGEST_LINE_LENGTH = 35; /* 32 - message digest length
2 - blank and binary indicator 2 - blank and binary indicator
1 - minimum filename length */ 1 - minimum filename length */

View File

@ -48,7 +48,7 @@
#ifndef _IO #ifndef _IO
/* pre-1.3.45 */ /* pre-1.3.45 */
#define BLKGETSIZE 0x1260 static const int BLKGETSIZE = 0x1260;
#else #else
/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
#define BLKGETSIZE _IO(0x12,96) #define BLKGETSIZE _IO(0x12,96)

View File

@ -76,9 +76,9 @@
#ifndef MODUTILS_MODULE_H #ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1 static const int MODUTILS_MODULE_H = 1;
#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels. /* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish We do not use the kernel headers directly because we do not wish
@ -135,7 +135,7 @@ struct old_module
}; };
/* Sent to init_module(2) or'ed into the code size parameter. */ /* Sent to init_module(2) or'ed into the code size parameter. */
#define OLD_MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ static const int OLD_MOD_AUTOCLEAN = 0x40000000; /* big enough, but no sign problems... */
int get_kernel_syms(struct old_kernel_sym *); int get_kernel_syms(struct old_kernel_sym *);
int old_sys_init_module(const char *name, char *code, unsigned codesize, int 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,
#undef tgt_sizeof_char_p #undef tgt_sizeof_char_p
#undef tgt_sizeof_void_p #undef tgt_sizeof_void_p
#undef tgt_long #undef tgt_long
#define tgt_sizeof_long 8 static const int tgt_sizeof_long = 8;
#define tgt_sizeof_char_p 8 static const int tgt_sizeof_char_p = 8;
#define tgt_sizeof_void_p 8 static const int tgt_sizeof_void_p = 8;
#define tgt_long long long #define tgt_long long long
#endif #endif
@ -222,11 +222,11 @@ struct new_module_info
}; };
/* Bits of module.flags. */ /* Bits of module.flags. */
#define NEW_MOD_RUNNING 1 static const int NEW_MOD_RUNNING = 1;
#define NEW_MOD_DELETED 2 static const int NEW_MOD_DELETED = 2;
#define NEW_MOD_AUTOCLEAN 4 static const int NEW_MOD_AUTOCLEAN = 4;
#define NEW_MOD_VISITED 8 static const int NEW_MOD_VISITED = 8;
#define NEW_MOD_USED_ONCE 16 static const int NEW_MOD_USED_ONCE = 16;
int new_sys_init_module(const char *name, const struct new_module *); int new_sys_init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, size_t bufsize, int 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,
/* Values for query_module's which. */ /* Values for query_module's which. */
#define QM_MODULES 1 static const int QM_MODULES = 1;
#define QM_DEPS 2 static const int QM_DEPS = 2;
#define QM_REFS 3 static const int QM_REFS = 3;
#define QM_SYMBOLS 4 static const int QM_SYMBOLS = 4;
#define QM_INFO 5 static const int QM_INFO = 5;
/*======================================================================*/ /*======================================================================*/
/* The system calls unchanged between 2.0 and 2.1. */ /* The system calls unchanged between 2.0 and 2.1. */
@ -282,9 +282,9 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H #ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1 static const int MODUTILS_OBJ_H = 1;
#ident "$Id: insmod.c,v 1.35 2001/01/04 02:00:17 kraai Exp $" #ident "$Id: insmod.c,v 1.36 2001/01/23 22:30:04 markw Exp $"
/* The relocatable object is manipulated using elfin types. */ /* The relocatable object is manipulated using elfin types. */
@ -517,7 +517,7 @@ int arch_init_module (struct obj_file *f, struct new_module *);
#define _PATH_MODULES "/lib/modules" #define _PATH_MODULES "/lib/modules"
#define STRVERSIONLEN 32 static const int STRVERSIONLEN = 32;
#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL) #if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined" #error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"

View File

@ -59,19 +59,19 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
size_t *ret); size_t *ret);
/* Values for query_module's which. */ /* Values for query_module's which. */
#define QM_MODULES 1 static const int QM_MODULES = 1;
#define QM_DEPS 2 static const int QM_DEPS = 2;
#define QM_REFS 3 static const int QM_REFS = 3;
#define QM_SYMBOLS 4 static const int QM_SYMBOLS = 4;
#define QM_INFO 5 static const int QM_INFO = 5;
/* Bits of module.flags. */ /* Bits of module.flags. */
#define NEW_MOD_RUNNING 1 static const int NEW_MOD_RUNNING = 1;
#define NEW_MOD_DELETED 2 static const int NEW_MOD_DELETED = 2;
#define NEW_MOD_AUTOCLEAN 4 static const int NEW_MOD_AUTOCLEAN = 4;
#define NEW_MOD_VISITED 8 static const int NEW_MOD_VISITED = 8;
#define NEW_MOD_USED_ONCE 16 static const int NEW_MOD_USED_ONCE = 16;
#define NEW_MOD_INITIALIZING 64 static const int NEW_MOD_INITIALIZING = 64;
extern int lsmod_main(int argc, char **argv) extern int lsmod_main(int argc, char **argv)

30
mount.c
View File

@ -55,21 +55,21 @@
#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ #include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
#endif #endif
enum {
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
#define MS_RDONLY 1 /* Mount read-only */ MS_RDONLY = 1, /* Mount read-only */
#define MS_NOSUID 2 /* Ignore suid and sgid bits */ MS_NOSUID = 2, /* Ignore suid and sgid bits */
#define MS_NODEV 4 /* Disallow access to device special files */ MS_NODEV = 4, /* Disallow access to device special files */
#define MS_NOEXEC 8 /* Disallow program execution */ MS_NOEXEC = 8, /* Disallow program execution */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ MS_SYNCHRONOUS = 16, /* Writes are synced at once */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ MS_REMOUNT = 32, /* Alter flags of a mounted FS */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
#define S_APPEND 256 /* Append-only file */ S_APPEND = 256, /* Append-only file */
#define S_IMMUTABLE 512 /* Immutable file */ S_IMMUTABLE = 512, /* Immutable file */
#define MS_NOATIME 1024 /* Do not update access times. */ MS_NOATIME = 1024, /* Do not update access times. */
#define MS_NODIRATIME 2048 /* Do not update directory access times */ MS_NODIRATIME = 2048, /* Do not update directory access times */
};
#if defined BB_FEATURE_MOUNT_LOOP #if defined BB_FEATURE_MOUNT_LOOP

View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $ * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $
* Mini ping implementation for busybox * Mini ping implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -58,7 +58,7 @@
#if ! defined __GLIBC__ && ! defined __UCLIBC__ #if ! defined __GLIBC__ && ! defined __UCLIBC__
typedef unsigned int socklen_t; typedef unsigned int socklen_t;
#define ICMP_MINLEN 8 /* abs minimum */ static const int ICMP_MINLEN = 8; /* abs minimum */
struct icmp_ra_addr struct icmp_ra_addr
{ {
@ -134,13 +134,13 @@ struct icmp
}; };
#endif #endif
#define DEFDATALEN 56 static const int DEFDATALEN = 56;
#define MAXIPLEN 60 static const int MAXIPLEN = 60;
#define MAXICMPLEN 76 static const int MAXICMPLEN = 76;
#define MAXPACKET 65468 static const int MAXPACKET = 65468;
#define MAX_DUP_CHK (8 * 128) #define MAX_DUP_CHK (8 * 128)
#define MAXWAIT 10 static const int MAXWAIT = 10;
#define PINGINTERVAL 1 /* second */ static const int PINGINTERVAL = 1; /* second */
#define O_QUIET (1 << 0) #define O_QUIET (1 << 0)
@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv)
static char *hostname = NULL; static char *hostname = NULL;
static struct sockaddr_in pingaddr; static struct sockaddr_in pingaddr;
static int pingsock = -1; static int pingsock = -1;
static int datalen = DEFDATALEN; static int datalen; /* intentionally uninitialized to work around gcc bug */
static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0;
static int myid = 0, options = 0; static int myid = 0, options = 0;
@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv)
{ {
char *thisarg; char *thisarg;
datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
argc--; argc--;
argv++; argv++;
options = 0; options = 0;

View File

@ -50,7 +50,7 @@
#include <netdb.h> #include <netdb.h>
#if 0 #if 0
#define DOTRACE 1 static const int DOTRACE = 1;
#endif #endif
#ifdef DOTRACE #ifdef DOTRACE
@ -67,21 +67,23 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define DATABUFSIZE 128 static const int DATABUFSIZE = 128;
#define IACBUFSIZE 128 static const int IACBUFSIZE = 128;
#define CHM_TRY 0 static const int CHM_TRY = 0;
#define CHM_ON 1 static const int CHM_ON = 1;
#define CHM_OFF 2 static const int CHM_OFF = 2;
#define UF_ECHO 0x01 static const int UF_ECHO = 0x01;
#define UF_SGA 0x02 static const int UF_SGA = 0x02;
#define TS_0 1 enum {
#define TS_IAC 2 TS_0 = 1,
#define TS_OPT 3 TS_IAC = 2,
#define TS_SUB1 4 TS_OPT = 3,
#define TS_SUB2 5 TS_SUB1 = 4,
TS_SUB2 = 5,
};
#define WriteCS(fd, str) write(fd, str, sizeof str -1) #define WriteCS(fd, str) write(fd, str, sizeof str -1)

View File

@ -49,7 +49,7 @@ static char *curfile; /* Name of current file being transferred. */
static struct timeval start; /* Time a transfer started. */ static struct timeval start; /* Time a transfer started. */
volatile unsigned long statbytes; /* Number of bytes transferred so far. */ volatile unsigned long statbytes; /* Number of bytes transferred so far. */
/* For progressmeter() -- number of seconds before xfer considered "stalled" */ /* For progressmeter() -- number of seconds before xfer considered "stalled" */
#define STALLTIME 5 static const int STALLTIME = 5;
#endif #endif
int wget_main(int argc, char **argv) int wget_main(int argc, char **argv)
@ -515,7 +515,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: wget.c,v 1.17 2001/01/22 22:48:42 andersen Exp $ * $Id: wget.c,v 1.18 2001/01/23 22:30:04 markw Exp $
*/ */

View File

@ -54,10 +54,10 @@
#include <linux/nfs.h> /* For the kernels nfs stuff */ #include <linux/nfs.h> /* For the kernels nfs stuff */
#ifndef NFS_FHSIZE #ifndef NFS_FHSIZE
#define NFS_FHSIZE 32 static const int NFS_FHSIZE = 32;
#endif #endif
#ifndef NFS_PORT #ifndef NFS_PORT
#define NFS_PORT 2049 static const int NFS_PORT = 2049;
#endif #endif
/* Disable the nls stuff */ /* Disable the nls stuff */
@ -68,19 +68,19 @@
# define _(Text) (Text) # define _(Text) (Text)
# define N_(Text) (Text) # define N_(Text) (Text)
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
#define MS_RDONLY 1 /* Mount read-only */ static const int MS_RDONLY = 1; /* Mount read-only */
#define MS_NOSUID 2 /* Ignore suid and sgid bits */ static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */
#define MS_NODEV 4 /* Disallow access to device special files */ static const int MS_NODEV = 4; /* Disallow access to device special files */
#define MS_NOEXEC 8 /* Disallow program execution */ static const int MS_NOEXEC = 8; /* Disallow program execution */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */
#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */
#define S_APPEND 256 /* Append-only file */ static const int S_APPEND = 256; /* Append-only file */
#define S_IMMUTABLE 512 /* Immutable file */ static const int S_IMMUTABLE = 512; /* Immutable file */
#define MS_NOATIME 1024 /* Do not update access times. */ static const int MS_NOATIME = 1024; /* Do not update access times. */
#define MS_NODIRATIME 2048 /* Do not update directory access times */ static const int MS_NODIRATIME = 2048; /* Do not update directory access times */
/* /*
@ -93,7 +93,7 @@
* so it is easiest to ignore the kernel altogether (at compile time). * so it is easiest to ignore the kernel altogether (at compile time).
*/ */
#define NFS_MOUNT_VERSION 4 static const int NFS_MOUNT_VERSION = 4;
struct nfs2_fh { struct nfs2_fh {
char data[32]; char data[32];
@ -125,16 +125,16 @@ struct nfs_mount_data {
/* bits in the flags field */ /* bits in the flags field */
#define NFS_MOUNT_SOFT 0x0001 /* 1 */ static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */
#define NFS_MOUNT_INTR 0x0002 /* 1 */ static const int NFS_MOUNT_INTR = 0x0002; /* 1 */
#define NFS_MOUNT_SECURE 0x0004 /* 1 */ static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */
#define NFS_MOUNT_POSIX 0x0008 /* 1 */ static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */
#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */
#define NFS_MOUNT_NOAC 0x0020 /* 1 */ static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */
#define NFS_MOUNT_TCP 0x0040 /* 2 */ static const int NFS_MOUNT_TCP = 0x0040; /* 2 */
#define NFS_MOUNT_VER3 0x0080 /* 3 */ static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */
#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */
#define NFS_MOUNT_NONLM 0x0200 /* 3 */ static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */
#define UTIL_LINUX_VERSION "2.10m" #define UTIL_LINUX_VERSION "2.10m"
@ -160,14 +160,14 @@ static char *nfs_strerror(int stat);
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
#define EX_FAIL 32 /* mount failure */ static const int EX_FAIL = 32; /* mount failure */
#define EX_BG 256 /* retry in background (internal only) */ static const int EX_BG = 256; /* retry in background (internal only) */
/* /*
* nfs_mount_version according to the sources seen at compile time. * nfs_mount_version according to the sources seen at compile time.
*/ */
int nfs_mount_version = NFS_MOUNT_VERSION; static int nfs_mount_version;
/* /*
* Unfortunately, the kernel prints annoying console messages * Unfortunately, the kernel prints annoying console messages
@ -187,8 +187,9 @@ find_kernel_nfs_mount_version(void) {
if (kernel_version) if (kernel_version)
return; return;
kernel_version = get_kernel_revision(); nfs_mount_version = NFS_MOUNT_VERSION; /* default */
kernel_version = get_kernel_revision();
if (kernel_version) { if (kernel_version) {
if (kernel_version < MAKE_VERSION(2,1,32)) if (kernel_version < MAKE_VERSION(2,1,32))
nfs_mount_version = 1; nfs_mount_version = 1;

20
ping.c
View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: ping.c,v 1.31 2001/01/22 22:48:42 andersen Exp $ * $Id: ping.c,v 1.32 2001/01/23 22:30:04 markw Exp $
* Mini ping implementation for busybox * Mini ping implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -58,7 +58,7 @@
#if ! defined __GLIBC__ && ! defined __UCLIBC__ #if ! defined __GLIBC__ && ! defined __UCLIBC__
typedef unsigned int socklen_t; typedef unsigned int socklen_t;
#define ICMP_MINLEN 8 /* abs minimum */ static const int ICMP_MINLEN = 8; /* abs minimum */
struct icmp_ra_addr struct icmp_ra_addr
{ {
@ -134,13 +134,13 @@ struct icmp
}; };
#endif #endif
#define DEFDATALEN 56 static const int DEFDATALEN = 56;
#define MAXIPLEN 60 static const int MAXIPLEN = 60;
#define MAXICMPLEN 76 static const int MAXICMPLEN = 76;
#define MAXPACKET 65468 static const int MAXPACKET = 65468;
#define MAX_DUP_CHK (8 * 128) #define MAX_DUP_CHK (8 * 128)
#define MAXWAIT 10 static const int MAXWAIT = 10;
#define PINGINTERVAL 1 /* second */ static const int PINGINTERVAL = 1; /* second */
#define O_QUIET (1 << 0) #define O_QUIET (1 << 0)
@ -262,7 +262,7 @@ extern int ping_main(int argc, char **argv)
static char *hostname = NULL; static char *hostname = NULL;
static struct sockaddr_in pingaddr; static struct sockaddr_in pingaddr;
static int pingsock = -1; static int pingsock = -1;
static int datalen = DEFDATALEN; static int datalen; /* intentionally uninitialized to work around gcc bug */
static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0; static long ntransmitted = 0, nreceived = 0, nrepeats = 0, pingcount = 0;
static int myid = 0, options = 0; static int myid = 0, options = 0;
@ -508,6 +508,8 @@ extern int ping_main(int argc, char **argv)
{ {
char *thisarg; char *thisarg;
datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
argc--; argc--;
argv++; argv++;
options = 0; options = 0;

View File

@ -59,7 +59,7 @@
#ifndef S_IFMT #ifndef S_IFMT
# define S_IFMT 0170000 static const int S_IFMT = 0170000;
#endif #endif
#if !defined(S_ISBLK) && defined(S_IFBLK) #if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)

View File

@ -30,8 +30,8 @@
#include <ctype.h> #include <ctype.h>
#include <unistd.h> #include <unistd.h>
#define KILL 0 static const int KILL = 0;
#define KILLALL 1 static const int KILLALL = 1;
struct signal_name { struct signal_name {
const char *name; const char *name;

View File

@ -40,7 +40,7 @@
#define bb_need_help #define bb_need_help
#include "messages.c" #include "messages.c"
#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */ static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */

View File

@ -33,7 +33,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#define FSHIFT 16 /* nr of bits of precision */ static const int FSHIFT = 16; /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ #define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
#define LOAD_INT(x) ((x) >> FSHIFT) #define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)

2
ps.c
View File

@ -40,7 +40,7 @@
#define bb_need_help #define bb_need_help
#include "messages.c" #include "messages.c"
#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */ static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */

View File

@ -33,7 +33,7 @@
#include <getopt.h> #include <getopt.h>
#define RFC_868_BIAS 2208988800UL static const int RFC_868_BIAS = 2208988800UL;
int setdate= 0; int setdate= 0;
int printdate= 0; int printdate= 0;

View File

@ -19,7 +19,7 @@
/* /*
* Some general definitions * Some general definitions
*/ */
#define BUFSIZE 512
#define RPM_MAGIC "\355\253\356\333" #define RPM_MAGIC "\355\253\356\333"
#define GZ_MAGIC_1 '\037' #define GZ_MAGIC_1 '\037'
#define GZ_MAGIC_2 '\213' #define GZ_MAGIC_2 '\213'
@ -27,14 +27,13 @@
/* /*
* Global variables * Global variables
*/ */
static char buffer[BUFSIZE];
static char *progname; static char *progname;
static int infile, outfile; static int infile, outfile;
/* /*
* Read a specified number of bytes from input file * Read a specified number of bytes from input file
*/ */
static void myread(int num) static void myread(int num, char *buffer)
{ {
int err; int err;
@ -52,6 +51,7 @@ static void myread(int num)
int rpmunpack_main(int argc, char **argv) int rpmunpack_main(int argc, char **argv)
{ {
int len, status = 0; int len, status = 0;
char buffer[BUFSIZ];
/* Get our own program name */ /* Get our own program name */
if ((progname = strrchr(argv[0], '/')) == NULL) if ((progname = strrchr(argv[0], '/')) == NULL)
@ -71,13 +71,13 @@ int rpmunpack_main(int argc, char **argv)
perror_msg_and_die("%s", argv[1]); perror_msg_and_die("%s", argv[1]);
/* Read magic ID and output filename */ /* Read magic ID and output filename */
myread(4); myread(4, buffer);
if (strncmp(buffer, RPM_MAGIC, 4)) { if (strncmp(buffer, RPM_MAGIC, 4)) {
fprintf(stderr, "Input file is not in RPM format!\n"); fprintf(stderr, "Input file is not in RPM format!\n");
exit(1); exit(1);
} }
myread(6); /* Skip flags */ myread(6, buffer); /* Skip flags */
myread(64); myread(64, buffer);
buffer[64] = '\0'; buffer[64] = '\0';
/* Open output file */ /* Open output file */
@ -97,9 +97,9 @@ int rpmunpack_main(int argc, char **argv)
* never appears before offset 0x200, so we skip these first couple of * never appears before offset 0x200, so we skip these first couple of
* bytes to make the signature scan a little more reliable. * bytes to make the signature scan a little more reliable.
*/ */
myread(0x200 - 74); myread(0x200 - 74, buffer);
while (status < 2) { while (status < 2) {
myread(1); myread(1, buffer);
if (status == 0 && buffer[0] == GZ_MAGIC_1) if (status == 0 && buffer[0] == GZ_MAGIC_1)
status++; status++;
else if (status == 1 && buffer[0] == GZ_MAGIC_2) else if (status == 1 && buffer[0] == GZ_MAGIC_2)
@ -113,7 +113,7 @@ int rpmunpack_main(int argc, char **argv)
perror_msg_and_die("write"); perror_msg_and_die("write");
/* Now simply copy the GZIP archive into the output file */ /* Now simply copy the GZIP archive into the output file */
while ((len = read(infile, buffer, BUFSIZE)) > 0) { while ((len = read(infile, buffer, BUFSIZ)) > 0) {
if (write(outfile, buffer, len) < 0) if (write(outfile, buffer, len) < 0)
perror_msg_and_die("write"); perror_msg_and_die("write");
} }

View File

@ -33,7 +33,7 @@
struct kbkeycode { struct kbkeycode {
unsigned int scancode, keycode; unsigned int scancode, keycode;
}; };
#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
extern int extern int
setkeycodes_main(int argc, char** argv) setkeycodes_main(int argc, char** argv)

4
sh.c
View File

@ -64,8 +64,8 @@
#include <getopt.h> #include <getopt.h>
#include "cmdedit.h" #include "cmdedit.h"
#define MAX_LINE 256 /* size of input buffer for cwd data */ static const int MAX_LINE = 256; /* size of input buffer for cwd data */
#define MAX_READ 128 /* size of input buffer for `read' builtin */ static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" #define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
extern size_t NUM_APPLETS; extern size_t NUM_APPLETS;

View File

@ -44,10 +44,13 @@
#include <signal.h> #include <signal.h>
#define MAX_HISTORY 15 /* Maximum length of the linked list for the command line history */ static const int MAX_HISTORY = 15; /* Maximum length of the linked list for the command line history */
enum {
ESC = 27,
DEL = 127,
};
#define ESC 27
#define DEL 127
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0) #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
#define whitespace(c) (((c) == ' ') || ((c) == '\t')) #define whitespace(c) (((c) == ' ') || ((c) == '\t'))

View File

@ -64,8 +64,8 @@
#include <getopt.h> #include <getopt.h>
#include "cmdedit.h" #include "cmdedit.h"
#define MAX_LINE 256 /* size of input buffer for cwd data */ static const int MAX_LINE = 256; /* size of input buffer for cwd data */
#define MAX_READ 128 /* size of input buffer for `read' builtin */ static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" #define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
extern size_t NUM_APPLETS; extern size_t NUM_APPLETS;

View File

@ -35,8 +35,8 @@ _syscall1(int, swapoff, const char *, path);
static int whichApp; static int whichApp;
#define SWAPON_APP 1 static const int SWAPON_APP = 1;
#define SWAPOFF_APP 2 static const int SWAPOFF_APP = 2;
static void swap_enable_disable(char *device) static void swap_enable_disable(char *device)

View File

@ -165,7 +165,7 @@ static void logMessage (int pri, char *msg)
#ifdef BB_FEATURE_REMOTE_LOG #ifdef BB_FEATURE_REMOTE_LOG
/* send message to remote logger */ /* send message to remote logger */
if ( -1 != remotefd){ if ( -1 != remotefd){
#define IOV_COUNT 2 static const int IOV_COUNT = 2;
struct iovec iov[IOV_COUNT]; struct iovec iov[IOV_COUNT];
struct iovec *v = iov; struct iovec *v = iov;
@ -206,7 +206,7 @@ static void domark(int sig)
} }
} }
#define BUFSIZE 1023 static const int BUFSIZE = 1023;
static int serveConnection (int conn) static int serveConnection (int conn)
{ {
char buf[ BUFSIZE + 1 ]; char buf[ BUFSIZE + 1 ];

View File

@ -165,7 +165,7 @@ static void logMessage (int pri, char *msg)
#ifdef BB_FEATURE_REMOTE_LOG #ifdef BB_FEATURE_REMOTE_LOG
/* send message to remote logger */ /* send message to remote logger */
if ( -1 != remotefd){ if ( -1 != remotefd){
#define IOV_COUNT 2 static const int IOV_COUNT = 2;
struct iovec iov[IOV_COUNT]; struct iovec iov[IOV_COUNT];
struct iovec *v = iov; struct iovec *v = iov;
@ -206,7 +206,7 @@ static void domark(int sig)
} }
} }
#define BUFSIZE 1023 static const int BUFSIZE = 1023;
static int serveConnection (int conn) static int serveConnection (int conn)
{ {
char buf[ BUFSIZE + 1 ]; char buf[ BUFSIZE + 1 ];

8
tar.c
View File

@ -64,7 +64,7 @@ extern int gunzip_init();
#define MINOR(dev) ((dev)&0xff) #define MINOR(dev) ((dev)&0xff)
#endif #endif
#define NAME_SIZE 100 enum { NAME_SIZE = 100 }; /* because gcc won't let me use 'static const int' */
/* POSIX tar Header Block, from POSIX 1003.1-1990 */ /* POSIX tar Header Block, from POSIX 1003.1-1990 */
struct TarHeader struct TarHeader
@ -94,9 +94,9 @@ typedef struct TarHeader TarHeader;
/* A few useful constants */ /* A few useful constants */
#define TAR_MAGIC "ustar" /* ustar and a null */ #define TAR_MAGIC "ustar" /* ustar and a null */
#define TAR_VERSION " " /* Be compatable with GNU tar format */ #define TAR_VERSION " " /* Be compatable with GNU tar format */
#define TAR_MAGIC_LEN 6 static const int TAR_MAGIC_LEN = 6;
#define TAR_VERSION_LEN 2 static const int TAR_VERSION_LEN = 2;
#define TAR_BLOCK_SIZE 512 static const int TAR_BLOCK_SIZE = 512;
/* A nice enum with all the possible tar file content types */ /* A nice enum with all the possible tar file content types */
enum TarFileType enum TarFileType

View File

@ -50,7 +50,7 @@
#include <netdb.h> #include <netdb.h>
#if 0 #if 0
#define DOTRACE 1 static const int DOTRACE = 1;
#endif #endif
#ifdef DOTRACE #ifdef DOTRACE
@ -67,21 +67,23 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define DATABUFSIZE 128 static const int DATABUFSIZE = 128;
#define IACBUFSIZE 128 static const int IACBUFSIZE = 128;
#define CHM_TRY 0 static const int CHM_TRY = 0;
#define CHM_ON 1 static const int CHM_ON = 1;
#define CHM_OFF 2 static const int CHM_OFF = 2;
#define UF_ECHO 0x01 static const int UF_ECHO = 0x01;
#define UF_SGA 0x02 static const int UF_SGA = 0x02;
#define TS_0 1 enum {
#define TS_IAC 2 TS_0 = 1,
#define TS_OPT 3 TS_IAC = 2,
#define TS_SUB1 4 TS_OPT = 3,
#define TS_SUB2 5 TS_SUB1 = 4,
TS_SUB2 = 5,
};
#define WriteCS(fd, str) write(fd, str, sizeof str -1) #define WriteCS(fd, str) write(fd, str, sizeof str -1)

40
tr.c
View File

@ -34,14 +34,15 @@
#define bb_need_write_error #define bb_need_write_error
#include "messages.c" #include "messages.c"
#define ASCII 0377 static const int ASCII = 0377;
/* some glabals shared across this file */ /* some glabals shared across this file */
static char com_fl, del_fl, sq_fl; static char com_fl, del_fl, sq_fl;
static unsigned char output[BUFSIZ], input[BUFSIZ];
static unsigned char vector[ASCII + 1];
static char invec[ASCII + 1], outvec[ASCII + 1];
static short in_index, out_index; static short in_index, out_index;
/* these last are pointers to static buffers declared in tr_main */
static unsigned char *poutput, *pinput;
static unsigned char *pvector;
static char *pinvec, *poutvec;
static void convert() static void convert()
@ -52,22 +53,22 @@ static void convert()
for (;;) { for (;;) {
if (in_index == read_chars) { if (in_index == read_chars) {
if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) { if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
if (write(1, (char *) output, out_index) != out_index) if (write(1, (char *) poutput, out_index) != out_index)
write(2, write_error, strlen(write_error)); write(2, write_error, strlen(write_error));
exit(0); exit(0);
} }
in_index = 0; in_index = 0;
} }
c = input[in_index++]; c = pinput[in_index++];
coded = vector[c]; coded = pvector[c];
if (del_fl && invec[c]) if (del_fl && pinvec[c])
continue; continue;
if (sq_fl && last == coded && (invec[c] || outvec[coded])) if (sq_fl && last == coded && (pinvec[c] || poutvec[coded]))
continue; continue;
output[out_index++] = last = coded; poutput[out_index++] = last = coded;
if (out_index == BUFSIZ) { if (out_index == BUFSIZ) {
if (write(1, (char *) output, out_index) != out_index) { if (write(1, (char *) poutput, out_index) != out_index) {
write(2, write_error, strlen(write_error)); write(2, write_error, strlen(write_error));
exit(1); exit(1);
} }
@ -86,9 +87,9 @@ static void map(register unsigned char *string1, unsigned int string1_len,
for (j = 0, i = 0; i < string1_len; i++) { for (j = 0, i = 0; i < string1_len; i++) {
if (string2_len <= j) if (string2_len <= j)
vector[string1[i]] = last; pvector[string1[i]] = last;
else else
vector[string1[i]] = last = string2[j++]; pvector[string1[i]] = last = string2[j++];
} }
} }
@ -143,6 +144,17 @@ extern int tr_main(int argc, char **argv)
int output_length=0, input_length; int output_length=0, input_length;
int index = 1; int index = 1;
int i; int i;
/* set up big arrays here (better than making a bunch of static arrays up top) */
unsigned char output[BUFSIZ], input[BUFSIZ];
unsigned char vector[ASCII + 1];
char invec[ASCII + 1], outvec[ASCII + 1];
/* ... but make them available globally */
poutput = output;
pinput = input;
pvector = vector;
pinvec = invec;
poutvec = outvec;
if (argc > 1 && argv[index][0] == '-') { if (argc > 1 && argv[index][0] == '-') {
for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {

View File

@ -28,10 +28,10 @@
#include <errno.h> #include <errno.h>
#define MNT_FORCE 1 static const int MNT_FORCE = 1;
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */ static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS. */
#define MS_RDONLY 1 /* Mount read-only. */ static const int MS_RDONLY = 1; /* Mount read-only. */
extern int mount (__const char *__special_file, __const char *__dir, extern int mount (__const char *__special_file, __const char *__dir,
__const char *__fstype, unsigned long int __rwflag, __const char *__fstype, unsigned long int __rwflag,

12
uname.c
View File

@ -44,22 +44,22 @@ static void print_element(unsigned int mask, char *element);
/* Values that are bitwise or'd into `toprint'. */ /* Values that are bitwise or'd into `toprint'. */
/* Operating system name. */ /* Operating system name. */
#define PRINT_SYSNAME 1 static const int PRINT_SYSNAME = 1;
/* Node name on a communications network. */ /* Node name on a communications network. */
#define PRINT_NODENAME 2 static const int PRINT_NODENAME = 2;
/* Operating system release. */ /* Operating system release. */
#define PRINT_RELEASE 4 static const int PRINT_RELEASE = 4;
/* Operating system version. */ /* Operating system version. */
#define PRINT_VERSION 8 static const int PRINT_VERSION = 8;
/* Machine hardware name. */ /* Machine hardware name. */
#define PRINT_MACHINE 16 static const int PRINT_MACHINE = 16;
/* Host processor type. */ /* Host processor type. */
#define PRINT_PROCESSOR 32 static const int PRINT_PROCESSOR = 32;
/* Mask indicating which elements of the name to print. */ /* Mask indicating which elements of the name to print. */
static unsigned char toprint; static unsigned char toprint;

View File

@ -33,7 +33,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#define FSHIFT 16 /* nr of bits of precision */ static const int FSHIFT = 16; /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ #define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
#define LOAD_INT(x) ((x) >> FSHIFT) #define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)

View File

@ -36,53 +36,55 @@
#define DEFAULTFBDEV "/dev/fb0" #define DEFAULTFBDEV "/dev/fb0"
#define DEFAULTFBMODE "/etc/fb.modes" #define DEFAULTFBMODE "/etc/fb.modes"
#define OPT_CHANGE 1 static const int OPT_CHANGE = (1 << 0);
#define OPT_INFO (1 << 1) static const int OPT_INFO = (1 << 1);
#define OPT_READMODE (1 << 2) static const int OPT_READMODE = (1 << 2);
#define CMD_HELP 0 enum {
#define CMD_FB 1 CMD_HELP = 0,
#define CMD_DB 2 CMD_FB = 1,
#define CMD_GEOMETRY 3 CMD_DB = 2,
#define CMD_TIMING 4 CMD_GEOMETRY = 3,
#define CMD_ACCEL 5 CMD_TIMING = 4,
#define CMD_HSYNC 6 CMD_ACCEL = 5,
#define CMD_VSYNC 7 CMD_HSYNC = 6,
#define CMD_LACED 8 CMD_VSYNC = 7,
#define CMD_DOUBLE 9 CMD_LACED = 8,
/* #define CMD_XCOMPAT 10 */ CMD_DOUBLE = 9,
#define CMD_ALL 11 /* CMD_XCOMPAT = 10, */
#define CMD_INFO 12 CMD_ALL = 11,
#define CMD_CHANGE 13 CMD_INFO = 12,
CMD_CHANGE = 13,
#ifdef BB_FEATURE_FBSET_FANCY #ifdef BB_FEATURE_FBSET_FANCY
#define CMD_XRES 100 CMD_XRES = 100,
#define CMD_YRES 101 CMD_YRES = 101,
#define CMD_VXRES 102 CMD_VXRES = 102,
#define CMD_VYRES 103 CMD_VYRES = 103,
#define CMD_DEPTH 104 CMD_DEPTH = 104,
#define CMD_MATCH 105 CMD_MATCH = 105,
#define CMD_PIXCLOCK 106 CMD_PIXCLOCK = 106,
#define CMD_LEFT 107 CMD_LEFT = 107,
#define CMD_RIGHT 108 CMD_RIGHT = 108,
#define CMD_UPPER 109 CMD_UPPER = 109,
#define CMD_LOWER 110 CMD_LOWER = 110,
#define CMD_HSLEN 111 CMD_HSLEN = 111,
#define CMD_VSLEN 112 CMD_VSLEN = 112,
#define CMD_CSYNC 113 CMD_CSYNC = 113,
#define CMD_GSYNC 114 CMD_GSYNC = 114,
#define CMD_EXTSYNC 115 CMD_EXTSYNC = 115,
#define CMD_BCAST 116 CMD_BCAST = 116,
#define CMD_RGBA 117 CMD_RGBA = 117,
#define CMD_STEP 118 CMD_STEP = 118,
#define CMD_MOVE 119 CMD_MOVE = 119,
#endif #endif
};
static unsigned int g_options = 0; static unsigned int g_options = 0;
/* Stuff stolen from the kernel's fb.h */ /* Stuff stolen from the kernel's fb.h */
#define FBIOGET_VSCREENINFO 0x4600 static const int FBIOGET_VSCREENINFO = 0x4600;
#define FBIOPUT_VSCREENINFO 0x4601 static const int FBIOPUT_VSCREENINFO = 0x4601;
#define __u32 unsigned int #define __u32 unsigned int
struct fb_bitfield { struct fb_bitfield {
__u32 offset; /* beginning of bitfield */ __u32 offset; /* beginning of bitfield */
@ -180,12 +182,12 @@ struct cmdoptions_t {
#ifdef BB_FEATURE_FBSET_READMODE #ifdef BB_FEATURE_FBSET_READMODE
/* taken from linux/fb.h */ /* taken from linux/fb.h */
#define FB_VMODE_INTERLACED 1 /* interlaced */ static const int FB_VMODE_INTERLACED = 1; /* interlaced */
#define FB_VMODE_DOUBLE 2 /* double scan */ static const int FB_VMODE_DOUBLE = 2; /* double scan */
#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ static const int FB_SYNC_HOR_HIGH_ACT = 1; /* horizontal sync high active */
#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ static const int FB_SYNC_VERT_HIGH_ACT = 2; /* vertical sync high active */
#define FB_SYNC_EXT 4 /* external sync */ static const int FB_SYNC_EXT = 4; /* external sync */
#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ static const int FB_SYNC_COMP_HIGH_ACT = 8; /* composite sync high active */
#endif #endif
static int readmode(struct fb_var_screeninfo *base, const char *fn, static int readmode(struct fb_var_screeninfo *base, const char *fn,
const char *mode) const char *mode)

View File

@ -104,24 +104,24 @@ typedef unsigned short u16;
typedef unsigned int u32; typedef unsigned int u32;
#define MINIX_ROOT_INO 1 static const int MINIX_ROOT_INO = 1;
#define MINIX_LINK_MAX 250 static const int MINIX_LINK_MAX = 250;
#define MINIX2_LINK_MAX 65530 static const int MINIX2_LINK_MAX = 65530;
#define MINIX_I_MAP_SLOTS 8 static const int MINIX_I_MAP_SLOTS = 8;
#define MINIX_Z_MAP_SLOTS 64 static const int MINIX_Z_MAP_SLOTS = 64;
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
#define MINIX_VALID_FS 0x0001 /* Clean fs. */ static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) #define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
#define MINIX_V1 0x0001 /* original minix fs */ static const int MINIX_V1 = 0x0001; /* original minix fs */
#define MINIX_V2 0x0002 /* minix V2 fs */ static const int MINIX_V2 = 0x0002; /* minix V2 fs */
#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version #define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
@ -185,12 +185,6 @@ struct minix_dir_entry {
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
#define MINIX_VALID_FS 0x0001 /* Clean fs. */
#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
#ifndef BLKGETSIZE #ifndef BLKGETSIZE
#define BLKGETSIZE _IO(0x12,96) /* return device size */ #define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif #endif
@ -199,7 +193,7 @@ struct minix_dir_entry {
#define volatile #define volatile
#endif #endif
#define ROOT_INO 1 static const int ROOT_INO = 1;
#define UPPER(size,n) ((size+((n)-1))/(n)) #define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode)) #define INODE_SIZE (sizeof(struct minix_inode))
@ -231,7 +225,7 @@ static struct termios termios;
static int termios_set = 0; static int termios_set = 0;
/* File-name data */ /* File-name data */
#define MAX_DEPTH 32 static const int MAX_DEPTH = 32;
static int name_depth = 0; static int name_depth = 0;
// static char name_list[MAX_DEPTH][BUFSIZ + 1]; // static char name_list[MAX_DEPTH][BUFSIZ + 1];
static char **name_list = NULL; static char **name_list = NULL;

View File

@ -53,9 +53,9 @@
/* NON_OPT is the code that is returned when a non-option is found in '+' /* NON_OPT is the code that is returned when a non-option is found in '+'
mode */ mode */
#define NON_OPT 1 static const int NON_OPT = 1;
/* LONG_OPT is the code that is returned when a long option is found. */ /* LONG_OPT is the code that is returned when a long option is found. */
#define LONG_OPT 2 static const int LONG_OPT = 2;
/* The shells recognized. */ /* The shells recognized. */
typedef enum {BASH,TCSH} shell_t; typedef enum {BASH,TCSH} shell_t;
@ -199,7 +199,7 @@ int generate_output(char * argv[],int argc,const char *optstr,
static struct option *long_options=NULL; static struct option *long_options=NULL;
static int long_options_length=0; /* Length of array */ static int long_options_length=0; /* Length of array */
static int long_options_nr=0; /* Nr of used elements in array */ static int long_options_nr=0; /* Nr of used elements in array */
#define LONG_OPTIONS_INCR 10 static const int LONG_OPTIONS_INCR = 10;
#define init_longopt() add_longopt(NULL,0) #define init_longopt() add_longopt(NULL,0)
/* Register a long option. The contents of name is copied. */ /* Register a long option. The contents of name is copied. */

View File

@ -48,7 +48,7 @@
#ifndef _IO #ifndef _IO
/* pre-1.3.45 */ /* pre-1.3.45 */
#define BLKGETSIZE 0x1260 static const int BLKGETSIZE = 0x1260;
#else #else
/* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */ /* same on i386, m68k, arm; different on alpha, mips, sparc, ppc */
#define BLKGETSIZE _IO(0x12,96) #define BLKGETSIZE _IO(0x12,96)

View File

@ -55,21 +55,21 @@
#include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */ #include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
#endif #endif
enum {
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
#define MS_RDONLY 1 /* Mount read-only */ MS_RDONLY = 1, /* Mount read-only */
#define MS_NOSUID 2 /* Ignore suid and sgid bits */ MS_NOSUID = 2, /* Ignore suid and sgid bits */
#define MS_NODEV 4 /* Disallow access to device special files */ MS_NODEV = 4, /* Disallow access to device special files */
#define MS_NOEXEC 8 /* Disallow program execution */ MS_NOEXEC = 8, /* Disallow program execution */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ MS_SYNCHRONOUS = 16, /* Writes are synced at once */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ MS_REMOUNT = 32, /* Alter flags of a mounted FS */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ MS_MANDLOCK = 64, /* Allow mandatory locks on an FS */
#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ S_QUOTA = 128, /* Quota initialized for file/directory/symlink */
#define S_APPEND 256 /* Append-only file */ S_APPEND = 256, /* Append-only file */
#define S_IMMUTABLE 512 /* Immutable file */ S_IMMUTABLE = 512, /* Immutable file */
#define MS_NOATIME 1024 /* Do not update access times. */ MS_NOATIME = 1024, /* Do not update access times. */
#define MS_NODIRATIME 2048 /* Do not update directory access times */ MS_NODIRATIME = 2048, /* Do not update directory access times */
};
#if defined BB_FEATURE_MOUNT_LOOP #if defined BB_FEATURE_MOUNT_LOOP

View File

@ -54,10 +54,10 @@
#include <linux/nfs.h> /* For the kernels nfs stuff */ #include <linux/nfs.h> /* For the kernels nfs stuff */
#ifndef NFS_FHSIZE #ifndef NFS_FHSIZE
#define NFS_FHSIZE 32 static const int NFS_FHSIZE = 32;
#endif #endif
#ifndef NFS_PORT #ifndef NFS_PORT
#define NFS_PORT 2049 static const int NFS_PORT = 2049;
#endif #endif
/* Disable the nls stuff */ /* Disable the nls stuff */
@ -68,19 +68,19 @@
# define _(Text) (Text) # define _(Text) (Text)
# define N_(Text) (Text) # define N_(Text) (Text)
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
#define MS_RDONLY 1 /* Mount read-only */ static const int MS_RDONLY = 1; /* Mount read-only */
#define MS_NOSUID 2 /* Ignore suid and sgid bits */ static const int MS_NOSUID = 2; /* Ignore suid and sgid bits */
#define MS_NODEV 4 /* Disallow access to device special files */ static const int MS_NODEV = 4; /* Disallow access to device special files */
#define MS_NOEXEC 8 /* Disallow program execution */ static const int MS_NOEXEC = 8; /* Disallow program execution */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ static const int MS_SYNCHRONOUS = 16; /* Writes are synced at once */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ static const int MS_MANDLOCK = 64; /* Allow mandatory locks on an FS */
#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */ static const int S_QUOTA = 128; /* Quota initialized for file/directory/symlink */
#define S_APPEND 256 /* Append-only file */ static const int S_APPEND = 256; /* Append-only file */
#define S_IMMUTABLE 512 /* Immutable file */ static const int S_IMMUTABLE = 512; /* Immutable file */
#define MS_NOATIME 1024 /* Do not update access times. */ static const int MS_NOATIME = 1024; /* Do not update access times. */
#define MS_NODIRATIME 2048 /* Do not update directory access times */ static const int MS_NODIRATIME = 2048; /* Do not update directory access times */
/* /*
@ -93,7 +93,7 @@
* so it is easiest to ignore the kernel altogether (at compile time). * so it is easiest to ignore the kernel altogether (at compile time).
*/ */
#define NFS_MOUNT_VERSION 4 static const int NFS_MOUNT_VERSION = 4;
struct nfs2_fh { struct nfs2_fh {
char data[32]; char data[32];
@ -125,16 +125,16 @@ struct nfs_mount_data {
/* bits in the flags field */ /* bits in the flags field */
#define NFS_MOUNT_SOFT 0x0001 /* 1 */ static const int NFS_MOUNT_SOFT = 0x0001; /* 1 */
#define NFS_MOUNT_INTR 0x0002 /* 1 */ static const int NFS_MOUNT_INTR = 0x0002; /* 1 */
#define NFS_MOUNT_SECURE 0x0004 /* 1 */ static const int NFS_MOUNT_SECURE = 0x0004; /* 1 */
#define NFS_MOUNT_POSIX 0x0008 /* 1 */ static const int NFS_MOUNT_POSIX = 0x0008; /* 1 */
#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ static const int NFS_MOUNT_NOCTO = 0x0010; /* 1 */
#define NFS_MOUNT_NOAC 0x0020 /* 1 */ static const int NFS_MOUNT_NOAC = 0x0020; /* 1 */
#define NFS_MOUNT_TCP 0x0040 /* 2 */ static const int NFS_MOUNT_TCP = 0x0040; /* 2 */
#define NFS_MOUNT_VER3 0x0080 /* 3 */ static const int NFS_MOUNT_VER3 = 0x0080; /* 3 */
#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ static const int NFS_MOUNT_KERBEROS = 0x0100; /* 3 */
#define NFS_MOUNT_NONLM 0x0200 /* 3 */ static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */
#define UTIL_LINUX_VERSION "2.10m" #define UTIL_LINUX_VERSION "2.10m"
@ -160,14 +160,14 @@ static char *nfs_strerror(int stat);
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
#define EX_FAIL 32 /* mount failure */ static const int EX_FAIL = 32; /* mount failure */
#define EX_BG 256 /* retry in background (internal only) */ static const int EX_BG = 256; /* retry in background (internal only) */
/* /*
* nfs_mount_version according to the sources seen at compile time. * nfs_mount_version according to the sources seen at compile time.
*/ */
int nfs_mount_version = NFS_MOUNT_VERSION; static int nfs_mount_version;
/* /*
* Unfortunately, the kernel prints annoying console messages * Unfortunately, the kernel prints annoying console messages
@ -187,8 +187,9 @@ find_kernel_nfs_mount_version(void) {
if (kernel_version) if (kernel_version)
return; return;
kernel_version = get_kernel_revision(); nfs_mount_version = NFS_MOUNT_VERSION; /* default */
kernel_version = get_kernel_revision();
if (kernel_version) { if (kernel_version) {
if (kernel_version < MAKE_VERSION(2,1,32)) if (kernel_version < MAKE_VERSION(2,1,32))
nfs_mount_version = 1; nfs_mount_version = 1;

View File

@ -33,7 +33,7 @@
#include <getopt.h> #include <getopt.h>
#define RFC_868_BIAS 2208988800UL static const int RFC_868_BIAS = 2208988800UL;
int setdate= 0; int setdate= 0;
int printdate= 0; int printdate= 0;

View File

@ -35,8 +35,8 @@ _syscall1(int, swapoff, const char *, path);
static int whichApp; static int whichApp;
#define SWAPON_APP 1 static const int SWAPON_APP = 1;
#define SWAPOFF_APP 2 static const int SWAPOFF_APP = 2;
static void swap_enable_disable(char *device) static void swap_enable_disable(char *device)

View File

@ -28,10 +28,10 @@
#include <errno.h> #include <errno.h>
#define MNT_FORCE 1 static const int MNT_FORCE = 1;
#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */ static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */ static const int MS_REMOUNT = 32; /* Alter flags of a mounted FS. */
#define MS_RDONLY 1 /* Mount read-only. */ static const int MS_RDONLY = 1; /* Mount read-only. */
extern int mount (__const char *__special_file, __const char *__dir, extern int mount (__const char *__special_file, __const char *__dir,
__const char *__fstype, unsigned long int __rwflag, __const char *__fstype, unsigned long int __rwflag,

View File

@ -167,7 +167,7 @@ _syscall1(int, sysinfo, struct sysinfo *, info);
#if defined BB_MOUNT || defined BB_UMOUNT #if defined BB_MOUNT || defined BB_UMOUNT
#ifndef __NR_umount2 #ifndef __NR_umount2
#define __NR_umount2 52 static const int __NR_umount2 = 52;
#endif #endif
/* Include our own version of <sys/mount.h>, since libc5 doesn't /* 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,
#if defined BB_INSMOD || defined BB_LSMOD #if defined BB_INSMOD || defined BB_LSMOD
#ifndef __NR_query_module #ifndef __NR_query_module
#define __NR_query_module 167 static const int __NR_query_module = 167;
#endif #endif
_syscall5(int, query_module, const char *, name, int, which, _syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t*, ret); void *, buf, size_t, bufsize, size_t*, ret);
@ -975,9 +975,9 @@ long my_getpwnamegid(char *name)
#if (defined BB_CHVT) || (defined BB_DEALLOCVT) || (defined BB_SETKEYCODES) #if (defined BB_CHVT) || (defined BB_DEALLOCVT) || (defined BB_SETKEYCODES)
/* From <linux/kd.h> */ /* From <linux/kd.h> */
#define KDGKBTYPE 0x4B33 /* get keyboard type */ static const int KDGKBTYPE = 0x4B33; /* get keyboard type */
#define KB_84 0x01 static const int KB_84 = 0x01;
#define KB_101 0x02 /* this is what we always answer */ static const int KB_101 = 0x02; /* this is what we always answer */
int is_a_console(int fd) int is_a_console(int fd)
{ {

4
wget.c
View File

@ -49,7 +49,7 @@ static char *curfile; /* Name of current file being transferred. */
static struct timeval start; /* Time a transfer started. */ static struct timeval start; /* Time a transfer started. */
volatile unsigned long statbytes; /* Number of bytes transferred so far. */ volatile unsigned long statbytes; /* Number of bytes transferred so far. */
/* For progressmeter() -- number of seconds before xfer considered "stalled" */ /* For progressmeter() -- number of seconds before xfer considered "stalled" */
#define STALLTIME 5 static const int STALLTIME = 5;
#endif #endif
int wget_main(int argc, char **argv) int wget_main(int argc, char **argv)
@ -515,7 +515,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: wget.c,v 1.17 2001/01/22 22:48:42 andersen Exp $ * $Id: wget.c,v 1.18 2001/01/23 22:30:04 markw Exp $
*/ */