summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-12-11 07:42:46 +0000
committerEric Andersen <andersen@codepoet.org>2002-12-11 07:42:46 +0000
commit392947c86012bb003cff218745d0f9b8bbcbf35a (patch)
tree11cd6593353088b948c18af3c2e7c1bd1f641d7c /shell
parentece8fc2b9b4d540faaae29e421837192add25e60 (diff)
downloadbusybox-w32-392947c86012bb003cff218745d0f9b8bbcbf35a.tar.gz
busybox-w32-392947c86012bb003cff218745d0f9b8bbcbf35a.tar.bz2
busybox-w32-392947c86012bb003cff218745d0f9b8bbcbf35a.zip
Fixup all the horrible broken function prototypes
-Erik
Diffstat (limited to 'shell')
-rw-r--r--shell/msh.c66
1 files changed, 29 insertions, 37 deletions
diff --git a/shell/msh.c b/shell/msh.c
index 1485ccb6f..60fc1dc34 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -52,6 +52,7 @@
52#define LINELIM 2100 52#define LINELIM 2100
53#define NPUSH 8 /* limit to input nesting */ 53#define NPUSH 8 /* limit to input nesting */
54 54
55#undef NOFILE
55#define NOFILE 20 /* Number of open files */ 56#define NOFILE 20 /* Number of open files */
56#define NUFILE 10 /* Number of user-accessible files */ 57#define NUFILE 10 /* Number of user-accessible files */
57#define FDBASE 10 /* First file usable by Shell */ 58#define FDBASE 10 /* First file usable by Shell */
@@ -213,7 +214,8 @@ static char *elinep;
213/* 214/*
214 * other functions 215 * other functions
215 */ 216 */
216static int (*inbuilt(char *s ))(void); 217static int(*inbuilt(char *s))(struct op *);
218
217 219
218static char *rexecve (char *c , char **v, char **envp ); 220static char *rexecve (char *c , char **v, char **envp );
219static char *space (int n ); 221static char *space (int n );
@@ -394,7 +396,7 @@ struct ioarg {
394 396
395/* an input generator's state */ 397/* an input generator's state */
396struct io { 398struct io {
397 int (*iofn)(); 399 int (*iofn)(struct ioarg *, struct io *);
398 struct ioarg *argp; 400 struct ioarg *argp;
399 int peekc; 401 int peekc;
400 char prev; /* previous character read by readc() */ 402 char prev; /* previous character read by readc() */
@@ -429,7 +431,7 @@ static void freehere (int area );
429static void gethere (void); 431static void gethere (void);
430static void markhere (char *s, struct ioword *iop ); 432static void markhere (char *s, struct ioword *iop );
431static int herein (char *hname, int xdoll ); 433static int herein (char *hname, int xdoll );
432static int run (struct ioarg *argp, int (*f)()); 434static int run (struct ioarg *argp, int (*f)(struct ioarg *));
433 435
434/* 436/*
435 * IO functions 437 * IO functions
@@ -446,7 +448,7 @@ static void closeall (void);
446/* 448/*
447 * IO control 449 * IO control
448 */ 450 */
449static void pushio (struct ioarg *argp, int (*fn)()); 451static void pushio (struct ioarg *argp, int (*f)(struct ioarg *));
450static int remap (int fd ); 452static int remap (int fd );
451static int openpipe (int *pv ); 453static int openpipe (int *pv );
452static void closepipe (int *pv ); 454static void closepipe (int *pv );
@@ -496,8 +498,8 @@ static void echo(char **wp );
496static struct op **find1case (struct op *t, char *w ); 498static struct op **find1case (struct op *t, char *w );
497static struct op *findcase (struct op *t, char *w ); 499static struct op *findcase (struct op *t, char *w );
498static void brkset(struct brkcon *bc ); 500static void brkset(struct brkcon *bc );
499static int dolabel(void); 501static int dolabel(struct op *t );
500static int dohelp(void); 502static int dohelp(struct op *t );
501static int dochdir(struct op *t ); 503static int dochdir(struct op *t );
502static int doshift(struct op *t ); 504static int doshift(struct op *t );
503static int dologin(struct op *t ); 505static int dologin(struct op *t );
@@ -509,7 +511,7 @@ static int doread(struct op *t );
509static int doeval(struct op *t ); 511static int doeval(struct op *t );
510static int dotrap(struct op *t ); 512static int dotrap(struct op *t );
511static int getsig(char *s ); 513static int getsig(char *s );
512static void setsig (int n, void (*f)()); 514static void setsig (int n, sighandler_t f);
513static int getn(char *as ); 515static int getn(char *as );
514static int dobreak(struct op *t ); 516static int dobreak(struct op *t );
515static int docontinue(struct op *t ); 517static int docontinue(struct op *t );
@@ -517,11 +519,11 @@ static int brkcontin (char *cp, int val );
517static int doexit(struct op *t ); 519static int doexit(struct op *t );
518static int doexport(struct op *t ); 520static int doexport(struct op *t );
519static int doreadonly(struct op *t ); 521static int doreadonly(struct op *t );
520static void rdexp (char **wp, void (*f)(), int key); 522static void rdexp (char **wp, void (*f)(struct var *), int key);
521static void badid(char *s ); 523static void badid(char *s );
522static int doset(struct op *t ); 524static int doset(struct op *t );
523static void varput (char *s, int out ); 525static void varput (char *s, int out );
524static int dotimes(void); 526static int dotimes(struct op *t );
525static int expand (char *cp, struct wdblock **wbp, int f ); 527static int expand (char *cp, struct wdblock **wbp, int f );
526static char *blank(int f ); 528static char *blank(int f );
527static int dollar(int quoted ); 529static int dollar(int quoted );
@@ -535,7 +537,7 @@ static void glob1 (char *base, char *lim );
535static void glob2 (char *i, char *j ); 537static void glob2 (char *i, char *j );
536static void glob3 (char *i, char *j, char *k ); 538static void glob3 (char *i, char *j, char *k );
537static void readhere (char **name, char *s, int ec ); 539static void readhere (char **name, char *s, int ec );
538static void pushio(struct ioarg *argp, int (*fn)()); 540static void pushio (struct ioarg *argp, int (*f)(struct ioarg *));
539static int xxchar(struct ioarg *ap ); 541static int xxchar(struct ioarg *ap );
540 542
541struct here { 543struct here {
@@ -595,7 +597,7 @@ static struct res restab[] = {
595 597
596struct builtincmd { 598struct builtincmd {
597 const char *name; 599 const char *name;
598 int (*builtinfunc)(); 600 int (*builtinfunc)(struct op *t);
599}; 601};
600static const struct builtincmd builtincmds[] = { 602static const struct builtincmd builtincmds[] = {
601 {".", dodot}, 603 {".", dodot},
@@ -698,7 +700,7 @@ extern int msh_main(int argc, char **argv)
698 register char *s; 700 register char *s;
699 int cflag; 701 int cflag;
700 char *name, **ap; 702 char *name, **ap;
701 int (*iof)(); 703 int (*iof)(struct ioarg *);
702 704
703 initarea(); 705 initarea();
704 if ((ap = environ) != NULL) { 706 if ((ap = environ) != NULL) {
@@ -1074,8 +1076,7 @@ int n;
1074} 1076}
1075 1077
1076static void 1078static void
1077next(f) 1079next(int f)
1078int f;
1079{ 1080{
1080 PUSHIO(afile, f, filechar); 1081 PUSHIO(afile, f, filechar);
1081} 1082}
@@ -2478,7 +2479,7 @@ static int
2478forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked) 2479forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked)
2479{ 2480{
2480 int i, rv; 2481 int i, rv;
2481 int (*shcom)() = NULL; 2482 int (*shcom)(struct op *) = NULL;
2482 register int f; 2483 register int f;
2483 char *cp = NULL; 2484 char *cp = NULL;
2484 struct ioword **iopp; 2485 struct ioword **iopp;
@@ -2899,9 +2900,7 @@ char *c, **v, **envp;
2899 * applied to stream `arg'. 2900 * applied to stream `arg'.
2900 */ 2901 */
2901static int 2902static int
2902run(argp, f) 2903run(struct ioarg *argp, int (*f)(struct ioarg *))
2903struct ioarg *argp;
2904int (*f)();
2905{ 2904{
2906 struct op *otree; 2905 struct op *otree;
2907 struct wdblock *swdlist; 2906 struct wdblock *swdlist;
@@ -2945,7 +2944,7 @@ int (*f)();
2945 * built-in commands: doX 2944 * built-in commands: doX
2946 */ 2945 */
2947 2946
2948static int dohelp() 2947static int dohelp(struct op *t )
2949{ 2948{
2950 int col; 2949 int col;
2951 const struct builtincmd *x; 2950 const struct builtincmd *x;
@@ -2988,8 +2987,7 @@ static int dohelp()
2988 2987
2989 2988
2990 2989
2991static int 2990static int dolabel(struct op *t )
2992dolabel()
2993{ 2991{
2994 return(0); 2992 return(0);
2995} 2993}
@@ -3226,7 +3224,7 @@ char *s;
3226} 3224}
3227 3225
3228static void 3226static void
3229setsig( register int n, void (*f)(int)) 3227setsig( register int n, sighandler_t f)
3230{ 3228{
3231 if (n == 0) 3229 if (n == 0)
3232 return; 3230 return;
@@ -3327,11 +3325,7 @@ struct op *t;
3327 return(0); 3325 return(0);
3328} 3326}
3329 3327
3330static void 3328static void rdexp (char **wp, void (*f)(struct var *), int key)
3331rdexp(wp, f, key)
3332register char **wp;
3333void (*f)();
3334int key;
3335{ 3329{
3336 if (*wp != NULL) { 3330 if (*wp != NULL) {
3337 for (; *wp != NULL; wp++) { 3331 for (; *wp != NULL; wp++) {
@@ -3421,7 +3415,7 @@ int out;
3421 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 3415 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
3422 * This file contains code for the times builtin. 3416 * This file contains code for the times builtin.
3423 */ 3417 */
3424static int dotimes () 3418static int dotimes(struct op *t )
3425{ 3419{
3426 struct tms buf; 3420 struct tms buf;
3427 long int clk_tck = sysconf(_SC_CLK_TCK); 3421 long int clk_tck = sysconf(_SC_CLK_TCK);
@@ -3440,7 +3434,7 @@ static int dotimes ()
3440} 3434}
3441 3435
3442 3436
3443static int (*inbuilt(char *s))() 3437static int(*inbuilt(char *s))(struct op *)
3444{ 3438{
3445 const struct builtincmd *bp; 3439 const struct builtincmd *bp;
3446 3440
@@ -3448,7 +3442,7 @@ static int (*inbuilt(char *s))()
3448 if (strcmp(bp->name, s) == 0) 3442 if (strcmp(bp->name, s) == 0)
3449 return(bp->builtinfunc); 3443 return(bp->builtinfunc);
3450 3444
3451 return((int(*)())NULL); 3445 return(NULL);
3452} 3446}
3453 3447
3454/* -------- eval.c -------- */ 3448/* -------- eval.c -------- */
@@ -3803,7 +3797,7 @@ int quoted;
3803 if (i != 0) { 3797 if (i != 0) {
3804 e.iop->argp->aword = ++cp; 3798 e.iop->argp->aword = ++cp;
3805 close(pf[1]); 3799 close(pf[1]);
3806 PUSHIO(afile, remap(pf[0]), quoted? qgravechar: gravechar); 3800 PUSHIO(afile, remap(pf[0]), (int(*)(struct ioarg *))((quoted)? qgravechar: gravechar));
3807 return(1); 3801 return(1);
3808 } 3802 }
3809 *cp = 0; 3803 *cp = 0;
@@ -4282,9 +4276,7 @@ char c;
4282} 4276}
4283 4277
4284static void 4278static void
4285pushio(argp, fn) 4279pushio(struct ioarg *argp, int (*fn)(struct ioarg *))
4286struct ioarg *argp;
4287int (*fn)();
4288{ 4280{
4289 if (++e.iop >= &iostack[NPUSH]) { 4281 if (++e.iop >= &iostack[NPUSH]) {
4290 e.iop--; 4282 e.iop--;
@@ -4292,7 +4284,7 @@ int (*fn)();
4292 gflg++; 4284 gflg++;
4293 return; 4285 return;
4294 } 4286 }
4295 e.iop->iofn = fn; 4287 e.iop->iofn = (int (*)(struct ioarg *, struct io *))fn;
4296 4288
4297 if (argp->afid != AFID_NOBUF) 4289 if (argp->afid != AFID_NOBUF)
4298 e.iop->argp = argp; 4290 e.iop->argp = argp;
@@ -4315,7 +4307,7 @@ int (*fn)();
4315 e.iop->nlcount = 0; 4307 e.iop->nlcount = 0;
4316 if (fn == filechar || fn == linechar) 4308 if (fn == filechar || fn == linechar)
4317 e.iop->task = XIO; 4309 e.iop->task = XIO;
4318 else if (fn == gravechar || fn == qgravechar) 4310 else if (fn == (int(*)(struct ioarg *))gravechar || fn == (int(*)(struct ioarg *))qgravechar)
4319 e.iop->task = XGRAVE; 4311 e.iop->task = XGRAVE;
4320 else 4312 else
4321 e.iop->task = XOTHER; 4313 e.iop->task = XOTHER;
@@ -4719,7 +4711,7 @@ int ec;
4719 if (newenv(setjmp(errpt = ev)) != 0) 4711 if (newenv(setjmp(errpt = ev)) != 0)
4720 unlink(tname); 4712 unlink(tname);
4721 else { 4713 else {
4722 pushio(e.iop->argp, e.iop->iofn); 4714 pushio(e.iop->argp, (int(*)(struct ioarg *))e.iop->iofn);
4723 e.iobase = e.iop; 4715 e.iobase = e.iop;
4724 for (;;) { 4716 for (;;) {
4725 if (interactive && e.iop <= iostack) { 4717 if (interactive && e.iop <= iostack) {