Scrub up some function prototypes.
-Erik
diff --git a/Makefile b/Makefile
index 1ba43f1..3cabc7a 100644
--- a/Makefile
+++ b/Makefile
@@ -86,7 +86,7 @@
# 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 @@
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 53646df..5c86c10 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -354,7 +354,7 @@
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 ee74621..bb32891 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -115,13 +115,13 @@
* 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 @@
*
* 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 ee74621..bb32891 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -115,13 +115,13 @@
* 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 @@
*
* 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 8a213d8..a652758 100644
--- a/ash.c
+++ b/ash.c
@@ -2508,9 +2508,7 @@
* 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 @@
* PEOF may be pushed back.
*/
-static void
-pungetc() {
+static void pungetc(void)
+{
parsenleft++;
parsenextc--;
}
@@ -3496,8 +3494,8 @@
* after a fork is done.
*/
-static void
-closescript() {
+static void closescript(void)
+{
popallfiles();
if (parsefile->fd > 0) {
close(parsefile->fd);
@@ -3511,9 +3509,7 @@
* 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 @@
* 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 @@
#ifdef ASH_ALIAS
static int
-pgetc2()
+pgetc2(void)
{
int c;
do {
@@ -6349,7 +6342,8 @@
/* 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 @@
static inline char *
-find_dot_file(mybasename)
- char *mybasename;
+find_dot_file(char *mybasename)
{
char *fullname;
const char *path = pathval();
@@ -12761,7 +12754,7 @@
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* 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 90cc2a6..5e5fbc1 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -51,7 +51,7 @@
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 9c66cbb..3404b02 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -158,21 +158,21 @@
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 @@
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 @@
/* atoi with error detection */
static int
getn(s)
- char *s;
+ const char *s;
{
char *p;
long r;
@@ -480,7 +480,7 @@
static int
newerf (f1, f2)
-char *f1, *f2;
+const char *f1, *f2;
{
struct stat b1, b2;
@@ -491,7 +491,7 @@
static int
olderf (f1, f2)
-char *f1, *f2;
+const char *f1, *f2;
{
struct stat b1, b2;
@@ -502,7 +502,7 @@
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 3254868..eff7c3f 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 3254868..eff7c3f 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 53646df..5c86c10 100644
--- a/gzip.c
+++ b/gzip.c
@@ -354,7 +354,7 @@
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 17273af..068e1df 100644
--- a/init.c
+++ b/init.c
@@ -179,7 +179,7 @@
static void delete_initAction(initAction * action);
-static void loop_forever()
+static void loop_forever(void)
{
while (1)
sleep (1);
@@ -289,7 +289,7 @@
/* 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 @@
return result;
}
-static void console_init()
+static void console_init(void)
{
int fd;
int tried_devcons = 0;
@@ -585,7 +585,7 @@
/* 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 17273af..068e1df 100644
--- a/init/init.c
+++ b/init/init.c
@@ -179,7 +179,7 @@
static void delete_initAction(initAction * action);
-static void loop_forever()
+static void loop_forever(void)
{
while (1)
sleep (1);
@@ -289,7 +289,7 @@
/* 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 @@
return result;
}
-static void console_init()
+static void console_init(void)
{
int fd;
int tried_devcons = 0;
@@ -585,7 +585,7 @@
/* 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 ee74621..bb32891 100644
--- a/libbb/unzip.c
+++ b/libbb/unzip.c
@@ -115,13 +115,13 @@
* 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 @@
*
* 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 ee0bb50..44f6ebd 100644
--- a/libbb/vherror_msg.c
+++ b/libbb/vherror_msg.c
@@ -27,12 +27,11 @@
#include <stdarg.h>
#include <netdb.h>
-extern int h_errno;
-
#include <stdio.h>
#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 2585103..be56f2e 100644
--- a/libbb/xgethostbyname.c
+++ b/libbb/xgethostbyname.c
@@ -22,10 +22,9 @@
*/
#include <netdb.h>
-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 f72c700..c773ece 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -81,7 +81,7 @@
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 8a213d8..a652758 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2508,9 +2508,7 @@
* 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 @@
* PEOF may be pushed back.
*/
-static void
-pungetc() {
+static void pungetc(void)
+{
parsenleft++;
parsenextc--;
}
@@ -3496,8 +3494,8 @@
* after a fork is done.
*/
-static void
-closescript() {
+static void closescript(void)
+{
popallfiles();
if (parsefile->fd > 0) {
close(parsefile->fd);
@@ -3511,9 +3509,7 @@
* 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 @@
* 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 @@
#ifdef ASH_ALIAS
static int
-pgetc2()
+pgetc2(void)
{
int c;
do {
@@ -6349,7 +6342,8 @@
/* 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 @@
static inline char *
-find_dot_file(mybasename)
- char *mybasename;
+find_dot_file(char *mybasename)
{
char *fullname;
const char *path = pathval();
@@ -12761,7 +12754,7 @@
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* 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 ce0e2c6..d9eb5ba 100644
--- a/swaponoff.c
+++ b/swaponoff.c
@@ -59,7 +59,7 @@
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 90cc2a6..5e5fbc1 100644
--- a/tail.c
+++ b/tail.c
@@ -51,7 +51,7 @@
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 9c66cbb..3404b02 100644
--- a/test.c
+++ b/test.c
@@ -158,21 +158,21 @@
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 @@
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 @@
/* atoi with error detection */
static int
getn(s)
- char *s;
+ const char *s;
{
char *p;
long r;
@@ -480,7 +480,7 @@
static int
newerf (f1, f2)
-char *f1, *f2;
+const char *f1, *f2;
{
struct stat b1, b2;
@@ -491,7 +491,7 @@
static int
olderf (f1, f2)
-char *f1, *f2;
+const char *f1, *f2;
{
struct stat b1, b2;
@@ -502,7 +502,7 @@
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 f72c700..c773ece 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -81,7 +81,7 @@
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 ce0e2c6..d9eb5ba 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -59,7 +59,7 @@
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");