diff --git a/Makefile b/Makefile index 1ba43f1ba..3cabc7afa 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ STRIPTOOL = $(CROSS)strip # To compile vs uClibc, just use the compiler wrapper built by uClibc... # Everything should compile and work as expected these days... -#CC = ../uClibc/extra/gcc-uClibc/i386-uclibc-gcc +#CC = /usr/i386-linux-uclibc/usr/bin/i386-uclibc-gcc # To compile vs some other alternative libc, you may need to use/adjust # the following lines to meet your needs... @@ -110,8 +110,7 @@ STRIPTOOL = $(CROSS)strip OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ then echo "-Os"; else echo "-O2" ; fi) -WARNINGS = -Wall -Wshadow - +WARNINGS=-Wall -Wstrict-prototypes -Wshadow ARFLAGS = -r # diff --git a/archival/gzip.c b/archival/gzip.c index 53646df7c..5c86c1070 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -354,7 +354,7 @@ static void clear_bufs(void) bytes_in = 0L; } -static void write_error_msg() +static void write_error_msg(void) { fprintf(stderr, "\n"); perror(""); diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index ee746216d..bb32891be 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c @@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = { * Signal and error handler. */ -static void abort_gzip() +static void abort_gzip(void) { error_msg("gzip aborted\n"); exit(ERROR); } -static void make_crc_table() +static void make_crc_table(void) { unsigned long table_entry; /* crc shift register */ unsigned long poly = 0; /* polynomial exclusive-or pattern */ @@ -853,7 +853,7 @@ static int inflate_block(int *e) * * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr */ -static int inflate() +static int inflate(void) { int e; /* last block flag */ int r; /* result code */ diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c index ee746216d..bb32891be 100644 --- a/archival/libunarchive/unzip.c +++ b/archival/libunarchive/unzip.c @@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = { * Signal and error handler. */ -static void abort_gzip() +static void abort_gzip(void) { error_msg("gzip aborted\n"); exit(ERROR); } -static void make_crc_table() +static void make_crc_table(void) { unsigned long table_entry; /* crc shift register */ unsigned long poly = 0; /* polynomial exclusive-or pattern */ @@ -853,7 +853,7 @@ static int inflate_block(int *e) * * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr */ -static int inflate() +static int inflate(void) { int e; /* last block flag */ int r; /* result code */ diff --git a/ash.c b/ash.c index 8a213d876..a65275893 100644 --- a/ash.c +++ b/ash.c @@ -2508,9 +2508,7 @@ out: * of all the rest.) */ -static inline void -evalpipe(n) - union node *n; +static inline void evalpipe(union node *n) { struct job *jp; struct nodelist *lp; @@ -3453,8 +3451,8 @@ pgetc(void) * PEOF may be pushed back. */ -static void -pungetc() { +static void pungetc(void) +{ parsenleft++; parsenextc--; } @@ -3496,8 +3494,8 @@ popallfiles(void) { * after a fork is done. */ -static void -closescript() { +static void closescript(void) +{ popallfiles(); if (parsefile->fd > 0) { close(parsefile->fd); @@ -3511,9 +3509,7 @@ closescript() { * interrupts off. */ -static void -setinputfd(fd, push) - int fd, push; +static void setinputfd(int fd, int push) { (void) fcntl(fd, F_SETFD, FD_CLOEXEC); if (push) { @@ -4471,10 +4467,7 @@ expandarg(arg, arglist, flag) * input string. */ -static inline char * -evalvar(p, flag) - char *p; - int flag; +static inline char * evalvar(char *p, int flag) { int subtype; int varflags; @@ -6075,7 +6068,7 @@ static inline void putprompt(const char *s) { #ifdef ASH_ALIAS static int -pgetc2() +pgetc2(void) { int c; do { @@ -6349,7 +6342,8 @@ static int fd0_redirected = 0; /* Return true if fd 0 has already been redirected at least once. */ static inline int -fd0_redirected_p () { +fd0_redirected_p (void) +{ return fd0_redirected != 0; } @@ -7971,8 +7965,7 @@ readcmdfile(const char *name) static inline char * -find_dot_file(mybasename) - char *mybasename; +find_dot_file(char *mybasename) { char *fullname; const char *path = pathval(); @@ -12761,7 +12754,7 @@ findvar(struct var **vpp, const char *name) /* * Copyright (c) 1999 Herbert Xu * This file contains code for the times builtin. - * $Id: ash.c,v 1.25 2001/09/11 01:14:02 mjn3 Exp $ + * $Id: ash.c,v 1.26 2001/10/18 04:11:38 andersen Exp $ */ static int timescmd (int argc, char **argv) { diff --git a/coreutils/tail.c b/coreutils/tail.c index 90cc2a6ef..5e5fbc14f 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -51,7 +51,7 @@ static void tailbuf_append(char *buf, int len) taillen += len; } -static void tailbuf_trunc() +static void tailbuf_trunc(void) { char *s; s = memchr(tailbuf, '\n', taillen); diff --git a/coreutils/test.c b/coreutils/test.c index 9c66cbb87..3404b02b4 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -158,21 +158,21 @@ static struct t_op const *t_wp_op; static gid_t *group_array = NULL; static int ngroups; -static enum token t_lex(); -static int oexpr(); -static int aexpr(); -static int nexpr(); -static int binop(); -static int primary(); -static int filstat(); -static int getn(); -static int newerf(); -static int olderf(); -static int equalf(); -static void syntax(); -static int test_eaccess(); -static int is_a_group_member(); -static void initialize_group_array(); +static enum token t_lex(char* s); +static int oexpr(enum token n); +static int aexpr(enum token n); +static int nexpr(enum token n); +static int binop(void); +static int primary(enum token n); +static int filstat(char *nm, enum token mode); +static int getn(const char *s); +static int newerf(const char *f1, const char *f2); +static int olderf(const char *f1, const char *f2); +static int equalf(const char *f1, const char *f2); +static void syntax(const char *op, const char *msg); +static int test_eaccess(char *path, int mode); +static int is_a_group_member(gid_t gid); +static void initialize_group_array(void); extern int test_main(int argc, char** argv) @@ -226,8 +226,8 @@ test_main(int argc, char** argv) static void syntax(op, msg) - char *op; - char *msg; + const char *op; + const char *msg; { if (op && *op) error_msg_and_die("%s: %s", op, msg); @@ -458,7 +458,7 @@ t_lex(s) /* atoi with error detection */ static int getn(s) - char *s; + const char *s; { char *p; long r; @@ -480,7 +480,7 @@ getn(s) static int newerf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; @@ -491,7 +491,7 @@ char *f1, *f2; static int olderf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; @@ -502,7 +502,7 @@ char *f1, *f2; static int equalf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; diff --git a/findutils/grep.c b/findutils/grep.c index 3254868be..eff7c3ff5 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -30,7 +30,6 @@ extern int optind; /* in unistd.h */ -extern int errno; /* for use with strerror() */ extern void xregcomp(regex_t *preg, const char *regex, int cflags); /* in busybox.h */ /* options */ diff --git a/grep.c b/grep.c index 3254868be..eff7c3ff5 100644 --- a/grep.c +++ b/grep.c @@ -30,7 +30,6 @@ extern int optind; /* in unistd.h */ -extern int errno; /* for use with strerror() */ extern void xregcomp(regex_t *preg, const char *regex, int cflags); /* in busybox.h */ /* options */ diff --git a/gzip.c b/gzip.c index 53646df7c..5c86c1070 100644 --- a/gzip.c +++ b/gzip.c @@ -354,7 +354,7 @@ static void clear_bufs(void) bytes_in = 0L; } -static void write_error_msg() +static void write_error_msg(void) { fprintf(stderr, "\n"); perror(""); diff --git a/init.c b/init.c index 17273afcd..068e1df16 100644 --- a/init.c +++ b/init.c @@ -179,7 +179,7 @@ static char console[32] = _PATH_CONSOLE; static void delete_initAction(initAction * action); -static void loop_forever() +static void loop_forever(void) { while (1) sleep (1); @@ -289,7 +289,7 @@ static void set_term(int fd) /* How much memory does this machine have? Units are kBytes to avoid overflow on 4GB machines */ -static int check_free_memory() +static int check_free_memory(void) { struct sysinfo info; unsigned int result, u, s=10; @@ -310,7 +310,7 @@ static int check_free_memory() return result; } -static void console_init() +static void console_init(void) { int fd; int tried_devcons = 0; @@ -585,7 +585,7 @@ static int waitfor(char *command, char *terminal, int get_enter) /* Make sure there is enough memory to do something useful. * * Calls "swapon -a" if needed so be sure /etc/fstab is present... */ -static void check_memory() +static void check_memory(void) { struct stat statBuf; diff --git a/init/init.c b/init/init.c index 17273afcd..068e1df16 100644 --- a/init/init.c +++ b/init/init.c @@ -179,7 +179,7 @@ static char console[32] = _PATH_CONSOLE; static void delete_initAction(initAction * action); -static void loop_forever() +static void loop_forever(void) { while (1) sleep (1); @@ -289,7 +289,7 @@ static void set_term(int fd) /* How much memory does this machine have? Units are kBytes to avoid overflow on 4GB machines */ -static int check_free_memory() +static int check_free_memory(void) { struct sysinfo info; unsigned int result, u, s=10; @@ -310,7 +310,7 @@ static int check_free_memory() return result; } -static void console_init() +static void console_init(void) { int fd; int tried_devcons = 0; @@ -585,7 +585,7 @@ static int waitfor(char *command, char *terminal, int get_enter) /* Make sure there is enough memory to do something useful. * * Calls "swapon -a" if needed so be sure /etc/fstab is present... */ -static void check_memory() +static void check_memory(void) { struct stat statBuf; diff --git a/libbb/unzip.c b/libbb/unzip.c index ee746216d..bb32891be 100644 --- a/libbb/unzip.c +++ b/libbb/unzip.c @@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = { * Signal and error handler. */ -static void abort_gzip() +static void abort_gzip(void) { error_msg("gzip aborted\n"); exit(ERROR); } -static void make_crc_table() +static void make_crc_table(void) { unsigned long table_entry; /* crc shift register */ unsigned long poly = 0; /* polynomial exclusive-or pattern */ @@ -853,7 +853,7 @@ static int inflate_block(int *e) * * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr */ -static int inflate() +static int inflate(void) { int e; /* last block flag */ int r; /* result code */ diff --git a/libbb/vherror_msg.c b/libbb/vherror_msg.c index ee0bb5009..44f6ebd28 100644 --- a/libbb/vherror_msg.c +++ b/libbb/vherror_msg.c @@ -27,12 +27,11 @@ #include #include -extern int h_errno; - #include #include "libbb.h" + extern void vherror_msg(const char *s, va_list p) { if(s == 0) diff --git a/libbb/xgethostbyname.c b/libbb/xgethostbyname.c index 258510332..be56f2ed1 100644 --- a/libbb/xgethostbyname.c +++ b/libbb/xgethostbyname.c @@ -22,10 +22,9 @@ */ #include -extern int h_errno; - #include "libbb.h" + struct hostent *xgethostbyname(const char *name) { struct hostent *retval; diff --git a/mkswap.c b/mkswap.c index f72c7009a..c773ecef9 100644 --- a/mkswap.c +++ b/mkswap.c @@ -81,7 +81,7 @@ static struct swap_header_v1 { unsigned int badpages[1]; } *p; -static void init_signature_page() +static void init_signature_page(void) { pagesize = getpagesize(); diff --git a/shell/ash.c b/shell/ash.c index 8a213d876..a65275893 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2508,9 +2508,7 @@ out: * of all the rest.) */ -static inline void -evalpipe(n) - union node *n; +static inline void evalpipe(union node *n) { struct job *jp; struct nodelist *lp; @@ -3453,8 +3451,8 @@ pgetc(void) * PEOF may be pushed back. */ -static void -pungetc() { +static void pungetc(void) +{ parsenleft++; parsenextc--; } @@ -3496,8 +3494,8 @@ popallfiles(void) { * after a fork is done. */ -static void -closescript() { +static void closescript(void) +{ popallfiles(); if (parsefile->fd > 0) { close(parsefile->fd); @@ -3511,9 +3509,7 @@ closescript() { * interrupts off. */ -static void -setinputfd(fd, push) - int fd, push; +static void setinputfd(int fd, int push) { (void) fcntl(fd, F_SETFD, FD_CLOEXEC); if (push) { @@ -4471,10 +4467,7 @@ expandarg(arg, arglist, flag) * input string. */ -static inline char * -evalvar(p, flag) - char *p; - int flag; +static inline char * evalvar(char *p, int flag) { int subtype; int varflags; @@ -6075,7 +6068,7 @@ static inline void putprompt(const char *s) { #ifdef ASH_ALIAS static int -pgetc2() +pgetc2(void) { int c; do { @@ -6349,7 +6342,8 @@ static int fd0_redirected = 0; /* Return true if fd 0 has already been redirected at least once. */ static inline int -fd0_redirected_p () { +fd0_redirected_p (void) +{ return fd0_redirected != 0; } @@ -7971,8 +7965,7 @@ readcmdfile(const char *name) static inline char * -find_dot_file(mybasename) - char *mybasename; +find_dot_file(char *mybasename) { char *fullname; const char *path = pathval(); @@ -12761,7 +12754,7 @@ findvar(struct var **vpp, const char *name) /* * Copyright (c) 1999 Herbert Xu * This file contains code for the times builtin. - * $Id: ash.c,v 1.25 2001/09/11 01:14:02 mjn3 Exp $ + * $Id: ash.c,v 1.26 2001/10/18 04:11:38 andersen Exp $ */ static int timescmd (int argc, char **argv) { diff --git a/swaponoff.c b/swaponoff.c index ce0e2c6cc..d9eb5baae 100644 --- a/swaponoff.c +++ b/swaponoff.c @@ -59,7 +59,7 @@ static void swap_enable_disable(char *device) perror_msg_and_die(applet_name); } -static void do_em_all() +static void do_em_all(void) { struct mntent *m; FILE *f = setmntent("/etc/fstab", "r"); diff --git a/tail.c b/tail.c index 90cc2a6ef..5e5fbc14f 100644 --- a/tail.c +++ b/tail.c @@ -51,7 +51,7 @@ static void tailbuf_append(char *buf, int len) taillen += len; } -static void tailbuf_trunc() +static void tailbuf_trunc(void) { char *s; s = memchr(tailbuf, '\n', taillen); diff --git a/test.c b/test.c index 9c66cbb87..3404b02b4 100644 --- a/test.c +++ b/test.c @@ -158,21 +158,21 @@ static struct t_op const *t_wp_op; static gid_t *group_array = NULL; static int ngroups; -static enum token t_lex(); -static int oexpr(); -static int aexpr(); -static int nexpr(); -static int binop(); -static int primary(); -static int filstat(); -static int getn(); -static int newerf(); -static int olderf(); -static int equalf(); -static void syntax(); -static int test_eaccess(); -static int is_a_group_member(); -static void initialize_group_array(); +static enum token t_lex(char* s); +static int oexpr(enum token n); +static int aexpr(enum token n); +static int nexpr(enum token n); +static int binop(void); +static int primary(enum token n); +static int filstat(char *nm, enum token mode); +static int getn(const char *s); +static int newerf(const char *f1, const char *f2); +static int olderf(const char *f1, const char *f2); +static int equalf(const char *f1, const char *f2); +static void syntax(const char *op, const char *msg); +static int test_eaccess(char *path, int mode); +static int is_a_group_member(gid_t gid); +static void initialize_group_array(void); extern int test_main(int argc, char** argv) @@ -226,8 +226,8 @@ test_main(int argc, char** argv) static void syntax(op, msg) - char *op; - char *msg; + const char *op; + const char *msg; { if (op && *op) error_msg_and_die("%s: %s", op, msg); @@ -458,7 +458,7 @@ t_lex(s) /* atoi with error detection */ static int getn(s) - char *s; + const char *s; { char *p; long r; @@ -480,7 +480,7 @@ getn(s) static int newerf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; @@ -491,7 +491,7 @@ char *f1, *f2; static int olderf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; @@ -502,7 +502,7 @@ char *f1, *f2; static int equalf (f1, f2) -char *f1, *f2; +const char *f1, *f2; { struct stat b1, b2; diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index f72c7009a..c773ecef9 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -81,7 +81,7 @@ static struct swap_header_v1 { unsigned int badpages[1]; } *p; -static void init_signature_page() +static void init_signature_page(void) { pagesize = getpagesize(); diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index ce0e2c6cc..d9eb5baae 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -59,7 +59,7 @@ static void swap_enable_disable(char *device) perror_msg_and_die(applet_name); } -static void do_em_all() +static void do_em_all(void) { struct mntent *m; FILE *f = setmntent("/etc/fstab", "r");