Fixup all the horrible broken function prototypes
-Erik
This commit is contained in:
parent
ece8fc2b9b
commit
392947c860
66
shell/msh.c
66
shell/msh.c
@ -52,6 +52,7 @@
|
|||||||
#define LINELIM 2100
|
#define LINELIM 2100
|
||||||
#define NPUSH 8 /* limit to input nesting */
|
#define NPUSH 8 /* limit to input nesting */
|
||||||
|
|
||||||
|
#undef NOFILE
|
||||||
#define NOFILE 20 /* Number of open files */
|
#define NOFILE 20 /* Number of open files */
|
||||||
#define NUFILE 10 /* Number of user-accessible files */
|
#define NUFILE 10 /* Number of user-accessible files */
|
||||||
#define FDBASE 10 /* First file usable by Shell */
|
#define FDBASE 10 /* First file usable by Shell */
|
||||||
@ -213,7 +214,8 @@ static char *elinep;
|
|||||||
/*
|
/*
|
||||||
* other functions
|
* other functions
|
||||||
*/
|
*/
|
||||||
static int (*inbuilt(char *s ))(void);
|
static int(*inbuilt(char *s))(struct op *);
|
||||||
|
|
||||||
|
|
||||||
static char *rexecve (char *c , char **v, char **envp );
|
static char *rexecve (char *c , char **v, char **envp );
|
||||||
static char *space (int n );
|
static char *space (int n );
|
||||||
@ -394,7 +396,7 @@ struct ioarg {
|
|||||||
|
|
||||||
/* an input generator's state */
|
/* an input generator's state */
|
||||||
struct io {
|
struct io {
|
||||||
int (*iofn)();
|
int (*iofn)(struct ioarg *, struct io *);
|
||||||
struct ioarg *argp;
|
struct ioarg *argp;
|
||||||
int peekc;
|
int peekc;
|
||||||
char prev; /* previous character read by readc() */
|
char prev; /* previous character read by readc() */
|
||||||
@ -429,7 +431,7 @@ static void freehere (int area );
|
|||||||
static void gethere (void);
|
static void gethere (void);
|
||||||
static void markhere (char *s, struct ioword *iop );
|
static void markhere (char *s, struct ioword *iop );
|
||||||
static int herein (char *hname, int xdoll );
|
static int herein (char *hname, int xdoll );
|
||||||
static int run (struct ioarg *argp, int (*f)());
|
static int run (struct ioarg *argp, int (*f)(struct ioarg *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IO functions
|
* IO functions
|
||||||
@ -446,7 +448,7 @@ static void closeall (void);
|
|||||||
/*
|
/*
|
||||||
* IO control
|
* IO control
|
||||||
*/
|
*/
|
||||||
static void pushio (struct ioarg *argp, int (*fn)());
|
static void pushio (struct ioarg *argp, int (*f)(struct ioarg *));
|
||||||
static int remap (int fd );
|
static int remap (int fd );
|
||||||
static int openpipe (int *pv );
|
static int openpipe (int *pv );
|
||||||
static void closepipe (int *pv );
|
static void closepipe (int *pv );
|
||||||
@ -496,8 +498,8 @@ static void echo(char **wp );
|
|||||||
static struct op **find1case (struct op *t, char *w );
|
static struct op **find1case (struct op *t, char *w );
|
||||||
static struct op *findcase (struct op *t, char *w );
|
static struct op *findcase (struct op *t, char *w );
|
||||||
static void brkset(struct brkcon *bc );
|
static void brkset(struct brkcon *bc );
|
||||||
static int dolabel(void);
|
static int dolabel(struct op *t );
|
||||||
static int dohelp(void);
|
static int dohelp(struct op *t );
|
||||||
static int dochdir(struct op *t );
|
static int dochdir(struct op *t );
|
||||||
static int doshift(struct op *t );
|
static int doshift(struct op *t );
|
||||||
static int dologin(struct op *t );
|
static int dologin(struct op *t );
|
||||||
@ -509,7 +511,7 @@ static int doread(struct op *t );
|
|||||||
static int doeval(struct op *t );
|
static int doeval(struct op *t );
|
||||||
static int dotrap(struct op *t );
|
static int dotrap(struct op *t );
|
||||||
static int getsig(char *s );
|
static int getsig(char *s );
|
||||||
static void setsig (int n, void (*f)());
|
static void setsig (int n, sighandler_t f);
|
||||||
static int getn(char *as );
|
static int getn(char *as );
|
||||||
static int dobreak(struct op *t );
|
static int dobreak(struct op *t );
|
||||||
static int docontinue(struct op *t );
|
static int docontinue(struct op *t );
|
||||||
@ -517,11 +519,11 @@ static int brkcontin (char *cp, int val );
|
|||||||
static int doexit(struct op *t );
|
static int doexit(struct op *t );
|
||||||
static int doexport(struct op *t );
|
static int doexport(struct op *t );
|
||||||
static int doreadonly(struct op *t );
|
static int doreadonly(struct op *t );
|
||||||
static void rdexp (char **wp, void (*f)(), int key);
|
static void rdexp (char **wp, void (*f)(struct var *), int key);
|
||||||
static void badid(char *s );
|
static void badid(char *s );
|
||||||
static int doset(struct op *t );
|
static int doset(struct op *t );
|
||||||
static void varput (char *s, int out );
|
static void varput (char *s, int out );
|
||||||
static int dotimes(void);
|
static int dotimes(struct op *t );
|
||||||
static int expand (char *cp, struct wdblock **wbp, int f );
|
static int expand (char *cp, struct wdblock **wbp, int f );
|
||||||
static char *blank(int f );
|
static char *blank(int f );
|
||||||
static int dollar(int quoted );
|
static int dollar(int quoted );
|
||||||
@ -535,7 +537,7 @@ static void glob1 (char *base, char *lim );
|
|||||||
static void glob2 (char *i, char *j );
|
static void glob2 (char *i, char *j );
|
||||||
static void glob3 (char *i, char *j, char *k );
|
static void glob3 (char *i, char *j, char *k );
|
||||||
static void readhere (char **name, char *s, int ec );
|
static void readhere (char **name, char *s, int ec );
|
||||||
static void pushio(struct ioarg *argp, int (*fn)());
|
static void pushio (struct ioarg *argp, int (*f)(struct ioarg *));
|
||||||
static int xxchar(struct ioarg *ap );
|
static int xxchar(struct ioarg *ap );
|
||||||
|
|
||||||
struct here {
|
struct here {
|
||||||
@ -595,7 +597,7 @@ static struct res restab[] = {
|
|||||||
|
|
||||||
struct builtincmd {
|
struct builtincmd {
|
||||||
const char *name;
|
const char *name;
|
||||||
int (*builtinfunc)();
|
int (*builtinfunc)(struct op *t);
|
||||||
};
|
};
|
||||||
static const struct builtincmd builtincmds[] = {
|
static const struct builtincmd builtincmds[] = {
|
||||||
{".", dodot},
|
{".", dodot},
|
||||||
@ -698,7 +700,7 @@ extern int msh_main(int argc, char **argv)
|
|||||||
register char *s;
|
register char *s;
|
||||||
int cflag;
|
int cflag;
|
||||||
char *name, **ap;
|
char *name, **ap;
|
||||||
int (*iof)();
|
int (*iof)(struct ioarg *);
|
||||||
|
|
||||||
initarea();
|
initarea();
|
||||||
if ((ap = environ) != NULL) {
|
if ((ap = environ) != NULL) {
|
||||||
@ -1074,8 +1076,7 @@ int n;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
next(f)
|
next(int f)
|
||||||
int f;
|
|
||||||
{
|
{
|
||||||
PUSHIO(afile, f, filechar);
|
PUSHIO(afile, f, filechar);
|
||||||
}
|
}
|
||||||
@ -2478,7 +2479,7 @@ static int
|
|||||||
forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked)
|
forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked)
|
||||||
{
|
{
|
||||||
int i, rv;
|
int i, rv;
|
||||||
int (*shcom)() = NULL;
|
int (*shcom)(struct op *) = NULL;
|
||||||
register int f;
|
register int f;
|
||||||
char *cp = NULL;
|
char *cp = NULL;
|
||||||
struct ioword **iopp;
|
struct ioword **iopp;
|
||||||
@ -2899,9 +2900,7 @@ char *c, **v, **envp;
|
|||||||
* applied to stream `arg'.
|
* applied to stream `arg'.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
run(argp, f)
|
run(struct ioarg *argp, int (*f)(struct ioarg *))
|
||||||
struct ioarg *argp;
|
|
||||||
int (*f)();
|
|
||||||
{
|
{
|
||||||
struct op *otree;
|
struct op *otree;
|
||||||
struct wdblock *swdlist;
|
struct wdblock *swdlist;
|
||||||
@ -2945,7 +2944,7 @@ int (*f)();
|
|||||||
* built-in commands: doX
|
* built-in commands: doX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int dohelp()
|
static int dohelp(struct op *t )
|
||||||
{
|
{
|
||||||
int col;
|
int col;
|
||||||
const struct builtincmd *x;
|
const struct builtincmd *x;
|
||||||
@ -2988,8 +2987,7 @@ static int dohelp()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int dolabel(struct op *t )
|
||||||
dolabel()
|
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -3226,7 +3224,7 @@ char *s;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setsig( register int n, void (*f)(int))
|
setsig( register int n, sighandler_t f)
|
||||||
{
|
{
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
@ -3327,11 +3325,7 @@ struct op *t;
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void rdexp (char **wp, void (*f)(struct var *), int key)
|
||||||
rdexp(wp, f, key)
|
|
||||||
register char **wp;
|
|
||||||
void (*f)();
|
|
||||||
int key;
|
|
||||||
{
|
{
|
||||||
if (*wp != NULL) {
|
if (*wp != NULL) {
|
||||||
for (; *wp != NULL; wp++) {
|
for (; *wp != NULL; wp++) {
|
||||||
@ -3421,7 +3415,7 @@ int out;
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
static int dotimes ()
|
static int dotimes(struct op *t )
|
||||||
{
|
{
|
||||||
struct tms buf;
|
struct tms buf;
|
||||||
long int clk_tck = sysconf(_SC_CLK_TCK);
|
long int clk_tck = sysconf(_SC_CLK_TCK);
|
||||||
@ -3440,7 +3434,7 @@ static int dotimes ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int (*inbuilt(char *s))()
|
static int(*inbuilt(char *s))(struct op *)
|
||||||
{
|
{
|
||||||
const struct builtincmd *bp;
|
const struct builtincmd *bp;
|
||||||
|
|
||||||
@ -3448,7 +3442,7 @@ static int (*inbuilt(char *s))()
|
|||||||
if (strcmp(bp->name, s) == 0)
|
if (strcmp(bp->name, s) == 0)
|
||||||
return(bp->builtinfunc);
|
return(bp->builtinfunc);
|
||||||
|
|
||||||
return((int(*)())NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- eval.c -------- */
|
/* -------- eval.c -------- */
|
||||||
@ -3803,7 +3797,7 @@ int quoted;
|
|||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
e.iop->argp->aword = ++cp;
|
e.iop->argp->aword = ++cp;
|
||||||
close(pf[1]);
|
close(pf[1]);
|
||||||
PUSHIO(afile, remap(pf[0]), quoted? qgravechar: gravechar);
|
PUSHIO(afile, remap(pf[0]), (int(*)(struct ioarg *))((quoted)? qgravechar: gravechar));
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
*cp = 0;
|
*cp = 0;
|
||||||
@ -4282,9 +4276,7 @@ char c;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pushio(argp, fn)
|
pushio(struct ioarg *argp, int (*fn)(struct ioarg *))
|
||||||
struct ioarg *argp;
|
|
||||||
int (*fn)();
|
|
||||||
{
|
{
|
||||||
if (++e.iop >= &iostack[NPUSH]) {
|
if (++e.iop >= &iostack[NPUSH]) {
|
||||||
e.iop--;
|
e.iop--;
|
||||||
@ -4292,7 +4284,7 @@ int (*fn)();
|
|||||||
gflg++;
|
gflg++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.iop->iofn = fn;
|
e.iop->iofn = (int (*)(struct ioarg *, struct io *))fn;
|
||||||
|
|
||||||
if (argp->afid != AFID_NOBUF)
|
if (argp->afid != AFID_NOBUF)
|
||||||
e.iop->argp = argp;
|
e.iop->argp = argp;
|
||||||
@ -4315,7 +4307,7 @@ int (*fn)();
|
|||||||
e.iop->nlcount = 0;
|
e.iop->nlcount = 0;
|
||||||
if (fn == filechar || fn == linechar)
|
if (fn == filechar || fn == linechar)
|
||||||
e.iop->task = XIO;
|
e.iop->task = XIO;
|
||||||
else if (fn == gravechar || fn == qgravechar)
|
else if (fn == (int(*)(struct ioarg *))gravechar || fn == (int(*)(struct ioarg *))qgravechar)
|
||||||
e.iop->task = XGRAVE;
|
e.iop->task = XGRAVE;
|
||||||
else
|
else
|
||||||
e.iop->task = XOTHER;
|
e.iop->task = XOTHER;
|
||||||
@ -4719,7 +4711,7 @@ int ec;
|
|||||||
if (newenv(setjmp(errpt = ev)) != 0)
|
if (newenv(setjmp(errpt = ev)) != 0)
|
||||||
unlink(tname);
|
unlink(tname);
|
||||||
else {
|
else {
|
||||||
pushio(e.iop->argp, e.iop->iofn);
|
pushio(e.iop->argp, (int(*)(struct ioarg *))e.iop->iofn);
|
||||||
e.iobase = e.iop;
|
e.iobase = e.iop;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (interactive && e.iop <= iostack) {
|
if (interactive && e.iop <= iostack) {
|
||||||
|
Loading…
Reference in New Issue
Block a user