Scrub up some function prototypes.

-Erik
This commit is contained in:
Eric Andersen 2001-10-18 04:11:39 +00:00
parent 8acbf1d307
commit 74400ccfd0
22 changed files with 95 additions and 114 deletions

View File

@ -86,7 +86,7 @@ STRIPTOOL = $(CROSS)strip
# To compile vs uClibc, just use the compiler wrapper built by uClibc... # To compile vs uClibc, just use the compiler wrapper built by uClibc...
# Everything should compile and work as expected these days... # 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 # To compile vs some other alternative libc, you may need to use/adjust
# the following lines to meet your needs... # 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; \ OPTIMIZATION := $(shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
then echo "-Os"; else echo "-O2" ; fi) then echo "-Os"; else echo "-O2" ; fi)
WARNINGS = -Wall -Wshadow WARNINGS=-Wall -Wstrict-prototypes -Wshadow
ARFLAGS = -r ARFLAGS = -r
# #

View File

@ -354,7 +354,7 @@ static void clear_bufs(void)
bytes_in = 0L; bytes_in = 0L;
} }
static void write_error_msg() static void write_error_msg(void)
{ {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
perror(""); perror("");

View File

@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = {
* Signal and error handler. * Signal and error handler.
*/ */
static void abort_gzip() static void abort_gzip(void)
{ {
error_msg("gzip aborted\n"); error_msg("gzip aborted\n");
exit(ERROR); exit(ERROR);
} }
static void make_crc_table() static void make_crc_table(void)
{ {
unsigned long table_entry; /* crc shift register */ unsigned long table_entry; /* crc shift register */
unsigned long poly = 0; /* polynomial exclusive-or pattern */ 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 * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr
*/ */
static int inflate() static int inflate(void)
{ {
int e; /* last block flag */ int e; /* last block flag */
int r; /* result code */ int r; /* result code */

View File

@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = {
* Signal and error handler. * Signal and error handler.
*/ */
static void abort_gzip() static void abort_gzip(void)
{ {
error_msg("gzip aborted\n"); error_msg("gzip aborted\n");
exit(ERROR); exit(ERROR);
} }
static void make_crc_table() static void make_crc_table(void)
{ {
unsigned long table_entry; /* crc shift register */ unsigned long table_entry; /* crc shift register */
unsigned long poly = 0; /* polynomial exclusive-or pattern */ 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 * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr
*/ */
static int inflate() static int inflate(void)
{ {
int e; /* last block flag */ int e; /* last block flag */
int r; /* result code */ int r; /* result code */

31
ash.c
View File

@ -2508,9 +2508,7 @@ out:
* of all the rest.) * of all the rest.)
*/ */
static inline void static inline void evalpipe(union node *n)
evalpipe(n)
union node *n;
{ {
struct job *jp; struct job *jp;
struct nodelist *lp; struct nodelist *lp;
@ -3453,8 +3451,8 @@ pgetc(void)
* PEOF may be pushed back. * PEOF may be pushed back.
*/ */
static void static void pungetc(void)
pungetc() { {
parsenleft++; parsenleft++;
parsenextc--; parsenextc--;
} }
@ -3496,8 +3494,8 @@ popallfiles(void) {
* after a fork is done. * after a fork is done.
*/ */
static void static void closescript(void)
closescript() { {
popallfiles(); popallfiles();
if (parsefile->fd > 0) { if (parsefile->fd > 0) {
close(parsefile->fd); close(parsefile->fd);
@ -3511,9 +3509,7 @@ closescript() {
* interrupts off. * interrupts off.
*/ */
static void static void setinputfd(int fd, int push)
setinputfd(fd, push)
int fd, push;
{ {
(void) fcntl(fd, F_SETFD, FD_CLOEXEC); (void) fcntl(fd, F_SETFD, FD_CLOEXEC);
if (push) { if (push) {
@ -4471,10 +4467,7 @@ expandarg(arg, arglist, flag)
* input string. * input string.
*/ */
static inline char * static inline char * evalvar(char *p, int flag)
evalvar(p, flag)
char *p;
int flag;
{ {
int subtype; int subtype;
int varflags; int varflags;
@ -6075,7 +6068,7 @@ static inline void putprompt(const char *s) {
#ifdef ASH_ALIAS #ifdef ASH_ALIAS
static int static int
pgetc2() pgetc2(void)
{ {
int c; int c;
do { do {
@ -6349,7 +6342,8 @@ static int fd0_redirected = 0;
/* Return true if fd 0 has already been redirected at least once. */ /* Return true if fd 0 has already been redirected at least once. */
static inline int static inline int
fd0_redirected_p () { fd0_redirected_p (void)
{
return fd0_redirected != 0; return fd0_redirected != 0;
} }
@ -7971,8 +7965,7 @@ readcmdfile(const char *name)
static inline char * static inline char *
find_dot_file(mybasename) find_dot_file(char *mybasename)
char *mybasename;
{ {
char *fullname; char *fullname;
const char *path = pathval(); const char *path = pathval();
@ -12761,7 +12754,7 @@ findvar(struct var **vpp, const char *name)
/* /*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org> * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin. * 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) static int timescmd (int argc, char **argv)
{ {

View File

@ -51,7 +51,7 @@ static void tailbuf_append(char *buf, int len)
taillen += len; taillen += len;
} }
static void tailbuf_trunc() static void tailbuf_trunc(void)
{ {
char *s; char *s;
s = memchr(tailbuf, '\n', taillen); s = memchr(tailbuf, '\n', taillen);

View File

@ -158,21 +158,21 @@ static struct t_op const *t_wp_op;
static gid_t *group_array = NULL; static gid_t *group_array = NULL;
static int ngroups; static int ngroups;
static enum token t_lex(); static enum token t_lex(char* s);
static int oexpr(); static int oexpr(enum token n);
static int aexpr(); static int aexpr(enum token n);
static int nexpr(); static int nexpr(enum token n);
static int binop(); static int binop(void);
static int primary(); static int primary(enum token n);
static int filstat(); static int filstat(char *nm, enum token mode);
static int getn(); static int getn(const char *s);
static int newerf(); static int newerf(const char *f1, const char *f2);
static int olderf(); static int olderf(const char *f1, const char *f2);
static int equalf(); static int equalf(const char *f1, const char *f2);
static void syntax(); static void syntax(const char *op, const char *msg);
static int test_eaccess(); static int test_eaccess(char *path, int mode);
static int is_a_group_member(); static int is_a_group_member(gid_t gid);
static void initialize_group_array(); static void initialize_group_array(void);
extern int extern int
test_main(int argc, char** argv) test_main(int argc, char** argv)
@ -226,8 +226,8 @@ test_main(int argc, char** argv)
static void static void
syntax(op, msg) syntax(op, msg)
char *op; const char *op;
char *msg; const char *msg;
{ {
if (op && *op) if (op && *op)
error_msg_and_die("%s: %s", op, msg); error_msg_and_die("%s: %s", op, msg);
@ -458,7 +458,7 @@ t_lex(s)
/* atoi with error detection */ /* atoi with error detection */
static int static int
getn(s) getn(s)
char *s; const char *s;
{ {
char *p; char *p;
long r; long r;
@ -480,7 +480,7 @@ getn(s)
static int static int
newerf (f1, f2) newerf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;
@ -491,7 +491,7 @@ char *f1, *f2;
static int static int
olderf (f1, f2) olderf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;
@ -502,7 +502,7 @@ char *f1, *f2;
static int static int
equalf (f1, f2) equalf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;

View File

@ -30,7 +30,6 @@
extern int optind; /* in unistd.h */ 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 */ extern void xregcomp(regex_t *preg, const char *regex, int cflags); /* in busybox.h */
/* options */ /* options */

1
grep.c
View File

@ -30,7 +30,6 @@
extern int optind; /* in unistd.h */ 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 */ extern void xregcomp(regex_t *preg, const char *regex, int cflags); /* in busybox.h */
/* options */ /* options */

2
gzip.c
View File

@ -354,7 +354,7 @@ static void clear_bufs(void)
bytes_in = 0L; bytes_in = 0L;
} }
static void write_error_msg() static void write_error_msg(void)
{ {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
perror(""); perror("");

8
init.c
View File

@ -179,7 +179,7 @@ static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action); static void delete_initAction(initAction * action);
static void loop_forever() static void loop_forever(void)
{ {
while (1) while (1)
sleep (1); sleep (1);
@ -289,7 +289,7 @@ static void set_term(int fd)
/* How much memory does this machine have? /* How much memory does this machine have?
Units are kBytes to avoid overflow on 4GB machines */ Units are kBytes to avoid overflow on 4GB machines */
static int check_free_memory() static int check_free_memory(void)
{ {
struct sysinfo info; struct sysinfo info;
unsigned int result, u, s=10; unsigned int result, u, s=10;
@ -310,7 +310,7 @@ static int check_free_memory()
return result; return result;
} }
static void console_init() static void console_init(void)
{ {
int fd; int fd;
int tried_devcons = 0; 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. * /* Make sure there is enough memory to do something useful. *
* Calls "swapon -a" if needed so be sure /etc/fstab is present... */ * Calls "swapon -a" if needed so be sure /etc/fstab is present... */
static void check_memory() static void check_memory(void)
{ {
struct stat statBuf; struct stat statBuf;

View File

@ -179,7 +179,7 @@ static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action); static void delete_initAction(initAction * action);
static void loop_forever() static void loop_forever(void)
{ {
while (1) while (1)
sleep (1); sleep (1);
@ -289,7 +289,7 @@ static void set_term(int fd)
/* How much memory does this machine have? /* How much memory does this machine have?
Units are kBytes to avoid overflow on 4GB machines */ Units are kBytes to avoid overflow on 4GB machines */
static int check_free_memory() static int check_free_memory(void)
{ {
struct sysinfo info; struct sysinfo info;
unsigned int result, u, s=10; unsigned int result, u, s=10;
@ -310,7 +310,7 @@ static int check_free_memory()
return result; return result;
} }
static void console_init() static void console_init(void)
{ {
int fd; int fd;
int tried_devcons = 0; 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. * /* Make sure there is enough memory to do something useful. *
* Calls "swapon -a" if needed so be sure /etc/fstab is present... */ * Calls "swapon -a" if needed so be sure /etc/fstab is present... */
static void check_memory() static void check_memory(void)
{ {
struct stat statBuf; struct stat statBuf;

View File

@ -115,13 +115,13 @@ static const unsigned short mask_bits[] = {
* Signal and error handler. * Signal and error handler.
*/ */
static void abort_gzip() static void abort_gzip(void)
{ {
error_msg("gzip aborted\n"); error_msg("gzip aborted\n");
exit(ERROR); exit(ERROR);
} }
static void make_crc_table() static void make_crc_table(void)
{ {
unsigned long table_entry; /* crc shift register */ unsigned long table_entry; /* crc shift register */
unsigned long poly = 0; /* polynomial exclusive-or pattern */ 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 * GLOBAL VARIABLES: outcnt, bk, bb, hufts, inptr
*/ */
static int inflate() static int inflate(void)
{ {
int e; /* last block flag */ int e; /* last block flag */
int r; /* result code */ int r; /* result code */

View File

@ -27,12 +27,11 @@
#include <stdarg.h> #include <stdarg.h>
#include <netdb.h> #include <netdb.h>
extern int h_errno;
#include <stdio.h> #include <stdio.h>
#include "libbb.h" #include "libbb.h"
extern void vherror_msg(const char *s, va_list p) extern void vherror_msg(const char *s, va_list p)
{ {
if(s == 0) if(s == 0)

View File

@ -22,10 +22,9 @@
*/ */
#include <netdb.h> #include <netdb.h>
extern int h_errno;
#include "libbb.h" #include "libbb.h"
struct hostent *xgethostbyname(const char *name) struct hostent *xgethostbyname(const char *name)
{ {
struct hostent *retval; struct hostent *retval;

View File

@ -81,7 +81,7 @@ static struct swap_header_v1 {
unsigned int badpages[1]; unsigned int badpages[1];
} *p; } *p;
static void init_signature_page() static void init_signature_page(void)
{ {
pagesize = getpagesize(); pagesize = getpagesize();

View File

@ -2508,9 +2508,7 @@ out:
* of all the rest.) * of all the rest.)
*/ */
static inline void static inline void evalpipe(union node *n)
evalpipe(n)
union node *n;
{ {
struct job *jp; struct job *jp;
struct nodelist *lp; struct nodelist *lp;
@ -3453,8 +3451,8 @@ pgetc(void)
* PEOF may be pushed back. * PEOF may be pushed back.
*/ */
static void static void pungetc(void)
pungetc() { {
parsenleft++; parsenleft++;
parsenextc--; parsenextc--;
} }
@ -3496,8 +3494,8 @@ popallfiles(void) {
* after a fork is done. * after a fork is done.
*/ */
static void static void closescript(void)
closescript() { {
popallfiles(); popallfiles();
if (parsefile->fd > 0) { if (parsefile->fd > 0) {
close(parsefile->fd); close(parsefile->fd);
@ -3511,9 +3509,7 @@ closescript() {
* interrupts off. * interrupts off.
*/ */
static void static void setinputfd(int fd, int push)
setinputfd(fd, push)
int fd, push;
{ {
(void) fcntl(fd, F_SETFD, FD_CLOEXEC); (void) fcntl(fd, F_SETFD, FD_CLOEXEC);
if (push) { if (push) {
@ -4471,10 +4467,7 @@ expandarg(arg, arglist, flag)
* input string. * input string.
*/ */
static inline char * static inline char * evalvar(char *p, int flag)
evalvar(p, flag)
char *p;
int flag;
{ {
int subtype; int subtype;
int varflags; int varflags;
@ -6075,7 +6068,7 @@ static inline void putprompt(const char *s) {
#ifdef ASH_ALIAS #ifdef ASH_ALIAS
static int static int
pgetc2() pgetc2(void)
{ {
int c; int c;
do { do {
@ -6349,7 +6342,8 @@ static int fd0_redirected = 0;
/* Return true if fd 0 has already been redirected at least once. */ /* Return true if fd 0 has already been redirected at least once. */
static inline int static inline int
fd0_redirected_p () { fd0_redirected_p (void)
{
return fd0_redirected != 0; return fd0_redirected != 0;
} }
@ -7971,8 +7965,7 @@ readcmdfile(const char *name)
static inline char * static inline char *
find_dot_file(mybasename) find_dot_file(char *mybasename)
char *mybasename;
{ {
char *fullname; char *fullname;
const char *path = pathval(); const char *path = pathval();
@ -12761,7 +12754,7 @@ findvar(struct var **vpp, const char *name)
/* /*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org> * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin. * 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) static int timescmd (int argc, char **argv)
{ {

View File

@ -59,7 +59,7 @@ static void swap_enable_disable(char *device)
perror_msg_and_die(applet_name); perror_msg_and_die(applet_name);
} }
static void do_em_all() static void do_em_all(void)
{ {
struct mntent *m; struct mntent *m;
FILE *f = setmntent("/etc/fstab", "r"); FILE *f = setmntent("/etc/fstab", "r");

2
tail.c
View File

@ -51,7 +51,7 @@ static void tailbuf_append(char *buf, int len)
taillen += len; taillen += len;
} }
static void tailbuf_trunc() static void tailbuf_trunc(void)
{ {
char *s; char *s;
s = memchr(tailbuf, '\n', taillen); s = memchr(tailbuf, '\n', taillen);

42
test.c
View File

@ -158,21 +158,21 @@ static struct t_op const *t_wp_op;
static gid_t *group_array = NULL; static gid_t *group_array = NULL;
static int ngroups; static int ngroups;
static enum token t_lex(); static enum token t_lex(char* s);
static int oexpr(); static int oexpr(enum token n);
static int aexpr(); static int aexpr(enum token n);
static int nexpr(); static int nexpr(enum token n);
static int binop(); static int binop(void);
static int primary(); static int primary(enum token n);
static int filstat(); static int filstat(char *nm, enum token mode);
static int getn(); static int getn(const char *s);
static int newerf(); static int newerf(const char *f1, const char *f2);
static int olderf(); static int olderf(const char *f1, const char *f2);
static int equalf(); static int equalf(const char *f1, const char *f2);
static void syntax(); static void syntax(const char *op, const char *msg);
static int test_eaccess(); static int test_eaccess(char *path, int mode);
static int is_a_group_member(); static int is_a_group_member(gid_t gid);
static void initialize_group_array(); static void initialize_group_array(void);
extern int extern int
test_main(int argc, char** argv) test_main(int argc, char** argv)
@ -226,8 +226,8 @@ test_main(int argc, char** argv)
static void static void
syntax(op, msg) syntax(op, msg)
char *op; const char *op;
char *msg; const char *msg;
{ {
if (op && *op) if (op && *op)
error_msg_and_die("%s: %s", op, msg); error_msg_and_die("%s: %s", op, msg);
@ -458,7 +458,7 @@ t_lex(s)
/* atoi with error detection */ /* atoi with error detection */
static int static int
getn(s) getn(s)
char *s; const char *s;
{ {
char *p; char *p;
long r; long r;
@ -480,7 +480,7 @@ getn(s)
static int static int
newerf (f1, f2) newerf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;
@ -491,7 +491,7 @@ char *f1, *f2;
static int static int
olderf (f1, f2) olderf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;
@ -502,7 +502,7 @@ char *f1, *f2;
static int static int
equalf (f1, f2) equalf (f1, f2)
char *f1, *f2; const char *f1, *f2;
{ {
struct stat b1, b2; struct stat b1, b2;

View File

@ -81,7 +81,7 @@ static struct swap_header_v1 {
unsigned int badpages[1]; unsigned int badpages[1];
} *p; } *p;
static void init_signature_page() static void init_signature_page(void)
{ {
pagesize = getpagesize(); pagesize = getpagesize();

View File

@ -59,7 +59,7 @@ static void swap_enable_disable(char *device)
perror_msg_and_die(applet_name); perror_msg_and_die(applet_name);
} }
static void do_em_all() static void do_em_all(void)
{ {
struct mntent *m; struct mntent *m;
FILE *f = setmntent("/etc/fstab", "r"); FILE *f = setmntent("/etc/fstab", "r");