#define LINELIM 2100
#define NPUSH 8 /* limit to input nesting */
+#undef NOFILE
#define NOFILE 20 /* Number of open files */
#define NUFILE 10 /* Number of user-accessible files */
#define FDBASE 10 /* First file usable by Shell */
/*
* 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 *space (int n );
/* an input generator's state */
struct io {
- int (*iofn)();
+ int (*iofn)(struct ioarg *, struct io *);
struct ioarg *argp;
int peekc;
char prev; /* previous character read by readc() */
static void gethere (void);
static void markhere (char *s, struct ioword *iop );
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 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 openpipe (int *pv );
static void closepipe (int *pv );
static struct op **find1case (struct op *t, char *w );
static struct op *findcase (struct op *t, char *w );
static void brkset(struct brkcon *bc );
-static int dolabel(void);
-static int dohelp(void);
+static int dolabel(struct op *t );
+static int dohelp(struct op *t );
static int dochdir(struct op *t );
static int doshift(struct op *t );
static int dologin(struct op *t );
static int doeval(struct op *t );
static int dotrap(struct op *t );
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 dobreak(struct op *t );
static int docontinue(struct op *t );
static int doexit(struct op *t );
static int doexport(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 int doset(struct op *t );
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 char *blank(int f );
static int dollar(int quoted );
static void glob2 (char *i, char *j );
static void glob3 (char *i, char *j, char *k );
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 );
struct here {
struct builtincmd {
const char *name;
- int (*builtinfunc)();
+ int (*builtinfunc)(struct op *t);
};
static const struct builtincmd builtincmds[] = {
{".", dodot},
register char *s;
int cflag;
char *name, **ap;
- int (*iof)();
+ int (*iof)(struct ioarg *);
initarea();
if ((ap = environ) != NULL) {
}
static void
-next(f)
-int f;
+next(int f)
{
PUSHIO(afile, f, filechar);
}
forkexec( register struct op *t, int *pin, int *pout, int act, char **wp, int *pforked)
{
int i, rv;
- int (*shcom)() = NULL;
+ int (*shcom)(struct op *) = NULL;
register int f;
char *cp = NULL;
struct ioword **iopp;
* applied to stream `arg'.
*/
static int
-run(argp, f)
-struct ioarg *argp;
-int (*f)();
+run(struct ioarg *argp, int (*f)(struct ioarg *))
{
struct op *otree;
struct wdblock *swdlist;
* built-in commands: doX
*/
-static int dohelp()
+static int dohelp(struct op *t )
{
int col;
const struct builtincmd *x;
-static int
-dolabel()
+static int dolabel(struct op *t )
{
return(0);
}
}
static void
-setsig( register int n, void (*f)(int))
+setsig( register int n, sighandler_t f)
{
if (n == 0)
return;
return(0);
}
-static void
-rdexp(wp, f, key)
-register char **wp;
-void (*f)();
-int key;
+static void rdexp (char **wp, void (*f)(struct var *), int key)
{
if (*wp != NULL) {
for (; *wp != NULL; wp++) {
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
*/
-static int dotimes ()
+static int dotimes(struct op *t )
{
struct tms buf;
long int clk_tck = sysconf(_SC_CLK_TCK);
}
-static int (*inbuilt(char *s))()
+static int(*inbuilt(char *s))(struct op *)
{
const struct builtincmd *bp;
if (strcmp(bp->name, s) == 0)
return(bp->builtinfunc);
- return((int(*)())NULL);
+ return(NULL);
}
/* -------- eval.c -------- */
if (i != 0) {
e.iop->argp->aword = ++cp;
close(pf[1]);
- PUSHIO(afile, remap(pf[0]), quoted? qgravechar: gravechar);
+ PUSHIO(afile, remap(pf[0]), (int(*)(struct ioarg *))((quoted)? qgravechar: gravechar));
return(1);
}
*cp = 0;
}
static void
-pushio(argp, fn)
-struct ioarg *argp;
-int (*fn)();
+pushio(struct ioarg *argp, int (*fn)(struct ioarg *))
{
if (++e.iop >= &iostack[NPUSH]) {
e.iop--;
gflg++;
return;
}
- e.iop->iofn = fn;
+ e.iop->iofn = (int (*)(struct ioarg *, struct io *))fn;
if (argp->afid != AFID_NOBUF)
e.iop->argp = argp;
e.iop->nlcount = 0;
if (fn == filechar || fn == linechar)
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;
else
e.iop->task = XOTHER;
if (newenv(setjmp(errpt = ev)) != 0)
unlink(tname);
else {
- pushio(e.iop->argp, e.iop->iofn);
+ pushio(e.iop->argp, (int(*)(struct ioarg *))e.iop->iofn);
e.iobase = e.iop;
for (;;) {
if (interactive && e.iop <= iostack) {