diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-12-11 07:42:46 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-12-11 07:42:46 +0000 |
commit | 392947c86012bb003cff218745d0f9b8bbcbf35a (patch) | |
tree | 11cd6593353088b948c18af3c2e7c1bd1f641d7c /shell | |
parent | ece8fc2b9b4d540faaae29e421837192add25e60 (diff) | |
download | busybox-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.c | 66 |
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 | */ |
216 | static int (*inbuilt(char *s ))(void); | 217 | static int(*inbuilt(char *s))(struct op *); |
218 | |||
217 | 219 | ||
218 | static char *rexecve (char *c , char **v, char **envp ); | 220 | static char *rexecve (char *c , char **v, char **envp ); |
219 | static char *space (int n ); | 221 | static char *space (int n ); |
@@ -394,7 +396,7 @@ struct ioarg { | |||
394 | 396 | ||
395 | /* an input generator's state */ | 397 | /* an input generator's state */ |
396 | struct io { | 398 | struct 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 ); | |||
429 | static void gethere (void); | 431 | static void gethere (void); |
430 | static void markhere (char *s, struct ioword *iop ); | 432 | static void markhere (char *s, struct ioword *iop ); |
431 | static int herein (char *hname, int xdoll ); | 433 | static int herein (char *hname, int xdoll ); |
432 | static int run (struct ioarg *argp, int (*f)()); | 434 | static 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 | */ |
449 | static void pushio (struct ioarg *argp, int (*fn)()); | 451 | static void pushio (struct ioarg *argp, int (*f)(struct ioarg *)); |
450 | static int remap (int fd ); | 452 | static int remap (int fd ); |
451 | static int openpipe (int *pv ); | 453 | static int openpipe (int *pv ); |
452 | static void closepipe (int *pv ); | 454 | static void closepipe (int *pv ); |
@@ -496,8 +498,8 @@ static void echo(char **wp ); | |||
496 | static struct op **find1case (struct op *t, char *w ); | 498 | static struct op **find1case (struct op *t, char *w ); |
497 | static struct op *findcase (struct op *t, char *w ); | 499 | static struct op *findcase (struct op *t, char *w ); |
498 | static void brkset(struct brkcon *bc ); | 500 | static void brkset(struct brkcon *bc ); |
499 | static int dolabel(void); | 501 | static int dolabel(struct op *t ); |
500 | static int dohelp(void); | 502 | static int dohelp(struct op *t ); |
501 | static int dochdir(struct op *t ); | 503 | static int dochdir(struct op *t ); |
502 | static int doshift(struct op *t ); | 504 | static int doshift(struct op *t ); |
503 | static int dologin(struct op *t ); | 505 | static int dologin(struct op *t ); |
@@ -509,7 +511,7 @@ static int doread(struct op *t ); | |||
509 | static int doeval(struct op *t ); | 511 | static int doeval(struct op *t ); |
510 | static int dotrap(struct op *t ); | 512 | static int dotrap(struct op *t ); |
511 | static int getsig(char *s ); | 513 | static int getsig(char *s ); |
512 | static void setsig (int n, void (*f)()); | 514 | static void setsig (int n, sighandler_t f); |
513 | static int getn(char *as ); | 515 | static int getn(char *as ); |
514 | static int dobreak(struct op *t ); | 516 | static int dobreak(struct op *t ); |
515 | static int docontinue(struct op *t ); | 517 | static int docontinue(struct op *t ); |
@@ -517,11 +519,11 @@ static int brkcontin (char *cp, int val ); | |||
517 | static int doexit(struct op *t ); | 519 | static int doexit(struct op *t ); |
518 | static int doexport(struct op *t ); | 520 | static int doexport(struct op *t ); |
519 | static int doreadonly(struct op *t ); | 521 | static int doreadonly(struct op *t ); |
520 | static void rdexp (char **wp, void (*f)(), int key); | 522 | static void rdexp (char **wp, void (*f)(struct var *), int key); |
521 | static void badid(char *s ); | 523 | static void badid(char *s ); |
522 | static int doset(struct op *t ); | 524 | static int doset(struct op *t ); |
523 | static void varput (char *s, int out ); | 525 | static void varput (char *s, int out ); |
524 | static int dotimes(void); | 526 | static int dotimes(struct op *t ); |
525 | static int expand (char *cp, struct wdblock **wbp, int f ); | 527 | static int expand (char *cp, struct wdblock **wbp, int f ); |
526 | static char *blank(int f ); | 528 | static char *blank(int f ); |
527 | static int dollar(int quoted ); | 529 | static int dollar(int quoted ); |
@@ -535,7 +537,7 @@ static void glob1 (char *base, char *lim ); | |||
535 | static void glob2 (char *i, char *j ); | 537 | static void glob2 (char *i, char *j ); |
536 | static void glob3 (char *i, char *j, char *k ); | 538 | static void glob3 (char *i, char *j, char *k ); |
537 | static void readhere (char **name, char *s, int ec ); | 539 | static void readhere (char **name, char *s, int ec ); |
538 | static void pushio(struct ioarg *argp, int (*fn)()); | 540 | static void pushio (struct ioarg *argp, int (*f)(struct ioarg *)); |
539 | static int xxchar(struct ioarg *ap ); | 541 | static int xxchar(struct ioarg *ap ); |
540 | 542 | ||
541 | struct here { | 543 | struct here { |
@@ -595,7 +597,7 @@ static struct res restab[] = { | |||
595 | 597 | ||
596 | struct builtincmd { | 598 | struct builtincmd { |
597 | const char *name; | 599 | const char *name; |
598 | int (*builtinfunc)(); | 600 | int (*builtinfunc)(struct op *t); |
599 | }; | 601 | }; |
600 | static const struct builtincmd builtincmds[] = { | 602 | static 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 | ||
1076 | static void | 1078 | static void |
1077 | next(f) | 1079 | next(int f) |
1078 | int f; | ||
1079 | { | 1080 | { |
1080 | PUSHIO(afile, f, filechar); | 1081 | PUSHIO(afile, f, filechar); |
1081 | } | 1082 | } |
@@ -2478,7 +2479,7 @@ static int | |||
2478 | forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked) | 2479 | forkexec( 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 | */ |
2901 | static int | 2902 | static int |
2902 | run(argp, f) | 2903 | run(struct ioarg *argp, int (*f)(struct ioarg *)) |
2903 | struct ioarg *argp; | ||
2904 | int (*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 | ||
2948 | static int dohelp() | 2947 | static 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 | ||
2991 | static int | 2990 | static int dolabel(struct op *t ) |
2992 | dolabel() | ||
2993 | { | 2991 | { |
2994 | return(0); | 2992 | return(0); |
2995 | } | 2993 | } |
@@ -3226,7 +3224,7 @@ char *s; | |||
3226 | } | 3224 | } |
3227 | 3225 | ||
3228 | static void | 3226 | static void |
3229 | setsig( register int n, void (*f)(int)) | 3227 | setsig( 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 | ||
3330 | static void | 3328 | static void rdexp (char **wp, void (*f)(struct var *), int key) |
3331 | rdexp(wp, f, key) | ||
3332 | register char **wp; | ||
3333 | void (*f)(); | ||
3334 | int 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 | */ |
3424 | static int dotimes () | 3418 | static 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 | ||
3443 | static int (*inbuilt(char *s))() | 3437 | static 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 | ||
4284 | static void | 4278 | static void |
4285 | pushio(argp, fn) | 4279 | pushio(struct ioarg *argp, int (*fn)(struct ioarg *)) |
4286 | struct ioarg *argp; | ||
4287 | int (*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) { |