From 3e6ff9017f5aa4ea41de2520a3f6d29fb20e0332 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 9 Mar 2001 21:24:12 +0000 Subject: A cleanup patch from Jeff Garzik to static-ify a number of namespace polluting things that really should be static. --- archival/dpkg.c | 6 +++--- archival/tar.c | 8 ++++---- coreutils/date.c | 4 ++-- coreutils/head.c | 2 +- coreutils/ls.c | 32 ++++++++++++++++---------------- coreutils/sort.c | 4 ++-- coreutils/tail.c | 4 ++-- coreutils/uuencode.c | 6 +++--- coreutils/wc.c | 4 ++-- date.c | 4 ++-- dpkg.c | 6 +++--- fbset.c | 2 +- fsck_minix.c | 4 ++-- getopt.c | 21 ++++++++++----------- head.c | 2 +- hostname.c | 4 ++-- init.c | 8 ++++---- init/init.c | 8 ++++---- kill.c | 2 +- ls.c | 32 ++++++++++++++++---------------- mkfs_minix.c | 2 +- mkswap.c | 2 +- mount.c | 2 +- networking/hostname.c | 4 ++-- networking/route.c | 4 ++-- networking/telnet.c | 2 +- networking/wget.c | 22 +++++++++++----------- nfsmount.c | 2 +- procps/kill.c | 2 +- rdate.c | 6 +++--- route.c | 4 ++-- sort.c | 4 ++-- swaponoff.c | 4 ++-- tail.c | 4 ++-- tar.c | 8 ++++---- telnet.c | 2 +- util-linux/fbset.c | 2 +- util-linux/fsck_minix.c | 4 ++-- util-linux/getopt.c | 21 ++++++++++----------- util-linux/mkfs_minix.c | 2 +- util-linux/mkswap.c | 2 +- util-linux/mount.c | 2 +- util-linux/nfsmount.c | 2 +- util-linux/rdate.c | 6 +++--- util-linux/swaponoff.c | 4 ++-- uuencode.c | 6 +++--- wc.c | 4 ++-- wget.c | 22 +++++++++++----------- 48 files changed, 156 insertions(+), 158 deletions(-) diff --git a/archival/dpkg.c b/archival/dpkg.c index 0e4fd8efc..4e53652e4 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -79,9 +79,9 @@ static const char *statuswords[][10] = { "post-inst-failed", "removal-failed", 0 } }; -const int color_white = 0; -const int color_grey = 1; -const int color_black = 2; +static const int color_white = 0; +static const int color_grey = 1; +static const int color_black = 2; /* data structures */ typedef struct package_s { diff --git a/archival/tar.c b/archival/tar.c index a9363d5ad..38a8d9a04 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -150,7 +150,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, #ifdef BB_FEATURE_TAR_GZIP /* Signal handler for when child gzip process dies... */ -void child_died() +static void child_died() { fflush(stdout); fflush(stderr); @@ -186,7 +186,7 @@ extern int tar_unzip_init(int tarFd) #endif #if defined BB_FEATURE_TAR_EXCLUDE -struct option longopts[] = { +static struct option longopts[] = { { "exclude", 1, NULL, 'e' }, { NULL, 0, NULL, 0 } }; @@ -574,7 +574,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) return( FALSE); } -int exclude_file(char **excluded_files, const char *file) +static int exclude_file(char **excluded_files, const char *file) { int i; @@ -601,7 +601,7 @@ int exclude_file(char **excluded_files, const char *file) return 0; } -int extract_file(char **extract_files, const char *file) +static int extract_file(char **extract_files, const char *file) { int i; diff --git a/coreutils/date.c b/coreutils/date.c index 878331f71..4b2f66add 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -46,7 +46,7 @@ /* Default input handling to save suprising some people */ -struct tm *date_conv_time(struct tm *tm_time, const char *t_string) +static struct tm *date_conv_time(struct tm *tm_time, const char *t_string) { int nr; @@ -73,7 +73,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) /* The new stuff for LRP */ -struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) +static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) { struct tm t; diff --git a/coreutils/head.c b/coreutils/head.c index fac9ec659..0c8ef3d59 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -29,7 +29,7 @@ #include #include "busybox.h" -int head(int len, FILE *fp) +static int head(int len, FILE *fp) { int i; char *input; diff --git a/coreutils/ls.c b/coreutils/ls.c index a8d7b182f..77de93a0c 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -156,9 +156,9 @@ struct dnode { /* the basic node */ }; typedef struct dnode dnode_t; -struct dnode **list_dir(char *); -struct dnode **dnalloc(int); -int list_single(struct dnode *); +static struct dnode **list_dir(char *); +static struct dnode **dnalloc(int); +static int list_single(struct dnode *); static unsigned int disp_opts; static unsigned int style_fmt; @@ -186,7 +186,7 @@ static unsigned short column_width = COLUMN_WIDTH; static int status = EXIT_SUCCESS; #ifdef BB_FEATURE_HUMAN_READABLE -unsigned long ls_disp_hr = 0; +static unsigned long ls_disp_hr = 0; #endif static int my_stat(struct dnode *cur) @@ -256,7 +256,7 @@ static int is_subdir(struct dnode *dn) strcmp(dn->name, "..") != 0); } -int countdirs(struct dnode **dn, int nfiles) +static int countdirs(struct dnode **dn, int nfiles) { int i, dirs; @@ -268,7 +268,7 @@ int countdirs(struct dnode **dn, int nfiles) return(dirs); } -int countsubdirs(struct dnode **dn, int nfiles) +static int countsubdirs(struct dnode **dn, int nfiles) { int i, subdirs; @@ -280,7 +280,7 @@ int countsubdirs(struct dnode **dn, int nfiles) return subdirs; } -int countfiles(struct dnode **dnp) +static int countfiles(struct dnode **dnp) { int nfiles; struct dnode *cur; @@ -293,7 +293,7 @@ int countfiles(struct dnode **dnp) } /* get memory to hold an array of pointers */ -struct dnode **dnalloc(int num) +static struct dnode **dnalloc(int num) { struct dnode **p; @@ -303,7 +303,7 @@ struct dnode **dnalloc(int num) return(p); } -void dfree(struct dnode **dnp) +static void dfree(struct dnode **dnp) { struct dnode *cur, *next; @@ -319,7 +319,7 @@ void dfree(struct dnode **dnp) free(dnp); /* free the array holding the dnode pointers */ } -struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) +static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) { int dncnt, i, d; struct dnode **dnp; @@ -359,7 +359,7 @@ struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) /*----------------------------------------------------------------------*/ #ifdef BB_FEATURE_LS_SORTFILES -int sortcmp(struct dnode *d1, struct dnode *d2) +static int sortcmp(struct dnode *d1, struct dnode *d2) { int cmp, dif; @@ -396,7 +396,7 @@ int sortcmp(struct dnode *d1, struct dnode *d2) } /*----------------------------------------------------------------------*/ -void shellsort(struct dnode **dn, int size) +static void shellsort(struct dnode **dn, int size) { struct dnode *temp; int gap, i, j; @@ -420,7 +420,7 @@ void shellsort(struct dnode **dn, int size) #endif /*----------------------------------------------------------------------*/ -void showfiles(struct dnode **dn, int nfiles) +static void showfiles(struct dnode **dn, int nfiles) { int i, ncols, nrows, row, nc; #ifdef BB_FEATURE_AUTOWIDTH @@ -481,7 +481,7 @@ void showfiles(struct dnode **dn, int nfiles) } /*----------------------------------------------------------------------*/ -void showdirs(struct dnode **dn, int ndirs) +static void showdirs(struct dnode **dn, int ndirs) { int i, nfiles; struct dnode **subdnp; @@ -524,7 +524,7 @@ void showdirs(struct dnode **dn, int ndirs) } /*----------------------------------------------------------------------*/ -struct dnode **list_dir(char *path) +static struct dnode **list_dir(char *path) { struct dnode *dn, *cur, **dnp; struct dirent *entry; @@ -575,7 +575,7 @@ struct dnode **list_dir(char *path) } /*----------------------------------------------------------------------*/ -int list_single(struct dnode *dn) +static int list_single(struct dnode *dn) { int i, len; char scratch[BUFSIZ + 1]; diff --git a/coreutils/sort.c b/coreutils/sort.c index 79e629c75..9707efa51 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -26,12 +26,12 @@ #include #include "busybox.h" -int compare_ascii(const void *x, const void *y) +static int compare_ascii(const void *x, const void *y) { return strcmp(*(char **)x, *(char **)y); } -int compare_numeric(const void *x, const void *y) +static int compare_numeric(const void *x, const void *y) { return atoi(*(char **)x) - atoi(*(char **)y); } diff --git a/coreutils/tail.c b/coreutils/tail.c index a85256c80..ff77bde77 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -44,14 +44,14 @@ static char *tailbuf; static int taillen; static int newline; -void tailbuf_append(char *buf, int len) +static void tailbuf_append(char *buf, int len) { tailbuf = xrealloc(tailbuf, taillen + len); memcpy(tailbuf + taillen, buf, len); taillen += len; } -void tailbuf_trunc() +static void tailbuf_trunc() { char *s; s = memchr(tailbuf, '\n', taillen); diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 41541defb..35a533309 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -34,11 +34,11 @@ static void encode __P ((void)); /* Pointer to the translation table we currently use. */ -const char *trans_ptr; +static const char *trans_ptr; /* The two currently defined translation tables. The first is the standard uuencoding, the second is base64 encoding. */ -const char uu_std[64] = { +static const char uu_std[64] = { '`', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', @@ -49,7 +49,7 @@ const char uu_std[64] = { 'X', 'Y', 'Z', '[', '\\', ']', '^', '_' }; -const char uu_base64[64] = { +static const char uu_base64[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', diff --git a/coreutils/wc.c b/coreutils/wc.c index 5472c3070..695e7e7d4 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c @@ -29,8 +29,8 @@ static int total_lines, total_words, total_chars, max_length; static int print_lines, print_words, print_chars, print_length; -void print_counts(int lines, int words, int chars, int length, - const char *name) +static void print_counts(int lines, int words, int chars, int length, + const char *name) { char const *space = ""; diff --git a/date.c b/date.c index 878331f71..4b2f66add 100644 --- a/date.c +++ b/date.c @@ -46,7 +46,7 @@ /* Default input handling to save suprising some people */ -struct tm *date_conv_time(struct tm *tm_time, const char *t_string) +static struct tm *date_conv_time(struct tm *tm_time, const char *t_string) { int nr; @@ -73,7 +73,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) /* The new stuff for LRP */ -struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) +static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) { struct tm t; diff --git a/dpkg.c b/dpkg.c index 0e4fd8efc..4e53652e4 100644 --- a/dpkg.c +++ b/dpkg.c @@ -79,9 +79,9 @@ static const char *statuswords[][10] = { "post-inst-failed", "removal-failed", 0 } }; -const int color_white = 0; -const int color_grey = 1; -const int color_black = 2; +static const int color_white = 0; +static const int color_grey = 1; +static const int color_black = 2; /* data structures */ typedef struct package_s { diff --git a/fbset.c b/fbset.c index be1e3c3f1..80711ec9f 100644 --- a/fbset.c +++ b/fbset.c @@ -132,7 +132,7 @@ struct fb_var_screeninfo { }; -struct cmdoptions_t { +static struct cmdoptions_t { char *name; unsigned char param_count; unsigned char code; diff --git a/fsck_minix.c b/fsck_minix.c index 9a53a705e..bd0c8a61c 100644 --- a/fsck_minix.c +++ b/fsck_minix.c @@ -701,7 +701,7 @@ static void read_tables(void) } } -struct minix_inode *get_inode(unsigned int nr) +static struct minix_inode *get_inode(unsigned int nr) { struct minix_inode *inode; @@ -749,7 +749,7 @@ struct minix_inode *get_inode(unsigned int nr) } #ifdef BB_FEATURE_MINIX2 -struct minix2_inode *get_inode2(unsigned int nr) +static struct minix2_inode *get_inode2(unsigned int nr) { struct minix2_inode *inode; diff --git a/getopt.c b/getopt.c index eb28d5d07..b74dd65a1 100644 --- a/getopt.c +++ b/getopt.c @@ -62,20 +62,19 @@ typedef enum {BASH,TCSH} shell_t; /* Some global variables that tells us how to parse. */ -shell_t shell=BASH; /* The shell we generate output for. */ -int quiet_errors=0; /* 0 is not quiet. */ -int quiet_output=0; /* 0 is not quiet. */ -int quote=1; /* 1 is do quote. */ -int alternative=0; /* 0 is getopt_long, 1 is getopt_long_only */ +static shell_t shell=BASH; /* The shell we generate output for. */ +static int quiet_errors=0; /* 0 is not quiet. */ +static int quiet_output=0; /* 0 is not quiet. */ +static int quote=1; /* 1 is do quote. */ +static int alternative=0; /* 0 is getopt_long, 1 is getopt_long_only */ /* Function prototypes */ -const char *normalize(const char *arg); -int generate_output(char * argv[],int argc,const char *optstr, +static const char *normalize(const char *arg); +static int generate_output(char * argv[],int argc,const char *optstr, const struct option *longopts); -void add_long_options(char *options); -void add_longopt(const char *name,int has_arg); -void set_shell(const char *new_shell); -void set_initial_shell(void); +static void add_long_options(char *options); +static void add_longopt(const char *name,int has_arg); +static void set_shell(const char *new_shell); /* diff --git a/head.c b/head.c index fac9ec659..0c8ef3d59 100644 --- a/head.c +++ b/head.c @@ -29,7 +29,7 @@ #include #include "busybox.h" -int head(int len, FILE *fp) +static int head(int len, FILE *fp) { int i; char *input; diff --git a/hostname.c b/hostname.c index 8ea8fe107..a6e001d54 100644 --- a/hostname.c +++ b/hostname.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: hostname.c,v 1.25 2001/03/09 14:36:42 andersen Exp $ + * $Id: hostname.c,v 1.26 2001/03/09 21:24:12 andersen Exp $ * Mini hostname implementation for busybox * * Copyright (C) 1999 by Randolph Chung @@ -32,7 +32,7 @@ #include #include -void do_sethostname(char *s, int isfile) +static void do_sethostname(char *s, int isfile) { FILE *f; char buf[255]; diff --git a/init.c b/init.c index 52ee6777a..a0f15b0ff 100644 --- a/init.c +++ b/init.c @@ -174,7 +174,7 @@ struct initActionTag { initAction *nextPtr; initActionEnum action; }; -initAction *initActionList = NULL; +static initAction *initActionList = NULL; static char *secondConsole = VT_SECONDARY; @@ -255,7 +255,7 @@ static void message(int device, char *fmt, ...) } /* Set terminal settings to reasonable defaults */ -void set_term(int fd) +static void set_term(int fd) { struct termios tty; @@ -670,7 +670,7 @@ static void reboot_signal(int sig) #endif /* ! DEBUG_INIT */ -void new_initAction(initActionEnum action, char *process, char *cons) +static void new_initAction(initActionEnum action, char *process, char *cons) { initAction *newAction; @@ -725,7 +725,7 @@ static void delete_initAction(initAction * action) * _is_ defined, but /etc/inittab is missing, this * results in the same set of default behaviors. * */ -void parse_inittab(void) +static void parse_inittab(void) { #ifdef BB_FEATURE_USE_INITTAB FILE *file; diff --git a/init/init.c b/init/init.c index 52ee6777a..a0f15b0ff 100644 --- a/init/init.c +++ b/init/init.c @@ -174,7 +174,7 @@ struct initActionTag { initAction *nextPtr; initActionEnum action; }; -initAction *initActionList = NULL; +static initAction *initActionList = NULL; static char *secondConsole = VT_SECONDARY; @@ -255,7 +255,7 @@ static void message(int device, char *fmt, ...) } /* Set terminal settings to reasonable defaults */ -void set_term(int fd) +static void set_term(int fd) { struct termios tty; @@ -670,7 +670,7 @@ static void reboot_signal(int sig) #endif /* ! DEBUG_INIT */ -void new_initAction(initActionEnum action, char *process, char *cons) +static void new_initAction(initActionEnum action, char *process, char *cons) { initAction *newAction; @@ -725,7 +725,7 @@ static void delete_initAction(initAction * action) * _is_ defined, but /etc/inittab is missing, this * results in the same set of default behaviors. * */ -void parse_inittab(void) +static void parse_inittab(void) { #ifdef BB_FEATURE_USE_INITTAB FILE *file; diff --git a/kill.c b/kill.c index e62503b3c..fb3d72213 100644 --- a/kill.c +++ b/kill.c @@ -39,7 +39,7 @@ struct signal_name { int number; }; -const struct signal_name signames[] = { +static const struct signal_name signames[] = { /* POSIX signals */ { "HUP", SIGHUP }, /* 1 */ { "INT", SIGINT }, /* 2 */ diff --git a/ls.c b/ls.c index a8d7b182f..77de93a0c 100644 --- a/ls.c +++ b/ls.c @@ -156,9 +156,9 @@ struct dnode { /* the basic node */ }; typedef struct dnode dnode_t; -struct dnode **list_dir(char *); -struct dnode **dnalloc(int); -int list_single(struct dnode *); +static struct dnode **list_dir(char *); +static struct dnode **dnalloc(int); +static int list_single(struct dnode *); static unsigned int disp_opts; static unsigned int style_fmt; @@ -186,7 +186,7 @@ static unsigned short column_width = COLUMN_WIDTH; static int status = EXIT_SUCCESS; #ifdef BB_FEATURE_HUMAN_READABLE -unsigned long ls_disp_hr = 0; +static unsigned long ls_disp_hr = 0; #endif static int my_stat(struct dnode *cur) @@ -256,7 +256,7 @@ static int is_subdir(struct dnode *dn) strcmp(dn->name, "..") != 0); } -int countdirs(struct dnode **dn, int nfiles) +static int countdirs(struct dnode **dn, int nfiles) { int i, dirs; @@ -268,7 +268,7 @@ int countdirs(struct dnode **dn, int nfiles) return(dirs); } -int countsubdirs(struct dnode **dn, int nfiles) +static int countsubdirs(struct dnode **dn, int nfiles) { int i, subdirs; @@ -280,7 +280,7 @@ int countsubdirs(struct dnode **dn, int nfiles) return subdirs; } -int countfiles(struct dnode **dnp) +static int countfiles(struct dnode **dnp) { int nfiles; struct dnode *cur; @@ -293,7 +293,7 @@ int countfiles(struct dnode **dnp) } /* get memory to hold an array of pointers */ -struct dnode **dnalloc(int num) +static struct dnode **dnalloc(int num) { struct dnode **p; @@ -303,7 +303,7 @@ struct dnode **dnalloc(int num) return(p); } -void dfree(struct dnode **dnp) +static void dfree(struct dnode **dnp) { struct dnode *cur, *next; @@ -319,7 +319,7 @@ void dfree(struct dnode **dnp) free(dnp); /* free the array holding the dnode pointers */ } -struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) +static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) { int dncnt, i, d; struct dnode **dnp; @@ -359,7 +359,7 @@ struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) /*----------------------------------------------------------------------*/ #ifdef BB_FEATURE_LS_SORTFILES -int sortcmp(struct dnode *d1, struct dnode *d2) +static int sortcmp(struct dnode *d1, struct dnode *d2) { int cmp, dif; @@ -396,7 +396,7 @@ int sortcmp(struct dnode *d1, struct dnode *d2) } /*----------------------------------------------------------------------*/ -void shellsort(struct dnode **dn, int size) +static void shellsort(struct dnode **dn, int size) { struct dnode *temp; int gap, i, j; @@ -420,7 +420,7 @@ void shellsort(struct dnode **dn, int size) #endif /*----------------------------------------------------------------------*/ -void showfiles(struct dnode **dn, int nfiles) +static void showfiles(struct dnode **dn, int nfiles) { int i, ncols, nrows, row, nc; #ifdef BB_FEATURE_AUTOWIDTH @@ -481,7 +481,7 @@ void showfiles(struct dnode **dn, int nfiles) } /*----------------------------------------------------------------------*/ -void showdirs(struct dnode **dn, int ndirs) +static void showdirs(struct dnode **dn, int ndirs) { int i, nfiles; struct dnode **subdnp; @@ -524,7 +524,7 @@ void showdirs(struct dnode **dn, int ndirs) } /*----------------------------------------------------------------------*/ -struct dnode **list_dir(char *path) +static struct dnode **list_dir(char *path) { struct dnode *dn, *cur, **dnp; struct dirent *entry; @@ -575,7 +575,7 @@ struct dnode **list_dir(char *path) } /*----------------------------------------------------------------------*/ -int list_single(struct dnode *dn) +static int list_single(struct dnode *dn) { int i, len; char scratch[BUFSIZ + 1]; diff --git a/mkfs_minix.c b/mkfs_minix.c index 928a49674..a83fa7961 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c @@ -609,7 +609,7 @@ static void setup_tables(void) * Perform a test of a block; return the number of * blocks readable/writeable. */ -long do_check(char *buffer, int try, unsigned int current_block) +static long do_check(char *buffer, int try, unsigned int current_block) { long got; diff --git a/mkswap.c b/mkswap.c index b5153f623..f72c7009a 100644 --- a/mkswap.c +++ b/mkswap.c @@ -72,7 +72,7 @@ static int version = -1; static int pagesize; static int *signature_page; -struct swap_header_v1 { +static struct swap_header_v1 { char bootbits[1024]; /* Space for disklabel etc. */ unsigned int version; unsigned int last_page; diff --git a/mount.c b/mount.c index fd68dafd6..a2d6053c0 100644 --- a/mount.c +++ b/mount.c @@ -231,7 +231,7 @@ parse_mount_options(char *options, int *flags, char *strflags) } } -int +static int mount_one(char *blockDevice, char *directory, char *filesystemType, unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts, int whineOnErrors) diff --git a/networking/hostname.c b/networking/hostname.c index 8ea8fe107..a6e001d54 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: hostname.c,v 1.25 2001/03/09 14:36:42 andersen Exp $ + * $Id: hostname.c,v 1.26 2001/03/09 21:24:12 andersen Exp $ * Mini hostname implementation for busybox * * Copyright (C) 1999 by Randolph Chung @@ -32,7 +32,7 @@ #include #include -void do_sethostname(char *s, int isfile) +static void do_sethostname(char *s, int isfile) { FILE *f; char buf[255]; diff --git a/networking/route.c b/networking/route.c index b1152ca9d..337b35825 100644 --- a/networking/route.c +++ b/networking/route.c @@ -15,7 +15,7 @@ * Foundation; either version 2 of the License, or (at * your option) any later version. * - * $Id: route.c,v 1.8 2001/03/07 06:33:01 andersen Exp $ + * $Id: route.c,v 1.9 2001/03/09 21:24:12 andersen Exp $ * * displayroute() code added by Vladimir N. Oleynik * adjustments by Larry Doolittle @@ -346,7 +346,7 @@ INET_setroute(int action, int options, char **args) return EXIT_SUCCESS; } -void displayroutes(void) +static void displayroutes(void) { char buff[256]; int nl = 0 ; diff --git a/networking/telnet.c b/networking/telnet.c index fd1ace41d..758cce8b1 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -325,7 +325,7 @@ static void putiac1(byte c) /* ******************************* */ -char const escapecharis[] = "\r\nEscape character is "; +static char const escapecharis[] = "\r\nEscape character is "; static void setConMode() { diff --git a/networking/wget.c b/networking/wget.c index 4b8392ba5..85023f977 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -47,22 +47,22 @@ } while (0) #endif -void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path); -FILE *open_socket(char *host, int port); -char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); -void progressmeter(int flag); +static void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path); +static FILE *open_socket(char *host, int port); +static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); +static void progressmeter(int flag); /* Globals (can be accessed from signal handlers */ static off_t filesize = 0; /* content-length of the file */ #ifdef BB_FEATURE_WGET_STATUSBAR static char *curfile; /* Name of current file being transferred. */ static struct timeval start; /* Time a transfer started. */ -volatile unsigned long statbytes; /* Number of bytes transferred so far. */ +static volatile unsigned long statbytes; /* Number of bytes transferred so far. */ /* For progressmeter() -- number of seconds before xfer considered "stalled" */ static const int STALLTIME = 5; #endif -void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue) +static void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue) { if (output != stdout && do_continue==0) { fclose(output); @@ -371,7 +371,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) */ -int +static int getttywidth(void) { struct winsize winsize; @@ -382,7 +382,7 @@ getttywidth(void) return (80); } -void +static void updateprogressmeter(int ignore) { int save_errno = errno; @@ -391,7 +391,7 @@ updateprogressmeter(int ignore) errno = save_errno; } -void +static void alarmtimer(int wait) { struct itimerval itv; @@ -403,7 +403,7 @@ alarmtimer(int wait) } -void +static void progressmeter(int flag) { static const char prefixes[] = " KMGTP"; @@ -534,7 +534,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.28 2001/02/20 06:14:08 andersen Exp $ + * $Id: wget.c,v 1.29 2001/03/09 21:24:12 andersen Exp $ */ diff --git a/nfsmount.c b/nfsmount.c index aee496980..cd815102c 100644 --- a/nfsmount.c +++ b/nfsmount.c @@ -886,7 +886,7 @@ static char *nfs_strerror(int stat) return buf; } -bool_t +static bool_t xdr_fhandle (XDR *xdrs, fhandle objp) { //register int32_t *buf; diff --git a/procps/kill.c b/procps/kill.c index e62503b3c..fb3d72213 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -39,7 +39,7 @@ struct signal_name { int number; }; -const struct signal_name signames[] = { +static const struct signal_name signames[] = { /* POSIX signals */ { "HUP", SIGHUP }, /* 1 */ { "INT", SIGINT }, /* 2 */ diff --git a/rdate.c b/rdate.c index ed7121a75..28e87323d 100644 --- a/rdate.c +++ b/rdate.c @@ -39,10 +39,10 @@ static const int RFC_868_BIAS = 2208988800UL; -int setdate= 0; -int printdate= 0; +static int setdate= 0; +static int printdate= 0; -time_t askremotedate(char *host) +static time_t askremotedate(char *host) { struct hostent *h; struct sockaddr_in sin; diff --git a/route.c b/route.c index b1152ca9d..337b35825 100644 --- a/route.c +++ b/route.c @@ -15,7 +15,7 @@ * Foundation; either version 2 of the License, or (at * your option) any later version. * - * $Id: route.c,v 1.8 2001/03/07 06:33:01 andersen Exp $ + * $Id: route.c,v 1.9 2001/03/09 21:24:12 andersen Exp $ * * displayroute() code added by Vladimir N. Oleynik * adjustments by Larry Doolittle @@ -346,7 +346,7 @@ INET_setroute(int action, int options, char **args) return EXIT_SUCCESS; } -void displayroutes(void) +static void displayroutes(void) { char buff[256]; int nl = 0 ; diff --git a/sort.c b/sort.c index 79e629c75..9707efa51 100644 --- a/sort.c +++ b/sort.c @@ -26,12 +26,12 @@ #include #include "busybox.h" -int compare_ascii(const void *x, const void *y) +static int compare_ascii(const void *x, const void *y) { return strcmp(*(char **)x, *(char **)y); } -int compare_numeric(const void *x, const void *y) +static int compare_numeric(const void *x, const void *y) { return atoi(*(char **)x) - atoi(*(char **)y); } diff --git a/swaponoff.c b/swaponoff.c index 9deb13a28..55022ae3b 100644 --- a/swaponoff.c +++ b/swaponoff.c @@ -33,8 +33,8 @@ #include #include "busybox.h" -_syscall2(int, swapon, const char *, path, int, flags); -_syscall1(int, swapoff, const char *, path); +static _syscall2(int, swapon, const char *, path, int, flags); +static _syscall1(int, swapoff, const char *, path); static int whichApp; diff --git a/tail.c b/tail.c index a85256c80..ff77bde77 100644 --- a/tail.c +++ b/tail.c @@ -44,14 +44,14 @@ static char *tailbuf; static int taillen; static int newline; -void tailbuf_append(char *buf, int len) +static void tailbuf_append(char *buf, int len) { tailbuf = xrealloc(tailbuf, taillen + len); memcpy(tailbuf + taillen, buf, len); taillen += len; } -void tailbuf_trunc() +static void tailbuf_trunc() { char *s; s = memchr(tailbuf, '\n', taillen); diff --git a/tar.c b/tar.c index a9363d5ad..38a8d9a04 100644 --- a/tar.c +++ b/tar.c @@ -150,7 +150,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, #ifdef BB_FEATURE_TAR_GZIP /* Signal handler for when child gzip process dies... */ -void child_died() +static void child_died() { fflush(stdout); fflush(stderr); @@ -186,7 +186,7 @@ extern int tar_unzip_init(int tarFd) #endif #if defined BB_FEATURE_TAR_EXCLUDE -struct option longopts[] = { +static struct option longopts[] = { { "exclude", 1, NULL, 'e' }, { NULL, 0, NULL, 0 } }; @@ -574,7 +574,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) return( FALSE); } -int exclude_file(char **excluded_files, const char *file) +static int exclude_file(char **excluded_files, const char *file) { int i; @@ -601,7 +601,7 @@ int exclude_file(char **excluded_files, const char *file) return 0; } -int extract_file(char **extract_files, const char *file) +static int extract_file(char **extract_files, const char *file) { int i; diff --git a/telnet.c b/telnet.c index fd1ace41d..758cce8b1 100644 --- a/telnet.c +++ b/telnet.c @@ -325,7 +325,7 @@ static void putiac1(byte c) /* ******************************* */ -char const escapecharis[] = "\r\nEscape character is "; +static char const escapecharis[] = "\r\nEscape character is "; static void setConMode() { diff --git a/util-linux/fbset.c b/util-linux/fbset.c index be1e3c3f1..80711ec9f 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -132,7 +132,7 @@ struct fb_var_screeninfo { }; -struct cmdoptions_t { +static struct cmdoptions_t { char *name; unsigned char param_count; unsigned char code; diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 9a53a705e..bd0c8a61c 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -701,7 +701,7 @@ static void read_tables(void) } } -struct minix_inode *get_inode(unsigned int nr) +static struct minix_inode *get_inode(unsigned int nr) { struct minix_inode *inode; @@ -749,7 +749,7 @@ struct minix_inode *get_inode(unsigned int nr) } #ifdef BB_FEATURE_MINIX2 -struct minix2_inode *get_inode2(unsigned int nr) +static struct minix2_inode *get_inode2(unsigned int nr) { struct minix2_inode *inode; diff --git a/util-linux/getopt.c b/util-linux/getopt.c index eb28d5d07..b74dd65a1 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -62,20 +62,19 @@ typedef enum {BASH,TCSH} shell_t; /* Some global variables that tells us how to parse. */ -shell_t shell=BASH; /* The shell we generate output for. */ -int quiet_errors=0; /* 0 is not quiet. */ -int quiet_output=0; /* 0 is not quiet. */ -int quote=1; /* 1 is do quote. */ -int alternative=0; /* 0 is getopt_long, 1 is getopt_long_only */ +static shell_t shell=BASH; /* The shell we generate output for. */ +static int quiet_errors=0; /* 0 is not quiet. */ +static int quiet_output=0; /* 0 is not quiet. */ +static int quote=1; /* 1 is do quote. */ +static int alternative=0; /* 0 is getopt_long, 1 is getopt_long_only */ /* Function prototypes */ -const char *normalize(const char *arg); -int generate_output(char * argv[],int argc,const char *optstr, +static const char *normalize(const char *arg); +static int generate_output(char * argv[],int argc,const char *optstr, const struct option *longopts); -void add_long_options(char *options); -void add_longopt(const char *name,int has_arg); -void set_shell(const char *new_shell); -void set_initial_shell(void); +static void add_long_options(char *options); +static void add_longopt(const char *name,int has_arg); +static void set_shell(const char *new_shell); /* diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 928a49674..a83fa7961 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -609,7 +609,7 @@ static void setup_tables(void) * Perform a test of a block; return the number of * blocks readable/writeable. */ -long do_check(char *buffer, int try, unsigned int current_block) +static long do_check(char *buffer, int try, unsigned int current_block) { long got; diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index b5153f623..f72c7009a 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -72,7 +72,7 @@ static int version = -1; static int pagesize; static int *signature_page; -struct swap_header_v1 { +static struct swap_header_v1 { char bootbits[1024]; /* Space for disklabel etc. */ unsigned int version; unsigned int last_page; diff --git a/util-linux/mount.c b/util-linux/mount.c index fd68dafd6..a2d6053c0 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -231,7 +231,7 @@ parse_mount_options(char *options, int *flags, char *strflags) } } -int +static int mount_one(char *blockDevice, char *directory, char *filesystemType, unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts, int whineOnErrors) diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index aee496980..cd815102c 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c @@ -886,7 +886,7 @@ static char *nfs_strerror(int stat) return buf; } -bool_t +static bool_t xdr_fhandle (XDR *xdrs, fhandle objp) { //register int32_t *buf; diff --git a/util-linux/rdate.c b/util-linux/rdate.c index ed7121a75..28e87323d 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -39,10 +39,10 @@ static const int RFC_868_BIAS = 2208988800UL; -int setdate= 0; -int printdate= 0; +static int setdate= 0; +static int printdate= 0; -time_t askremotedate(char *host) +static time_t askremotedate(char *host) { struct hostent *h; struct sockaddr_in sin; diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 9deb13a28..55022ae3b 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -33,8 +33,8 @@ #include #include "busybox.h" -_syscall2(int, swapon, const char *, path, int, flags); -_syscall1(int, swapoff, const char *, path); +static _syscall2(int, swapon, const char *, path, int, flags); +static _syscall1(int, swapoff, const char *, path); static int whichApp; diff --git a/uuencode.c b/uuencode.c index 41541defb..35a533309 100644 --- a/uuencode.c +++ b/uuencode.c @@ -34,11 +34,11 @@ static void encode __P ((void)); /* Pointer to the translation table we currently use. */ -const char *trans_ptr; +static const char *trans_ptr; /* The two currently defined translation tables. The first is the standard uuencoding, the second is base64 encoding. */ -const char uu_std[64] = { +static const char uu_std[64] = { '`', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', @@ -49,7 +49,7 @@ const char uu_std[64] = { 'X', 'Y', 'Z', '[', '\\', ']', '^', '_' }; -const char uu_base64[64] = { +static const char uu_base64[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', diff --git a/wc.c b/wc.c index 5472c3070..695e7e7d4 100644 --- a/wc.c +++ b/wc.c @@ -29,8 +29,8 @@ static int total_lines, total_words, total_chars, max_length; static int print_lines, print_words, print_chars, print_length; -void print_counts(int lines, int words, int chars, int length, - const char *name) +static void print_counts(int lines, int words, int chars, int length, + const char *name) { char const *space = ""; diff --git a/wget.c b/wget.c index 4b8392ba5..85023f977 100644 --- a/wget.c +++ b/wget.c @@ -47,22 +47,22 @@ } while (0) #endif -void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path); -FILE *open_socket(char *host, int port); -char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); -void progressmeter(int flag); +static void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path); +static FILE *open_socket(char *host, int port); +static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); +static void progressmeter(int flag); /* Globals (can be accessed from signal handlers */ static off_t filesize = 0; /* content-length of the file */ #ifdef BB_FEATURE_WGET_STATUSBAR static char *curfile; /* Name of current file being transferred. */ static struct timeval start; /* Time a transfer started. */ -volatile unsigned long statbytes; /* Number of bytes transferred so far. */ +static volatile unsigned long statbytes; /* Number of bytes transferred so far. */ /* For progressmeter() -- number of seconds before xfer considered "stalled" */ static const int STALLTIME = 5; #endif -void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue) +static void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue) { if (output != stdout && do_continue==0) { fclose(output); @@ -371,7 +371,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) */ -int +static int getttywidth(void) { struct winsize winsize; @@ -382,7 +382,7 @@ getttywidth(void) return (80); } -void +static void updateprogressmeter(int ignore) { int save_errno = errno; @@ -391,7 +391,7 @@ updateprogressmeter(int ignore) errno = save_errno; } -void +static void alarmtimer(int wait) { struct itimerval itv; @@ -403,7 +403,7 @@ alarmtimer(int wait) } -void +static void progressmeter(int flag) { static const char prefixes[] = " KMGTP"; @@ -534,7 +534,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.28 2001/02/20 06:14:08 andersen Exp $ + * $Id: wget.c,v 1.29 2001/03/09 21:24:12 andersen Exp $ */ -- cgit v1.2.3