diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-11 21:09:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-11 21:09:52 +0000 |
commit | b2cf0713059f72becb048f77eeeee708957c3c37 (patch) | |
tree | 4901938b4e73efb009dce4b28883ef41bed2d4de | |
parent | 5292c848e44f77fd3b64aa5ac577dd720a82f759 (diff) |
de-register and ansify functions
-rw-r--r-- | bin/csh/alloc.c | 21 | ||||
-rw-r--r-- | bin/csh/csh.c | 114 | ||||
-rw-r--r-- | bin/csh/csh.h | 4 | ||||
-rw-r--r-- | bin/csh/dir.c | 94 | ||||
-rw-r--r-- | bin/csh/dol.c | 76 | ||||
-rw-r--r-- | bin/csh/error.c | 6 | ||||
-rw-r--r-- | bin/csh/exec.c | 94 | ||||
-rw-r--r-- | bin/csh/exp.c | 127 | ||||
-rw-r--r-- | bin/csh/file.c | 107 | ||||
-rw-r--r-- | bin/csh/func.c | 110 | ||||
-rw-r--r-- | bin/csh/glob.c | 84 | ||||
-rw-r--r-- | bin/csh/hist.c | 35 | ||||
-rw-r--r-- | bin/csh/lex.c | 159 | ||||
-rw-r--r-- | bin/csh/misc.c | 116 | ||||
-rw-r--r-- | bin/csh/parse.c | 96 | ||||
-rw-r--r-- | bin/csh/printf.c | 39 | ||||
-rw-r--r-- | bin/csh/proc.c | 173 | ||||
-rw-r--r-- | bin/csh/sem.c | 31 | ||||
-rw-r--r-- | bin/csh/set.c | 161 | ||||
-rw-r--r-- | bin/csh/str.c | 96 | ||||
-rw-r--r-- | bin/csh/time.c | 45 |
21 files changed, 696 insertions, 1092 deletions
diff --git a/bin/csh/alloc.c b/bin/csh/alloc.c index 43544659b10..0c46215593e 100644 --- a/bin/csh/alloc.c +++ b/bin/csh/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.8 2003/06/02 23:32:06 millert Exp $ */ +/* $OpenBSD: alloc.c,v 1.9 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: alloc.c,v 1.6 1995/03/21 09:02:23 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: alloc.c,v 1.8 2003/06/02 23:32:06 millert Exp $"; +static char rcsid[] = "$OpenBSD: alloc.c,v 1.9 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -50,8 +50,7 @@ char *memtop = NULL; /* PWP: top of current memory */ char *membot = NULL; /* PWP: bottom of allocatable memory */ ptr_t -Malloc(n) - size_t n; +Malloc(size_t n) { ptr_t ptr; @@ -65,9 +64,7 @@ Malloc(n) } ptr_t -Realloc(p, n) - ptr_t p; - size_t n; +Realloc(ptr_t p, size_t n) { ptr_t ptr; @@ -81,8 +78,7 @@ Realloc(p, n) } ptr_t -Calloc(s, n) - size_t s, n; +Calloc(size_t s, size_t n) { ptr_t ptr; @@ -97,8 +93,7 @@ Calloc(s, n) } void -Free(p) - ptr_t p; +Free(ptr_t p) { if (p) free(p); @@ -113,9 +108,7 @@ Free(p) */ void /*ARGSUSED*/ -showall(v, t) - Char **v; - struct command *t; +showall(Char **v, struct command *t) { memtop = (char *) sbrk(0); (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%d).\n", diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 24b4664ff5d..2d880d987e2 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.c,v 1.20 2003/06/02 23:32:06 millert Exp $ */ +/* $OpenBSD: csh.c,v 1.21 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93"; #else -static char rcsid[] = "$OpenBSD: csh.c,v 1.20 2003/06/02 23:32:06 millert Exp $"; +static char rcsid[] = "$OpenBSD: csh.c,v 1.21 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -108,14 +108,12 @@ static void mailchk(void); static Char **defaultpath(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { - register Char *cp; - register char *tcp; - register int f; - register char **tempv; + Char *cp; + char *tcp; + int f; + char **tempv; struct sigaction oact; sigset_t sigset; @@ -591,7 +589,7 @@ notty: } void -untty() +untty(void) { if (tpgrp > 0) { (void) setpgid(0, opgrp); @@ -600,12 +598,11 @@ untty() } void -importpath(cp) - Char *cp; +importpath(Char *cp) { - register int i = 0; - register Char *dp; - register Char **pv; + int i = 0; + Char *dp; + Char **pv; int c; for (dp = cp; *dp; dp++) @@ -640,10 +637,9 @@ importpath(cp) * Source to the file which is the catenation of the argument names. */ static int -srccat(cp, dp) - Char *cp, *dp; +srccat(Char *cp, Char *dp) { - register Char *ep = Strspl(cp, dp); + Char *ep = Strspl(cp, dp); char *ptr = short2str(ep); xfree((ptr_t) ep); @@ -654,11 +650,9 @@ srccat(cp, dp) * Source to a file putting the file descriptor in a safe place (> 2). */ static int -srcfile(f, onlyown, flag) - char *f; - bool onlyown, flag; +srcfile(char *f, bool onlyown, bool flag) { - register int unit; + int unit; if ((unit = open(f, O_RDONLY)) == -1) return 0; @@ -675,9 +669,7 @@ srcfile(f, onlyown, flag) */ int insource; static void -srcunit(unit, onlyown, hflg) - register int unit; - bool onlyown, hflg; +srcunit(int unit, bool onlyown, bool hflg) { /* We have to push down a lot of state here */ /* All this could go into a structure */ @@ -754,7 +746,7 @@ srcunit(unit, onlyown, hflg) if (setintr) sigprocmask(SIG_SETMASK, &osigset, NULL); if (oSHIN >= 0) { - register int i; + int i; /* We made it to the new state... free up its storage */ /* This code could get run twice but xfree doesn't care */ @@ -785,7 +777,7 @@ srcunit(unit, onlyown, hflg) } void -rechist() +rechist(void) { Char buf[BUFSIZ], hbuf[BUFSIZ], *hfile; int fp, ftmp, oldidfds; @@ -830,7 +822,7 @@ rechist() } void -goodbye() +goodbye(void) { rechist(); @@ -851,7 +843,7 @@ goodbye() } void -exitstat() +exitstat(void) { Char *s; #ifdef PROF @@ -871,8 +863,7 @@ exitstat() * in the event of a HUP we want to save the history */ static void -phup(sig) -int sig; +phup(int sig) { /* XXX sigh, everything after this is a signal race */ @@ -922,8 +913,7 @@ Char *jobargv[2] = {STRjobs, 0}; */ /* ARGSUSED */ void -pintr(notused) - int notused; +pintr(int notused) { int save_errno = errno; @@ -932,8 +922,7 @@ pintr(notused) } void -pintr1(wantnl) - bool wantnl; +pintr1(bool wantnl) { Char **v; sigset_t sigset, osigset; @@ -993,8 +982,7 @@ pintr1(wantnl) */ static struct command *savet = NULL; void -process(catch) - bool catch; +process(bool catch) { jmp_buf osetexit; struct command *t = savet; @@ -1128,12 +1116,9 @@ process(catch) void /*ARGSUSED*/ -dosource(v, t) - Char **v; - struct command *t; - +dosource(Char **v, struct command *t) { - register Char *f; + Char *f; bool hflg = 0; Char buf[BUFSIZ]; char sbuf[BUFSIZ]; @@ -1162,10 +1147,10 @@ dosource(v, t) * "You have mail." */ static void -mailchk() +mailchk(void) { - register struct varent *v; - register Char **vp; + struct varent *v; + Char **vp; time_t t; int intvl, cnt; struct stat stb; @@ -1206,9 +1191,7 @@ mailchk() * We write the home directory of the user back there. */ int -gethdir(home, len) - Char *home; - int len; +gethdir(Char *home, int len) { Char *h; struct passwd *pw; @@ -1243,37 +1226,27 @@ gethdir(home, len) #define DESC(a) (*((int *) (a)) - (didfds && *((int *) a) >= FSHIN ? FSHIN : 0)) static int -readf(oreo, buf, siz) - void *oreo; - char *buf; - int siz; +readf(void *oreo, char *buf, int siz) { return read(DESC(oreo), buf, siz); } static int -writef(oreo, buf, siz) - void *oreo; - const char *buf; - int siz; +writef(void *oreo, const char *buf, int siz) { return write(DESC(oreo), buf, siz); } static fpos_t -seekf(oreo, off, whence) - void *oreo; - fpos_t off; - int whence; +seekf(void *oreo, fpos_t off, int whence) { return lseek(DESC(oreo), off, whence); } static int -closef(oreo) - void *oreo; +closef(void *oreo) { return close(DESC(oreo)); } @@ -1283,9 +1256,7 @@ closef(oreo) * Print the visible version of a string. */ int -vis_fputc(ch, fp) - int ch; - FILE *fp; +vis_fputc(int ch, FILE *fp) { char uenc[5]; /* 4 + NUL */ @@ -1304,7 +1275,7 @@ vis_fputc(ch, fp) * resting places, closing all other units. */ void -initdesc() +initdesc(void) { didfds = 0; /* 0, 1, 2 aren't set up */ @@ -1318,18 +1289,17 @@ initdesc() void #ifdef PROF -done(i) +done(int i) #else -xexit(i) +xexit(int i) #endif - int i; { untty(); _exit(i); } static Char ** -defaultpath() +defaultpath(void) { char *ptr; Char **blk, **blkp; @@ -1356,9 +1326,9 @@ defaultpath() } void -printprompt() +printprompt(void) { - register Char *cp; + Char *cp; if (!whyles) { for (cp = value(STRprompt); *cp; cp++) diff --git a/bin/csh/csh.h b/bin/csh/csh.h index 956ff61314f..08d69dd39b8 100644 --- a/bin/csh/csh.h +++ b/bin/csh/csh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: csh.h,v 1.13 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: csh.h,v 1.14 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: csh.h,v 1.9 1995/03/21 09:02:40 cgd Exp $ */ /*- @@ -71,7 +71,7 @@ typedef char Char; #endif /* - * Make sure a variable is not stored in a register by taking its address + * Make sure a variable is not stored in a by taking its address * This is used where variables might be clobbered by longjmp. */ #define UNREGISTER(a) (void) &a diff --git a/bin/csh/dir.c b/bin/csh/dir.c index 1b7da733457..e1dd57294c3 100644 --- a/bin/csh/dir.c +++ b/bin/csh/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.11 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: dir.c,v 1.12 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: dir.c,v 1.9 1995/03/21 09:02:42 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: dir.c,v 1.11 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.12 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -69,12 +69,11 @@ static int dirflag = 0; * dinit - initialize current working directory */ void -dinit(hp) - Char *hp; +dinit(Char *hp) { - register char *tcp; - register Char *cp; - register struct directory *dp; + char *tcp; + Char *cp; + struct directory *dp; char path[MAXPATHLEN]; static char *emsg = "csh: Trying to start from \"%s\"\n"; @@ -135,14 +134,13 @@ dinit(hp) } static void -dset(dp) -Char *dp; +dset(Char *dp) { /* * Don't call set() directly cause if the directory contains ` or * other junk characters glob will fail. */ - register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **))); + Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **))); vec[0] = Strsave(dp); vec[1] = 0; @@ -155,9 +153,7 @@ Char *dp; #define DIR_LINE 4 static void -skipargs(v, str) - Char ***v; - char *str; +skipargs(Char ***v, char *str) { Char **n = *v, *s; @@ -186,9 +182,7 @@ skipargs(v, str) */ void /*ARGSUSED*/ -dodirs(v, t) - Char **v; - struct command *t; +dodirs(Char **v, struct command *t) { skipargs(&v, ""); @@ -198,9 +192,9 @@ dodirs(v, t) } static void -printdirs() +printdirs(void) { - register struct directory *dp; + struct directory *dp; Char *s, *hp = value(STRhome); int idx, len, cur; @@ -236,8 +230,7 @@ printdirs() } void -dtildepr(home, dir) - register Char *home, *dir; +dtildepr(Char *home, Char *dir) { if (!eq(home, STRslash) && prefix(home, dir)) @@ -247,7 +240,7 @@ dtildepr(home, dir) } void -dtilde() +dtilde(void) { struct directory *d = dcwd; @@ -266,8 +259,7 @@ dtilde() * it depending on the symbolic link flags */ Char * -dnormalize(cp) - Char *cp; +dnormalize(Char *cp) { #define UC (unsigned char) @@ -334,12 +326,10 @@ dnormalize(cp) */ void /*ARGSUSED*/ -dochngd(v, t) - Char **v; - struct command *t; +dochngd(Char **v, struct command *t) { - register Char *cp; - register struct directory *dp; + Char *cp; + struct directory *dp; skipargs(&v, " [<dir>]"); printd = 0; @@ -381,13 +371,12 @@ dochngd(v, t) } static Char * -dgoto(cp) - Char *cp; +dgoto(Char *cp) { Char *dp; if (*cp != '/') { - register Char *p, *q; + Char *p, *q; int cwdlen; for (p = dcwd->di_name; *p++;) @@ -420,10 +409,9 @@ dgoto(cp) * dfollow - change to arg directory; fall back on cdpath if not valid */ static Char * -dfollow(cp) - register Char *cp; +dfollow(Char *cp) { - register Char *dp; + Char *dp; struct varent *c; char ebuf[MAXPATHLEN]; int serrno; @@ -447,7 +435,7 @@ dfollow(cp) if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp) && (c = adrof(STRcdpath))) { Char **cdp; - register Char *p; + Char *p; Char buf[MAXPATHLEN]; for (cdp = c->vec; *cdp; cdp++) { @@ -485,11 +473,9 @@ dfollow(cp) */ void /*ARGSUSED*/ -dopushd(v, t) - Char **v; - struct command *t; +dopushd(Char **v, struct command *t) { - register struct directory *dp; + struct directory *dp; skipargs(&v, " [<dir>|+<n>]"); printd = 1; @@ -521,7 +507,7 @@ dopushd(v, t) stderror(ERR_SYSTEM, tmp, strerror(errno)); } else { - register Char *ccp; + Char *ccp; ccp = dfollow(*v); dp = (struct directory *) xcalloc(1, sizeof(struct directory)); @@ -539,12 +525,11 @@ dopushd(v, t) * dfind - find a directory if specified by numeric (+n) argument */ static struct directory * -dfind(cp) - register Char *cp; +dfind(Char *cp) { - register struct directory *dp; - register int i; - register Char *ep; + struct directory *dp; + int i; + Char *ep; if (*cp++ != '+') return (0); @@ -570,11 +555,9 @@ dfind(cp) */ void /*ARGSUSED*/ -dopopd(v, t) - Char **v; - struct command *t; +dopopd(Char **v, struct command *t) { - register struct directory *dp, *p = NULL; + struct directory *dp, *p = NULL; skipargs(&v, " [+<n>]"); printd = 1; @@ -611,8 +594,7 @@ dopopd(v, t) * dfree - free the directory (or keep it if it still has ref count) */ void -dfree(dp) - register struct directory *dp; +dfree(struct directory *dp) { if (dp->di_count != 0) { @@ -630,11 +612,10 @@ dfree(dp) * constructed (always have ..'s, directories have links) */ Char * -dcanon(cp, p) - register Char *cp, *p; +dcanon(Char *cp, Char *p) { - register Char *sp; - register Char *p1, *p2; /* general purpose */ + Char *sp; + Char *p1, *p2; /* general purpose */ bool slash; Char link[MAXPATHLEN]; @@ -921,8 +902,7 @@ dcanon(cp, p) * dnewcwd - make a new directory in the loop the current one */ static void -dnewcwd(dp) - register struct directory *dp; +dnewcwd(struct directory *dp) { dcwd = dp; dset(dcwd->di_name); diff --git a/bin/csh/dol.c b/bin/csh/dol.c index 50c4906d470..2d2e743c946 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dol.c,v 1.12 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: dol.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: dol.c,v 1.12 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: dol.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -101,11 +101,10 @@ static void Dtestq(int); * argument list to command t. */ void -Dfix(t) - register struct command *t; +Dfix(struct command *t) { - register Char **pp; - register Char *p; + Char **pp; + Char *p; if (noexec) return; @@ -126,8 +125,7 @@ Dfix(t) * $ substitute one word, for i/o redirection */ Char * -Dfix1(cp) - register Char *cp; +Dfix1(Char *cp) { Char *Dv[2]; @@ -149,8 +147,7 @@ Dfix1(cp) * Subroutine to do actual fixing after state initialization. */ static void -Dfix2(v) - Char **v; +Dfix2(Char **v) { ginit(); /* Initialize glob's area pointers */ Dvp = v; @@ -167,11 +164,10 @@ Dfix2(v) * Pack up more characters in this word */ static Char * -Dpack(wbuf, wp) - Char *wbuf, *wp; +Dpack(Char *wbuf, Char *wp) { - register int c; - register int i = MAXWLEN - (wp - wbuf); + int c; + int i = MAXWLEN - (wp - wbuf); for (;;) { c = DgetC(DODOL); @@ -215,13 +211,13 @@ Dpack(wbuf, wp) * Rather, DgetC will return a DEOF when we hit the end-of-input. */ static int -Dword() +Dword(void) { - register int c, c1; + int c, c1; Char wbuf[BUFSIZ]; - register Char *wp = wbuf; - register int i = MAXWLEN; - register bool dolflg; + Char *wp = wbuf; + int i = MAXWLEN; + bool dolflg; bool sofar = 0, done = 0; while (!done) { @@ -336,10 +332,9 @@ Dword() * QUOTEd so that it will not be recognized above. */ static int -DgetC(flag) - register int flag; +DgetC(int flag) { - register int c; + int c; top: if ((c = Dpeekc) != '\0') { @@ -384,8 +379,7 @@ static Char *nulvec[] = {0}; static struct varent nulargv = {nulvec, STRargv, { NULL, NULL, NULL }, 0}; static void -dolerror(s) - Char *s; +dolerror(Char *s) { setname(vis_str(s)); stderror(ERR_NAME | ERR_RANGE); @@ -396,10 +390,10 @@ dolerror(s) * Ugh. */ static void -Dgetdol() +Dgetdol(void) { - register Char *np; - register struct varent *vp = NULL; + Char *np; + struct varent *vp = NULL; Char name[4 * MAXVARLEN + 1]; int c, sc; int subscr = 0, lwb = 1, upb = 0; @@ -569,7 +563,7 @@ Dgetdol() else if (*np != '-') stderror(ERR_MISSING, '-'); else { - register int i = upb; + int i = upb; np++; if (Isdigit(*np)) { @@ -626,9 +620,9 @@ eatbrac: } static void -fixDolMod() +fixDolMod(void) { - register int c; + int c; c = DgetC(0); if (c == ':') { @@ -686,10 +680,9 @@ fixDolMod() } static void -setDolp(cp) - register Char *cp; +setDolp(Char *cp) { - register Char *dp; + Char *dp; int i; if (dolnmod == 0 || dolmcnt == 0) { @@ -790,17 +783,16 @@ setDolp(cp) } static void -unDredc(c) - int c; +unDredc(int c) { Dpeekrd = c; } static int -Dredc() +Dredc(void) { - register int c; + int c; if ((c = Dpeekrd) != '\0') { Dpeekrd = 0; @@ -817,8 +809,7 @@ Dredc() } static void -Dtestq(c) - register int c; +Dtestq(int c) { if (cmap(c, QUOTES)) @@ -832,14 +823,13 @@ Dtestq(c) */ void /*ARGSUSED*/ -heredoc(term) - Char *term; +heredoc(Char *term) { - register int c; + int c; Char *Dv[2]; Char obuf[BUFSIZ], lbuf[BUFSIZ], mbuf[BUFSIZ]; int ocnt, lcnt, mcnt; - register Char *lbp, *obp, *mbp; + Char *lbp, *obp, *mbp; Char **vp; bool quoted; char tmp[] = "/tmp/sh.XXXXXXXX"; diff --git a/bin/csh/error.c b/bin/csh/error.c index 7c63907cbe2..12f73404ca6 100644 --- a/bin/csh/error.c +++ b/bin/csh/error.c @@ -1,4 +1,4 @@ -/* $OpenBSD: error.c,v 1.5 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: error.c,v 1.6 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: err.c,v 1.6 1995/03/21 09:02:47 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: error.c,v 1.5 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: error.c,v 1.6 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -323,7 +323,7 @@ void stderror(int id, ...) { va_list va; - register Char **v; + Char **v; int flags = id & ERR_FLAGS; id &= ~ERR_FLAGS; diff --git a/bin/csh/exec.c b/bin/csh/exec.c index a193a5b64dd..dd1232f3531 100644 --- a/bin/csh/exec.c +++ b/bin/csh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.12 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: exec.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: exec.c,v 1.9 1996/09/30 20:03:54 christos Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)exec.c 8.3 (Berkeley) 5/23/95"; #else -static char rcsid[] = "$OpenBSD: exec.c,v 1.12 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: exec.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -106,14 +106,12 @@ static int iscommand(Char *); void /*ARGSUSED*/ -doexec(v, t) - Char **v; - struct command *t; +doexec(Char **v, struct command *t) { - register Char *dp, **pv, **av, *sav; - register struct varent *pathv; - register bool slash; - register int hashval = 0, hashval1, i; + Char *dp, **pv, **av, *sav; + struct varent *pathv; + bool slash; + int hashval = 0, hashval1, i; Char *blk[2]; sigset_t sigset; @@ -240,7 +238,7 @@ cont: } static void -pexerr() +pexerr(void) { /* Couldn't find the damn thing */ if (expath) { @@ -262,14 +260,12 @@ pexerr() * Also do shell scripts here. */ static void -texec(sf, st) - Char *sf; - register Char **st; +texec(Char *sf, Char **st) { - register char **t; - register char *f; - register struct varent *v; - register Char **vp; + char **t; + char *f; + struct varent *v; + Char **vp; Char *lastsh[2]; int fd; unsigned char c; @@ -358,9 +354,7 @@ texec(sf, st) /*ARGSUSED*/ void -execash(t, kp) - Char **t; - register struct command *kp; +execash(Char **t, struct command *kp) { int saveIN, saveOUT, saveDIAG, saveSTD; int oSHIN; @@ -428,8 +422,7 @@ execash(t, kp) } void -xechoit(t) - Char **t; +xechoit(Char **t) { if (adrof(STRecho)) { (void) fflush(csherr); @@ -440,13 +433,11 @@ xechoit(t) void /*ARGSUSED*/ -dohash(v, t) - Char **v; - struct command *t; +dohash(Char **v, struct command *t) { DIR *dirp; - register struct dirent *dp; - register int cnt; + struct dirent *dp; + int cnt; int i = 0; struct varent *pathv = adrof(STRpath); Char **pv; @@ -480,18 +471,14 @@ dohash(v, t) void /*ARGSUSED*/ -dounhash(v, t) - Char **v; - struct command *t; +dounhash(Char **v, struct command *t) { havhash = 0; } void /*ARGSUSED*/ -hashstat(v, t) - Char **v; - struct command *t; +hashstat(Char **v, struct command *t) { if (hits + misses) (void) fprintf(cshout, "%d hits, %d misses, %d%%\n", @@ -502,10 +489,9 @@ hashstat(v, t) * Hash a command name. */ static int -hashname(cp) - register Char *cp; +hashname(Char *cp) { - register long h = 0; + long h = 0; while (*cp) h = hash(h, *cp++); @@ -513,14 +499,13 @@ hashname(cp) } static int -iscommand(name) - Char *name; +iscommand(Char *name) { - register Char **pv; - register Char *sav; - register struct varent *v; - register bool slash = any(short2str(name), '/'); - register int hashval = 0, hashval1, i; + Char **pv; + Char *sav; + struct varent *v; + bool slash = any(short2str(name), '/'); + int hashval = 0, hashval1, i; v = adrof(STRpath); if (v == 0 || v->vec[0] == 0 || slash) @@ -574,9 +559,7 @@ cont: * This is a bit kludgy, but in the name of optimization... */ static int -executable(dir, name, dir_ok) - Char *dir, *name; - bool dir_ok; +executable(Char *dir, Char *name, bool dir_ok) { struct stat stbuf; Char path[MAXPATHLEN], *dp, *sp; @@ -616,9 +599,7 @@ executable(dir, name, dir_ok) */ /*ARGSUSED*/ void -dowhich(v, c) - register Char **v; - struct command *c; +dowhich(Char **v, struct command *c) { struct wordent lex[3]; struct varent *vp; @@ -649,14 +630,11 @@ dowhich(v, c) } static int -tellmewhat(lexp, str, len) - struct wordent *lexp; - Char *str; - int len; +tellmewhat(struct wordent *lexp, Char *str, int len) { - register int i; - register struct biltins *bptr; - register struct wordent *sp = lexp->next; + int i; + struct biltins *bptr; + struct wordent *sp = lexp->next; bool aliased = 0, found; Char *s0, *s1, *s2, *cmd; Char qc; @@ -712,8 +690,8 @@ tellmewhat(lexp, str, len) sp->word = cmd = globone(sp->word, G_IGNORE); if ((i = iscommand(sp->word)) != 0) { - register Char **pv; - register struct varent *v; + Char **pv; + struct varent *v; bool slash = any(short2str(sp->word), '/'); v = adrof(STRpath); diff --git a/bin/csh/exp.c b/bin/csh/exp.c index 9e1849f4a9e..0f4145af032 100644 --- a/bin/csh/exp.c +++ b/bin/csh/exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exp.c,v 1.6 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: exp.c,v 1.7 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: exp.c,v 1.6 1995/03/21 09:02:51 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)exp.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: exp.c,v 1.6 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: exp.c,v 1.7 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -87,24 +87,21 @@ static void etraci(char *, int, Char ***); #endif int -expr(vp) - register Char ***vp; +expr(Char ***vp) { return (exp0(vp, 0)); } int -exp0(vp, ignore) - register Char ***vp; - bool ignore; +exp0(Char ***vp, bool ignore) { - register int p1 = exp1(vp, ignore); + int p1 = exp1(vp, ignore); #ifdef EDEBUG etraci("exp0 p1", p1, vp); #endif if (**vp && eq(**vp, STRor2)) { - register int p2; + int p2; (*vp)++; p2 = exp0(vp, (ignore & IGNORE) || p1); @@ -117,17 +114,15 @@ exp0(vp, ignore) } static int -exp1(vp, ignore) - register Char ***vp; - bool ignore; +exp1(Char ***vp, bool ignore) { - register int p1 = exp2(vp, ignore); + int p1 = exp2(vp, ignore); #ifdef EDEBUG etraci("exp1 p1", p1, vp); #endif if (**vp && eq(**vp, STRand2)) { - register int p2; + int p2; (*vp)++; p2 = exp1(vp, (ignore & IGNORE) || !p1); @@ -140,17 +135,15 @@ exp1(vp, ignore) } static int -exp2(vp, ignore) - register Char ***vp; - bool ignore; +exp2(Char ***vp, bool ignore) { - register int p1 = exp2a(vp, ignore); + int p1 = exp2a(vp, ignore); #ifdef EDEBUG etraci("exp3 p1", p1, vp); #endif if (**vp && eq(**vp, STRor)) { - register int p2; + int p2; (*vp)++; p2 = exp2(vp, ignore); @@ -163,17 +156,15 @@ exp2(vp, ignore) } static int -exp2a(vp, ignore) - register Char ***vp; - bool ignore; +exp2a(Char ***vp, bool ignore) { - register int p1 = exp2b(vp, ignore); + int p1 = exp2b(vp, ignore); #ifdef EDEBUG etraci("exp2a p1", p1, vp); #endif if (**vp && eq(**vp, STRcaret)) { - register int p2; + int p2; (*vp)++; p2 = exp2a(vp, ignore); @@ -186,17 +177,15 @@ exp2a(vp, ignore) } static int -exp2b(vp, ignore) - register Char ***vp; - bool ignore; +exp2b(Char ***vp, bool ignore) { - register int p1 = exp2c(vp, ignore); + int p1 = exp2c(vp, ignore); #ifdef EDEBUG etraci("exp2b p1", p1, vp); #endif if (**vp && eq(**vp, STRand)) { - register int p2; + int p2; (*vp)++; p2 = exp2b(vp, ignore); @@ -209,13 +198,11 @@ exp2b(vp, ignore) } static int -exp2c(vp, ignore) - register Char ***vp; - bool ignore; +exp2c(Char ***vp, bool ignore) { - register Char *p1 = exp3(vp, ignore); - register Char *p2; - register int i; + Char *p1 = exp3(vp, ignore); + Char *p2; + int i; #ifdef EDEBUG etracc("exp2c p1", p1, vp); @@ -257,12 +244,10 @@ exp2c(vp, ignore) } static Char * -exp3(vp, ignore) - register Char ***vp; - bool ignore; +exp3(Char ***vp, bool ignore) { - register Char *p1, *p2; - register int i; + Char *p1, *p2; + int i; p1 = exp3a(vp, ignore); #ifdef EDEBUG @@ -303,12 +288,10 @@ exp3(vp, ignore) } static Char * -exp3a(vp, ignore) - register Char ***vp; - bool ignore; +exp3a(Char ***vp, bool ignore) { - register Char *p1, *p2, *op; - register int i; + Char *p1, *p2, *op; + int i; p1 = exp4(vp, ignore); #ifdef EDEBUG @@ -333,19 +316,17 @@ exp3a(vp, ignore) } static Char * -exp4(vp, ignore) - register Char ***vp; - bool ignore; +exp4(Char ***vp, bool ignore) { - register Char *p1, *p2; - register int i = 0; + Char *p1, *p2; + int i = 0; p1 = exp5(vp, ignore); #ifdef EDEBUG etracc("exp4 p1", p1, vp); #endif if (isa(**vp, ADDOP)) { - register Char *op = *(*vp)++; + Char *op = *(*vp)++; p2 = exp4(vp, ignore); #ifdef EDEBUG @@ -370,19 +351,17 @@ exp4(vp, ignore) } static Char * -exp5(vp, ignore) - register Char ***vp; - bool ignore; +exp5(Char ***vp, bool ignore) { - register Char *p1, *p2; - register int i = 0; + Char *p1, *p2; + int i = 0; p1 = exp6(vp, ignore); #ifdef EDEBUG etracc("exp5 p1", p1, vp); #endif if (isa(**vp, MULOP)) { - register Char *op = *(*vp)++; + Char *op = *(*vp)++; p2 = exp5(vp, ignore); #ifdef EDEBUG @@ -417,12 +396,10 @@ exp5(vp, ignore) } static Char * -exp6(vp, ignore) - register Char ***vp; - bool ignore; +exp6(Char ***vp, bool ignore) { int ccode, i = 0; - register Char *cp, *dp, *ep; + Char *cp, *dp, *ep; if (**vp == 0) stderror(ERR_NAME | ERR_EXPRESSION); @@ -458,7 +435,7 @@ exp6(vp, ignore) return (putn(ccode)); } if (eq(**vp, STRLbrace)) { - register Char **v; + Char **v; struct command faket; Char *fakecom[2]; @@ -596,19 +573,18 @@ exp6(vp, ignore) } static void -evalav(v) - register Char **v; +evalav(Char **v) { struct wordent paraml1; - register struct wordent *hp = ¶ml1; + struct wordent *hp = ¶ml1; struct command *t; - register struct wordent *wdp = hp; + struct wordent *wdp = hp; set(STRstatus, Strsave(STR0)); hp->prev = hp->next = hp; hp->word = STRNULL; while (*v) { - register struct wordent *new = + struct wordent *new = (struct wordent *) xcalloc(1, sizeof *wdp); new->prev = wdp; @@ -627,9 +603,7 @@ evalav(v) } static int -isa(cp, what) - register Char *cp; - register int what; +isa(Char *cp, int what) { if (cp == 0) return ((what & RESTOP) != 0); @@ -676,8 +650,7 @@ isa(cp, what) } static int -egetn(cp) - register Char *cp; +egetn(Char *cp) { if (*cp && *cp != '-' && !Isdigit(*cp)) stderror(ERR_NAME | ERR_EXPRESSION); @@ -688,20 +661,14 @@ egetn(cp) #ifdef EDEBUG static void -etraci(str, i, vp) - char *str; - int i; - Char ***vp; +etraci(char *str, int i, Char ***vp) { (void) fprintf(csherr, "%s=%d\t", str, i); blkpr(csherr, *vp); (void) fprintf(csherr, "\n"); } static void -etracc(str, cp, vp) - char *str; - Char *cp; - Char ***vp; +etracc(char *str, Char *cp, Char ***vp) { (void) fprintf(csherr, "%s=%s\t", str, vis_str(cp)); blkpr(csherr, *vp); diff --git a/bin/csh/file.c b/bin/csh/file.c index 29baa161929..2c06bdf344f 100644 --- a/bin/csh/file.c +++ b/bin/csh/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.14 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: file.c,v 1.15 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: file.c,v 1.11 1996/11/08 19:34:37 christos Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)file.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: file.c,v 1.14 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: file.c,v 1.15 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -106,8 +106,7 @@ static int ignored(Char *); bool filec = 0; static void -setup_tty(on) - int on; +setup_tty(int on) { struct termios tchars; @@ -134,7 +133,7 @@ setup_tty(on) * Move back to beginning of current line */ static void -back_to_col_1() +back_to_col_1(void) { struct termios tty, tty_normal; sigset_t sigset, osigset; @@ -156,10 +155,9 @@ back_to_col_1() * Push string contents back into tty queue */ static void -pushback(string) - Char *string; +pushback(Char *string) { - register Char *p; + Char *p; struct termios tty, tty_normal; sigset_t sigset, osigset; char c; @@ -184,9 +182,7 @@ pushback(string) * Always null terminate. */ static void -catn(des, src, count) - register Char *des, *src; - register int count; +catn(Char *des, Char *src, int count) { while (--count >= 0 && *des) des++; @@ -201,9 +197,7 @@ catn(des, src, count) * and always null terminate. */ static void -copyn(des, src, count) - register Char *des, *src; - register int count; +copyn(Char *des, Char *src, int count) { while (--count >= 0) if ((*des++ = *src++) == 0) @@ -212,8 +206,7 @@ copyn(des, src, count) } static Char -filetype(dir, file) - Char *dir, *file; +filetype(Char *dir, Char *file) { Char path[MAXPATHLEN]; struct stat statb; @@ -249,11 +242,9 @@ static struct winsize win; * Print sorted down columns */ static void -print_by_column(dir, items, count) - Char *dir, *items[]; - int count; +print_by_column(Char *dir, Char *items[], int count) { - register int i, rows, r, c, maxwidth = 0, columns; + int i, rows, r, c, maxwidth = 0, columns; if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0) win.ws_col = 80; @@ -268,7 +259,7 @@ print_by_column(dir, items, count) for (c = 0; c < columns; c++) { i = c * rows + r; if (i < count) { - register int w; + int w; (void) fprintf(cshout, "%s", vis_str(items[i])); (void) fputc(dir ? filetype(dir, items[i]) : ' ', cshout); @@ -291,11 +282,10 @@ print_by_column(dir, items, count) * home_directory_of_person/mumble */ static Char * -tilde(new, old) - Char *new, *old; +tilde(Char *new, Char *old) { - register Char *o, *p; - register struct passwd *pw; + Char *o, *p; + struct passwd *pw; static Char person[40]; if (old[0] != '~') { @@ -322,7 +312,7 @@ tilde(new, old) * Cause pending line to be printed */ static void -retype() +retype(void) { struct termios tty; @@ -332,7 +322,7 @@ retype() } static void -beep() +beep(void) { if (adrof(STRnobeep) == 0) (void) write(SHOUT, "\007", 1); @@ -343,8 +333,7 @@ beep() * print the recognized part of the string */ static void -print_recognized_stuff(recognized_part) - Char *recognized_part; +print_recognized_stuff(Char *recognized_part) { /* An optimized erasing of that silly ^[ */ (void) fputc('\b', cshout); @@ -376,10 +365,9 @@ print_recognized_stuff(recognized_part) * Should leave final slash (/) at end of dir. */ static void -extract_dir_and_name(path, dir, name) - Char *path, *dir, *name; +extract_dir_and_name(Char *path, Char *dir, Char *name) { - register Char *p; + Char *p; p = Strrchr(path, '/'); if (p == NULL) { @@ -393,12 +381,10 @@ extract_dir_and_name(path, dir, name) } static Char * -getentry(dir_fd, looking_for_lognames) - DIR *dir_fd; - int looking_for_lognames; +getentry(DIR *dir_fd, int looking_for_lognames) { - register struct passwd *pw; - register struct dirent *dirp; + struct passwd *pw; + struct dirent *dirp; if (looking_for_lognames) { if ((pw = getpwent()) == NULL) @@ -411,9 +397,7 @@ getentry(dir_fd, looking_for_lognames) } static void -free_items(items, numitems) - Char **items; - int numitems; +free_items(Char **items, int numitems) { int i; @@ -436,14 +420,11 @@ free_items(items, numitems) * Perform a RECOGNIZE or LIST command on string "word". */ static int -tsearch(word, command, max_word_length) - Char *word; - COMMAND command; - int max_word_length; +tsearch(Char *word, COMMAND command, int max_word_length) { - register DIR *dir_fd; - register int numitems = 0, ignoring = TRUE, nignored = 0; - register int name_length, looking_for_lognames; + DIR *dir_fd; + int numitems = 0, ignoring = TRUE, nignored = 0; + int name_length, looking_for_lognames; Char tilded_dir[MAXPATHLEN], dir[MAXPATHLEN]; Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1]; Char *entry; @@ -542,15 +523,13 @@ again: /* search for matches */ * If we shorten it back to the prefix length, stop searching. */ static int -recognize(extended_name, entry, name_length, numitems) - Char *extended_name, *entry; - int name_length, numitems; +recognize(Char *extended_name, Char *entry, int name_length, int numitems) { if (numitems == 1) /* 1st match */ copyn(extended_name, entry, MAXNAMLEN); else { /* 2nd & subsequent matches */ - register Char *x, *ent; - register int len = 0; + Char *x, *ent; + int len = 0; x = extended_name; for (ent = entry; *x && *x == *ent++; x++, len++) @@ -568,8 +547,7 @@ recognize(extended_name, entry, name_length, numitems) * it matches anything. */ static int -is_prefix(check, template) - register Char *check, *template; +is_prefix(Char *check, Char *template) { do if (*check == 0) @@ -583,10 +561,9 @@ is_prefix(check, template) * end of check, I.e., are it's suffix. */ static int -is_suffix(check, template) - Char *check, *template; +is_suffix(Char *check, Char *template) { - register Char *c, *t; + Char *c, *t; for (c = check; *c++;) continue; @@ -601,22 +578,19 @@ is_suffix(check, template) } int -tenex(inputline, inputline_size) - Char *inputline; - int inputline_size; +tenex(Char *inputline, int inputline_size) { - register int numitems, num_read; + int numitems, num_read; char tinputline[BUFSIZ]; - setup_tty(ON); while ((num_read = read(SHIN, tinputline, BUFSIZ)) > 0) { int i; static Char delims[] = {' ', '\'', '"', '\t', ';', '&', '<', '>', '(', ')', '|', '^', '%', '\0'}; - register Char *str_end, *word_start, last_Char, should_retype; - register int space_left; + Char *str_end, *word_start, last_Char, should_retype; + int space_left; COMMAND command; for (i = 0; i < num_read; i++) @@ -672,11 +646,10 @@ tenex(inputline, inputline_size) } static int -ignored(entry) - register Char *entry; +ignored(Char *entry) { struct varent *vp; - register Char **cp; + Char **cp; if ((vp = adrof(STRfignore)) == NULL || (cp = vp->vec) == NULL) return (FALSE); diff --git a/bin/csh/func.c b/bin/csh/func.c index fff5f0e21bf..e4b922ac409 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.17 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: func.c,v 1.18 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: func.c,v 1.17 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: func.c,v 1.18 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -68,8 +68,8 @@ static void Unsetenv(Char *); struct biltins * isbfunc(struct command *t) { - register Char *cp = t->t_dcom[0]; - register struct biltins *bp, *bp1, *bp2; + Char *cp = t->t_dcom[0]; + struct biltins *bp, *bp1, *bp2; static struct biltins label = {"", dozip, 0, 0}; static struct biltins foregnd = {"%job", dofg1, 0, 0}; static struct biltins backgnd = {"%job &", dobg1, 0, 0}; @@ -92,7 +92,7 @@ isbfunc(struct command *t) * one past the end. */ for (bp1 = bfunc, bp2 = bfunc + nbfunc; bp1 < bp2;) { - register int i; + int i; bp = bp1 + ((bp2 - bp1) >> 1); if ((i = *cp - *bp->bname) == 0 && @@ -107,7 +107,7 @@ isbfunc(struct command *t) } void -func(register struct command *t, register struct biltins *bp) +func(struct command *t, struct biltins *bp) { int i; @@ -125,8 +125,8 @@ void /*ARGSUSED*/ doonintr(Char **v, struct command *t) { - register Char *cp; - register Char *vv = v[1]; + Char *cp; + Char *vv = v[1]; sigset_t sigset; if (parintr == SIG_IGN) @@ -174,7 +174,7 @@ dozip(Char **v, struct command *t) } void -prvars() +prvars(void) { plist(&shvhed); } @@ -183,8 +183,8 @@ void /*ARGSUSED*/ doalias(Char **v, struct command *t) { - register struct varent *vp; - register Char *p; + struct varent *vp; + Char *p; v++; p = *v++; @@ -234,7 +234,7 @@ dologin(Char **v, struct command *t) } static void -islogin() +islogin(void) { if (chkstop == 0 && setintr) panystop(0); @@ -246,8 +246,8 @@ islogin() void doif(Char **v, struct command *kp) { - register int i; - register Char **vv; + int i; + Char **vv; v++; i = expr(&v); @@ -282,7 +282,7 @@ doif(Char **v, struct command *kp) * to redo i/o redirection, which is already set up. */ static void -reexecute(register struct command *kp) +reexecute(struct command *kp) { kp->t_dflg &= F_SAVE; kp->t_dflg |= F_REPEAT; @@ -314,7 +314,7 @@ dogoto(Char **v, struct command *t) void gotolab(Char *lab) { - register struct whyle *wp; + struct whyle *wp; /* * While we still can, locate any unknown ends of existing loops. This * obscure code is the WORST result of the fact that we don't really parse. @@ -338,7 +338,7 @@ void /*ARGSUSED*/ doswitch(Char **v, struct command *t) { - register Char *cp, *lp; + Char *cp, *lp; v++; if (!*v || *(*v++) != '(') @@ -386,8 +386,8 @@ void /*ARGSUSED*/ doforeach(Char **v, struct command *t) { - register Char *cp, *sp; - register struct whyle *nwp; + Char *cp, *sp; + struct whyle *nwp; v++; sp = cp = strip(*v); @@ -428,8 +428,8 @@ void /*ARGSUSED*/ dowhile(Char **v, struct command *t) { - register int status; - register bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) && + int status; + bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) && whyles->w_fename == 0; v++; @@ -444,7 +444,7 @@ dowhile(Char **v, struct command *t) if (*v) stderror(ERR_NAME | ERR_EXPRESSION); if (!again) { - register struct whyle *nwp = + struct whyle *nwp = (struct whyle *) xcalloc(1, sizeof(*nwp)); nwp->w_start = lineloc; @@ -468,7 +468,7 @@ dowhile(Char **v, struct command *t) } static void -preread() +preread(void) { sigset_t sigset; @@ -505,7 +505,7 @@ docontin(Char **v, struct command *t) } static void -doagain() +doagain(void) { /* Repeating a while is simple */ if (whyles->w_fename == 0) { @@ -528,7 +528,7 @@ doagain() void dorepeat(Char **v, struct command *kp) { - register int i; + int i; sigset_t sigset; i = getn(v[1]); @@ -557,10 +557,10 @@ doswbrk(Char **v, struct command *t) } int -srchx(register Char *cp) +srchx(Char *cp) { - register struct srch *sp, *sp1, *sp2; - register int i; + struct srch *sp, *sp1, *sp2; + int i; /* * Binary search Sp1 is the beginning of the current search range. Sp2 is @@ -584,11 +584,11 @@ static Char *Sgoal; /*VARARGS2*/ static void -search(int type, register int level, Char *goal) +search(int type, int level, Char *goal) { Char wordbuf[BUFSIZ]; - register Char *aword = wordbuf; - register Char *cp; + Char *aword = wordbuf; + Char *cp; Stype = type; Sgoal = goal; @@ -682,10 +682,10 @@ search(int type, register int level, Char *goal) } static int -getword(register Char *wp) +getword(Char *wp) { - register int found = 0; - register int c, d; + int found = 0; + int c, d; int kwd = 0; Char *owp = wp; @@ -790,7 +790,7 @@ keyword(Char *wp) } static void -toend() +toend(void) { if (whyles->w_end.type == F_SEEK && whyles->w_end.f_seek == 0) { search(T_BREAK, 0, NULL); @@ -803,7 +803,7 @@ toend() } void -wfree() +wfree(void) { struct Ain o; struct whyle *nwp; @@ -811,7 +811,7 @@ wfree() btell(&o); for (; whyles; whyles = nwp) { - register struct whyle *wp = whyles; + struct whyle *wp = whyles; nwp = wp->w_next; /* @@ -855,9 +855,9 @@ doglob(Char **v, struct command *t) } static void -xecho(int sep, register Char **v) +xecho(int sep, Char **v) { - register Char *cp; + Char *cp; int nonl = 0; sigset_t sigset; @@ -882,7 +882,7 @@ xecho(int sep, register Char **v) if (sep == ' ' && *v && eq(*v, STRmn)) nonl++, v++; while ((cp = *v++) != NULL) { - register int c; + int c; while ((c = *cp++) != '\0') (void) vis_fputc(c | QUOTE, cshout); @@ -909,7 +909,7 @@ dosetenv(Char **v, struct command *t) v++; if ((vp = *v++) == 0) { - register Char **ep; + Char **ep; if (setintr) { sigemptyset(&sigset); @@ -999,8 +999,8 @@ dounsetenv(Char **v, struct command *t) void Setenv(Char *name, Char *val) { - register Char **ep = STR_environ; - register Char *cp, *dp; + Char **ep = STR_environ; + Char *cp, *dp; Char *blk[2]; Char **oep = ep; @@ -1030,8 +1030,8 @@ Setenv(Char *name, Char *val) static void Unsetenv(Char *name) { - register Char **ep = STR_environ; - register Char *cp, *dp; + Char **ep = STR_environ; + Char *cp, *dp; Char **oep = ep; for (; *ep; ep++) { @@ -1054,8 +1054,8 @@ void /*ARGSUSED*/ doumask(Char **v, struct command *t) { - register Char *cp = v[1]; - register int i; + Char *cp = v[1]; + int i; if (cp == 0) { i = umask(0); @@ -1100,7 +1100,7 @@ static int setlim(struct limits *, Char, RLIM_TYPE); static struct limits * findlim(Char *cp) { - register struct limits *lp, *res; + struct limits *lp, *res; res = NULL; for (lp = limits; lp->limconst >= 0; lp++) @@ -1120,8 +1120,8 @@ void /*ARGSUSED*/ dolimit(Char **v, struct command *t) { - register struct limits *lp; - register RLIM_TYPE limit; + struct limits *lp; + RLIM_TYPE limit; char hard = 0; v++; @@ -1145,9 +1145,9 @@ dolimit(Char **v, struct command *t) } static RLIM_TYPE -getval(register struct limits *lp, Char **v) +getval(struct limits *lp, Char **v) { - register float f; + float f; double atof(); Char *cp = *v++; @@ -1224,7 +1224,7 @@ limtail(Char *cp, char *str) /*ARGSUSED*/ static void -plim(register struct limits *lp, Char hard) +plim(struct limits *lp, Char hard) { struct rlimit rlim; RLIM_TYPE limit; @@ -1248,7 +1248,7 @@ void /*ARGSUSED*/ dounlimit(Char **v, struct command *t) { - register struct limits *lp; + struct limits *lp; int lerr = 0; Char hard = 0; @@ -1273,7 +1273,7 @@ dounlimit(Char **v, struct command *t) } static int -setlim(register struct limits *lp, Char hard, RLIM_TYPE limit) +setlim(struct limits *lp, Char hard, RLIM_TYPE limit) { struct rlimit rlim; diff --git a/bin/csh/glob.c b/bin/csh/glob.c index 70b95ef0f89..d3c5fad1756 100644 --- a/bin/csh/glob.c +++ b/bin/csh/glob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glob.c,v 1.10 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: glob.c,v 1.11 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: glob.c,v 1.10 1995/03/21 09:03:01 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: glob.c,v 1.10 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: glob.c,v 1.11 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -93,8 +93,7 @@ static void backeval(Char *, bool); static Char * -globtilde(nv, s) - Char **nv, *s; +globtilde(Char **nv, Char *s) { Char gbuf[MAXPATHLEN], *gstart, *b, *u, *e; @@ -123,8 +122,7 @@ globtilde(nv, s) } static int -globbrace(s, p, bl) - Char *s, *p, ***bl; +globbrace(Char *s, Char *p, Char ***bl) { int i, len; Char *pm, *pe, *lm, *pl; @@ -215,9 +213,7 @@ globbrace(s, p, bl) static void -expbrace(nvp, elp, size) - Char ***nvp, ***elp; - int size; +expbrace(Char ***nvp, Char ***elp, int size) { Char **vl, **el, **nv, *s; @@ -281,8 +277,7 @@ expbrace(nvp, elp, size) } static Char ** -globexpand(v) - Char **v; +globexpand(Char **v) { Char *s; Char **nv, **vl, **el; @@ -345,9 +340,7 @@ globexpand(v) } static Char * -handleone(str, vl, action) - Char *str, **vl; - int action; +handleone(Char *str, Char **vl, int action) { Char *cp, **vlp = vl; @@ -382,8 +375,7 @@ handleone(str, vl, action) } static Char ** -libglob(vl) - Char **vl; +libglob(Char **vl) { int gflgs = GLOB_QUOTE | GLOB_NOMAGIC; glob_t globv; @@ -428,9 +420,7 @@ libglob(vl) } Char * -globone(str, action) - Char *str; - int action; +globone(Char *str, int action) { Char *v[2], **vl, **vo; int gflg; @@ -489,8 +479,7 @@ globone(str, action) } Char ** -globall(v) - Char **v; +globall(Char **v) { Char **vl, **vo; int gflg = gflag; @@ -524,7 +513,7 @@ globall(v) } void -ginit() +ginit(void) { gargsiz = GLOBSPACE; gargv = (Char **) xmalloc((size_t) sizeof(Char *) * gargsiz); @@ -533,11 +522,9 @@ ginit() } void -rscan(t, f) - register Char **t; - void (*f) (); +rscan(Char **t, void (*f)()) { - register Char *p; + Char *p; while ((p = *t++) != NULL) while (*p) @@ -545,10 +532,9 @@ rscan(t, f) } void -trim(t) - register Char **t; +trim(Char **t) { - register Char *p; + Char *p; while ((p = *t++) != NULL) while (*p) @@ -556,10 +542,9 @@ trim(t) } void -tglob(t) - register Char **t; +tglob(Char **t) { - register Char *p, c; + Char *p, c; while ((p = *t++) != NULL) { if (*p == '~' || *p == '=') @@ -599,11 +584,9 @@ tglob(t) * words only at newlines. */ Char ** -dobackp(cp, literal) - Char *cp; - bool literal; +dobackp(Char *cp, bool literal) { - register Char *lp, *rp; + Char *lp, *rp; Char *ep, word[MAXPATHLEN]; if (pargv) { @@ -644,12 +627,10 @@ dobackp(cp, literal) } static void -backeval(cp, literal) - Char *cp; - bool literal; +backeval(Char *cp, bool literal) { - register int icnt, c; - register Char *ip; + int icnt, c; + Char *ip; struct command faket; bool hadnl; int pvec[2], quoted; @@ -782,8 +763,7 @@ backeval(cp, literal) } static void -psave(c) - int c; +psave(int c) { if (--pnleft <= 0) stderror(ERR_WTOOLONG); @@ -791,7 +771,7 @@ psave(c) } static void -pword() +pword(void) { psave(0); if (pargc == pargsiz - 1) { @@ -806,8 +786,7 @@ pword() } int -Gmatch(string, pattern) - Char *string, *pattern; +Gmatch(Char *string, Char *pattern) { Char **blk, **p; int gpol = 1, gres = 0; @@ -831,10 +810,9 @@ Gmatch(string, pattern) } static int -pmatch(string, pattern) - register Char *string, *pattern; +pmatch(Char *string, Char *pattern) { - register Char stringc, patternc; + Char stringc, patternc; int match, negate_range; Char rangec; @@ -887,10 +865,9 @@ pmatch(string, pattern) } void -Gcat(s1, s2) - Char *s1, *s2; +Gcat(Char *s1, Char *s2) { - register Char *p, *q; + Char *p, *q; int n; for (p = s1; *p++;) @@ -913,8 +890,7 @@ Gcat(s1, s2) #ifdef FILEC int -sortscmp(a, b) - register const ptr_t a, b; +sortscmp(ptr_t a, ptr_t b) { #if defined(NLS) && !defined(NOSTRCOLL) char buf[2048]; diff --git a/bin/csh/hist.c b/bin/csh/hist.c index 8fe1a008615..ba251d91e40 100644 --- a/bin/csh/hist.c +++ b/bin/csh/hist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hist.c,v 1.6 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: hist.c,v 1.7 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: hist.c,v 1.7 1995/03/21 18:35:44 mycroft Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: hist.c,v 1.6 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: hist.c,v 1.7 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -50,11 +50,10 @@ static void dohist1(struct Hist *, int *, int, int); static void phist(struct Hist *, int); void -savehist(sp) - struct wordent *sp; +savehist(struct wordent *sp) { - register struct Hist *hp, *np; - register int histlen = 0; + struct Hist *hp, *np; + int histlen = 0; Char *cp; /* throw away null lines */ @@ -62,7 +61,7 @@ savehist(sp) return; cp = value(STRhistory); if (*cp) { - register Char *p = cp; + Char *p = cp; while (*p) { if (!Isdigit(*p)) { @@ -81,12 +80,9 @@ savehist(sp) } struct Hist * -enthist(event, lp, docopy) - int event; - register struct wordent *lp; - bool docopy; +enthist(int event, struct wordent *lp, bool docopy) { - register struct Hist *np; + struct Hist *np; np = (struct Hist *) xmalloc((size_t) sizeof(*np)); np->Hnum = np->Href = event; @@ -105,8 +101,7 @@ enthist(event, lp, docopy) } static void -hfree(hp) - register struct Hist *hp; +hfree(struct Hist *hp) { freelex(&hp->Hlex); @@ -115,9 +110,7 @@ hfree(hp) void /*ARGSUSED*/ -dohist(v, t) - Char **v; - struct command *t; +dohist(Char **v, struct command *t) { int n, rflg = 0, hflg = 0; sigset_t sigset; @@ -156,9 +149,7 @@ dohist(v, t) } static void -dohist1(hp, np, rflg, hflg) - struct Hist *hp; - int *np, rflg, hflg; +dohist1(struct Hist *hp, int *np, int rflg, int hflg) { bool print = (*np) > 0; @@ -177,9 +168,7 @@ dohist1(hp, np, rflg, hflg) } static void -phist(hp, hflg) - register struct Hist *hp; - int hflg; +phist(struct Hist *hp, int hflg) { if (hflg == 0) (void) fprintf(cshout, "%6d\t", hp->Hnum); diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 18f9695406d..2305e9e705a 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.11 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: lex.c,v 1.12 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: lex.c,v 1.11 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: lex.c,v 1.12 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -138,10 +138,9 @@ static Char getCtmp; #define ungetD(c) peekd = c int -lex(hp) - register struct wordent *hp; +lex(struct wordent *hp) { - register struct wordent *wdp; + struct wordent *wdp; int c; btell(&lineloc); @@ -162,7 +161,7 @@ lex(hp) * be ready and rarin to go even if it is interrupted. */ do { - register struct wordent *new; + struct wordent *new; new = (struct wordent *) xmalloc((size_t) sizeof(*wdp)); new->word = 0; @@ -177,11 +176,9 @@ lex(hp) } void -prlex(fp, sp0) - FILE *fp; - struct wordent *sp0; +prlex(FILE *fp, struct wordent *sp0) { - register struct wordent *sp = sp0->next; + struct wordent *sp = sp0->next; for (;;) { (void) fprintf(fp, "%s", vis_str(sp->word)); @@ -194,16 +191,14 @@ prlex(fp, sp0) } void -copylex(hp, fp) - register struct wordent *hp; - register struct wordent *fp; +copylex(struct wordent *hp, struct wordent *fp) { - register struct wordent *wdp; + struct wordent *wdp; wdp = hp; fp = fp->next; do { - register struct wordent *new; + struct wordent *new; new = (struct wordent *) xmalloc((size_t) sizeof(*wdp)); new->prev = wdp; @@ -217,10 +212,9 @@ copylex(hp, fp) } void -freelex(vp) - register struct wordent *vp; +freelex(struct wordent *vp) { - register struct wordent *fp; + struct wordent *fp; while (vp->next != vp) { fp = vp->next; @@ -232,13 +226,13 @@ freelex(vp) } static Char * -word() +word(void) { - register Char c, c1; - register Char *wp; + Char c, c1; + Char *wp; Char wbuf[BUFSIZ]; - register bool dolflg; - register int i; + bool dolflg; + int i; wp = wbuf; i = BUFSIZ - 4; @@ -354,10 +348,9 @@ ret: } static int -getC1(flag) - register int flag; +getC1(int flag) { - register Char c; + Char c; while (1) { if ((c = peekc) != '\0') { @@ -411,11 +404,11 @@ getC1(flag) } static void -getdol() +getdol(void) { - register Char *np, *ep; + Char *np, *ep; Char name[4 * MAXVARLEN + 1]; - register int c; + int c; int sc; bool special = 0, toolong; @@ -620,8 +613,7 @@ getdol() } void -addla(cp) - Char *cp; +addla(Char *cp) { Char buf[BUFSIZ]; @@ -644,12 +636,11 @@ static Char rhsb[64]; static int quesarg; static void -getexcl(sc) - int sc; +getexcl(int sc) { - register struct wordent *hp, *ip; + struct wordent *hp, *ip; int left, right, dol; - register int c; + int c; if (sc == 0) { sc = getC(0); @@ -721,12 +712,11 @@ subst: } static struct wordent * -getsub(en) - struct wordent *en; +getsub(struct wordent *en) { - register Char *cp; + Char *cp; int delim; - register int c; + int c; int sc; bool global; Char orhsb[sizeof(rhsb) / sizeof(Char)]; @@ -851,20 +841,17 @@ getsub(en) } static struct wordent * -dosub(sc, en, global) - int sc; - struct wordent *en; - bool global; +dosub(int sc, struct wordent *en, bool global) { struct wordent lexi; bool didsub = 0, didone = 0; struct wordent *hp = &lexi; - register struct wordent *wdp; - register int i = exclc; + struct wordent *wdp; + int i = exclc; wdp = hp; while (--i >= 0) { - register struct wordent *new = + struct wordent *new = (struct wordent *) xcalloc(1, sizeof *wdp); new->word = 0; @@ -905,14 +892,11 @@ dosub(sc, en, global) } static Char * -subword(cp, type, adid) - Char *cp; - int type; - bool *adid; +subword(Char *cp, int type, bool *adid) { Char wbuf[BUFSIZ]; - register Char *wp, *mp, *np; - register int i; + Char *wp, *mp, *np; + int i; *adid = 0; switch (type) { @@ -981,12 +965,10 @@ subword(cp, type, adid) } Char * -domod(cp, type) - Char *cp; - int type; +domod(Char *cp, int type) { - register Char *wp, *xp; - register int c; + Char *wp, *xp; + int c; switch (type) { @@ -1030,8 +1012,7 @@ domod(cp, type) } static int -matchs(str, pat) - register Char *str, *pat; +matchs(Char *str, Char *pat) { while (*str && *pat && *str == *pat) str++, pat++; @@ -1039,12 +1020,10 @@ matchs(str, pat) } static int -getsel(al, ar, dol) - register int *al, *ar; - int dol; +getsel(int *al, int *ar, int dol) { - register int c = getC(0); - register int i; + int c = getC(0); + int i; bool first = *al < 0; switch (c) { @@ -1125,12 +1104,11 @@ getsel(al, ar, dol) } static struct wordent * -gethent(sc) - int sc; +gethent(int sc) { - register struct Hist *hp; - register Char *np; - register int c; + struct Hist *hp; + Char *np; + int c; int event; bool back = 0; @@ -1243,16 +1221,14 @@ gethent(sc) } static struct Hist * -findev(cp, anyarg) - Char *cp; - bool anyarg; +findev(Char *cp, bool anyarg) { - register struct Hist *hp; + struct Hist *hp; for (hp = Histlist.Hnext; hp; hp = hp->Hnext) { Char *dp; - register Char *p, *q; - register struct wordent *lp = hp->Hlex.next; + Char *p, *q; + struct wordent *lp = hp->Hlex.next; int argno = 0; /* @@ -1295,8 +1271,7 @@ findev(cp, anyarg) static void -setexclp(cp) - register Char *cp; +setexclp(Char *cp) { if (cp && cp[0] == '\n') return; @@ -1304,17 +1279,15 @@ setexclp(cp) } void -unreadc(c) - int c; +unreadc(int c) { peekread = c; } int -readc(wanteof) - bool wanteof; +readc(bool wanteof) { - register int c; + int c; static int sincereal; aret = F_SEEK; @@ -1427,12 +1400,12 @@ reread: } static int -bgetc() +bgetc(void) { - register int buf, off, c; + int buf, off, c; #ifdef FILEC - register int numleft = 0, roomleft; + int numleft = 0, roomleft; Char ttyline[BUFSIZ]; #endif char tbuf[BUFSIZ + 1]; @@ -1463,7 +1436,7 @@ bgetc() again: buf = (int) fseekp / BUFSIZ; if (buf >= fblocks) { - register Char **nfbuf = + Char **nfbuf = (Char **) xcalloc((size_t) (fblocks + 2), sizeof(Char **)); @@ -1536,9 +1509,9 @@ again: } static void -bfree() +bfree(void) { - register int sb, i; + int sb, i; if (cantell) return; @@ -1556,8 +1529,7 @@ bfree() } void -bseek(l) - struct Ain *l; +bseek(struct Ain *l) { switch (aret = l->type) { case E_SEEK: @@ -1578,8 +1550,7 @@ bseek(l) } void -btell(l) - struct Ain *l; +btell(struct Ain *l) { switch (l->type = aret) { case E_SEEK: @@ -1601,7 +1572,7 @@ btell(l) } void -btoeof() +btoeof(void) { (void) lseek(SHIN, (off_t) 0, SEEK_END); aret = F_SEEK; @@ -1615,7 +1586,7 @@ btoeof() } void -settell() +settell(void) { cantell = 0; if (arginp || onelflg || intty) diff --git a/bin/csh/misc.c b/bin/csh/misc.c index 0323d83d8ab..3822a81de31 100644 --- a/bin/csh/misc.c +++ b/bin/csh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.8 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.9 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/03/21 09:03:09 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.8 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.9 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -49,9 +49,7 @@ static char rcsid[] = "$OpenBSD: misc.c,v 1.8 2003/06/02 23:32:07 millert Exp $" static int renum(int, int); int -any(s, c) - register char *s; - register int c; +any(char *s, int c) { if (!s) return (0); /* Check for nil pointer */ @@ -62,9 +60,7 @@ any(s, c) } void -setzero(cp, i) - char *cp; - int i; +setzero(char *cp, int i) { if (i != 0) do @@ -73,11 +69,10 @@ setzero(cp, i) } char * -strsave(s) - register char *s; +strsave(char *s) { char *n; - register char *p; + char *p; if (s == NULL) s = ""; @@ -90,8 +85,7 @@ strsave(s) } Char ** -blkend(up) - register Char **up; +blkend(Char **up) { while (*up) @@ -101,9 +95,7 @@ blkend(up) void -blkpr(fp, av) - FILE *fp; - register Char **av; +blkpr(FILE *fp, Char **av) { for (; *av; av++) { @@ -114,10 +106,9 @@ blkpr(fp, av) } int -blklen(av) - register Char **av; +blklen(Char **av) { - register int i = 0; + int i = 0; while (*av++) i++; @@ -125,11 +116,9 @@ blklen(av) } Char ** -blkcpy(oav, bv) - Char **oav; - register Char **bv; +blkcpy(Char **oav, Char **bv) { - register Char **av = oav; + Char **av = oav; while ((*av++ = *bv++) != NULL) continue; @@ -137,8 +126,7 @@ blkcpy(oav, bv) } Char ** -blkcat(up, vp) - Char **up, **vp; +blkcat(Char **up, Char **vp) { (void) blkcpy(blkend(up), vp); @@ -146,10 +134,9 @@ blkcat(up, vp) } void -blkfree(av0) - Char **av0; +blkfree(Char **av0) { - register Char **av = av0; + Char **av = av0; if (!av0) return; @@ -159,10 +146,9 @@ blkfree(av0) } Char ** -saveblk(v) - register Char **v; +saveblk(Char **v) { - register Char **newv = + Char **newv = (Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **)); Char **onewv = newv; @@ -173,12 +159,11 @@ saveblk(v) #ifdef NOTUSED char * -strstr(s, t) - register char *s, *t; +strstr(char *s, char *t) { do { - register char *ss = s; - register char *tt = t; + char *ss = s; + char *tt = t; do if (*tt == '\0') @@ -192,11 +177,10 @@ strstr(s, t) #ifndef SHORT_STRINGS char * -strspl(cp, dp) - char *cp, *dp; +strspl(char *cp, char *dp) { char *ep; - register char *p, *q; + char *p, *q; if (!cp) cp = ""; @@ -217,10 +201,9 @@ strspl(cp, dp) #endif Char ** -blkspl(up, vp) - register Char **up, **vp; +blkspl(Char **up, Char **vp) { - register Char **wp = + Char **wp = (Char **) xcalloc((size_t) (blklen(up) + blklen(vp) + 1), sizeof(Char **)); @@ -229,8 +212,7 @@ blkspl(up, vp) } Char -lastchr(cp) - register Char *cp; +lastchr(Char *cp) { if (!cp) @@ -247,9 +229,9 @@ lastchr(cp) * any units which may have been left open accidentally. */ void -closem() +closem(void) { - register int f; + int f; for (f = 0; f < sysconf(_SC_OPEN_MAX); f++) if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD && @@ -258,7 +240,7 @@ closem() } void -donefds() +donefds(void) { (void) close(0); (void) close(1); @@ -273,8 +255,7 @@ donefds() * i.e. to a unit > 2. This also happens in dcopy. */ int -dmove(i, j) - register int i, j; +dmove(int i, int j) { if (i == j || i < 0) @@ -292,8 +273,7 @@ dmove(i, j) } int -dcopy(i, j) - register int i, j; +dcopy(int i, int j) { if (i == j || i < 0 || (j < 0 && i > 2)) @@ -307,10 +287,9 @@ dcopy(i, j) } static int -renum(i, j) - register int i, j; +renum(int i, int j) { - register int k = dup(i); + int k = dup(i); if (k < 0) return (-1); @@ -330,11 +309,9 @@ renum(i, j) * as well as by commands like "repeat". */ void -lshift(v, c) - register Char **v; - register int c; +lshift(Char **v, int c) { - register Char **u; + Char **u; for (u = v; *u && --c >= 0; u++) xfree((ptr_t) *u); @@ -342,8 +319,7 @@ lshift(v, c) } int -number(cp) - Char *cp; +number(Char *cp) { if (!cp) return(0); @@ -359,8 +335,7 @@ number(cp) } Char ** -copyblk(v) - register Char **v; +copyblk(Char **v) { Char **nv = (Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **)); @@ -369,8 +344,7 @@ copyblk(v) #ifndef SHORT_STRINGS char * -strend(cp) - register char *cp; +strend(char *cp) { if (!cp) return (cp); @@ -382,10 +356,9 @@ strend(cp) #endif /* SHORT_STRINGS */ Char * -strip(cp) - Char *cp; +strip(Char *cp) { - register Char *dp = cp; + Char *dp = cp; if (!cp) return (cp); @@ -395,10 +368,9 @@ strip(cp) } Char * -quote(cp) - Char *cp; +quote(Char *cp) { - register Char *dp = cp; + Char *dp = cp; if (!cp) return (cp); @@ -408,8 +380,7 @@ quote(cp) } void -udvar(name) - Char *name; +udvar(Char *name) { setname(vis_str(name)); @@ -417,8 +388,7 @@ udvar(name) } int -prefix(sub, str) - register Char *sub, *str; +prefix(Char *sub, Char *str) { for (;;) { diff --git a/bin/csh/parse.c b/bin/csh/parse.c index 58587a56c54..a64c699cc6f 100644 --- a/bin/csh/parse.c +++ b/bin/csh/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.7 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: parse.c,v 1.8 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: parse.c,v 1.6 1995/03/21 09:03:10 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: parse.c,v 1.7 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: parse.c,v 1.8 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -75,8 +75,7 @@ static struct command static int aleft; extern int hleft; void -alias(lex) - register struct wordent *lex; +alias(struct wordent *lex) { jmp_buf osetexit; @@ -95,8 +94,7 @@ alias(lex) } static void -asyntax(p1, p2) - register struct wordent *p1, *p2; +asyntax(struct wordent *p1, struct wordent *p2) { while (p1 != p2) if (any(";&\n", p1->word[0])) @@ -108,12 +106,10 @@ asyntax(p1, p2) } static void -asyn0(p1, p2) - struct wordent *p1; - register struct wordent *p2; +asyn0(struct wordent *p1, struct wordent *p2) { - register struct wordent *p; - register int l = 0; + struct wordent *p; + int l = 0; for (p = p1; p != p2; p = p->next) switch (p->word[0]) { @@ -148,13 +144,11 @@ asyn0(p1, p2) } static void -asyn3(p1, p2) - struct wordent *p1; - register struct wordent *p2; +asyn3(struct wordent *p1, struct wordent *p2) { - register struct varent *ap; + struct varent *ap; struct wordent alout; - register bool redid; + bool redid; if (p1 == p2) return; @@ -199,10 +193,9 @@ asyn3(p1, p2) } static struct wordent * -freenod(p1, p2) - register struct wordent *p1, *p2; +freenod(struct wordent *p1, struct wordent *p2) { - register struct wordent *retp = p1->prev; + struct wordent *retp = p1->prev; while (p1 != p2) { xfree((ptr_t) p1->word); @@ -225,9 +218,7 @@ freenod(p1, p2) * syn0 */ struct command * -syntax(p1, p2, flags) - register struct wordent *p1, *p2; - int flags; +syntax(struct wordent *p1, struct wordent *p2, int flags) { while (p1 != p2) @@ -244,12 +235,10 @@ syntax(p1, p2, flags) * syn1 & syntax */ static struct command * -syn0(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn0(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p; - register struct command *t, *t1; + struct wordent *p; + struct command *t, *t1; int l; l = 0; @@ -312,12 +301,10 @@ syn0(p1, p2, flags) * syn1a ; syntax */ static struct command * -syn1(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn1(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p; - register struct command *t; + struct wordent *p; + struct command *t; int l; l = 0; @@ -353,13 +340,11 @@ syn1(p1, p2, flags) * syn1b || syn1a */ static struct command * -syn1a(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn1a(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p; - register struct command *t; - register int l = 0; + struct wordent *p; + struct command *t; + int l = 0; for (p = p1; p != p2; p = p->next) switch (p->word[0]) { @@ -394,13 +379,11 @@ syn1a(p1, p2, flags) * syn2 && syn1b */ static struct command * -syn1b(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn1b(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p; - register struct command *t; - register int l = 0; + struct wordent *p; + struct command *t; + int l = 0; for (p = p1; p != p2; p = p->next) switch (p->word[0]) { @@ -434,13 +417,11 @@ syn1b(p1, p2, flags) * syn3 |& syn2 */ static struct command * -syn2(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn2(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p, *pn; - register struct command *t; - register int l = 0; + struct wordent *p, *pn; + struct command *t; + int l = 0; int f; for (p = p1; p != p2; p = p->next) @@ -485,14 +466,12 @@ static char RELPAR[] = {'<', '>', '(', ')', '\0'}; * KEYWORD = (@ exit foreach if set switch test while) */ static struct command * -syn3(p1, p2, flags) - struct wordent *p1, *p2; - int flags; +syn3(struct wordent *p1, struct wordent *p2, int flags) { - register struct wordent *p; + struct wordent *p; struct wordent *lp, *rp; - register struct command *t; - register int l; + struct command *t; + int l; Char **av; int n, c; bool specp = 0; @@ -664,10 +643,9 @@ again: } void -freesyn(t) - register struct command *t; +freesyn(struct command *t) { - register Char **v; + Char **v; if (t == 0) return; diff --git a/bin/csh/printf.c b/bin/csh/printf.c index f903c9e05a4..2a25b034ce7 100644 --- a/bin/csh/printf.c +++ b/bin/csh/printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printf.c,v 1.13 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: printf.c,v 1.14 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: printf.c,v 1.6 1995/03/21 09:03:15 cgd Exp $ */ /* @@ -42,7 +42,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93"; #else -static char rcsid[] = "$OpenBSD: printf.c,v 1.13 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: printf.c,v 1.14 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -85,12 +85,10 @@ static char **gargv; int #ifdef BUILTIN -progprintf(argc, argv) +progprintf(int argc, char *argv[]) #else -main(argc, argv) +main(int argc, char *argv[]) #endif - int argc; - char *argv[]; { static char *skip1, *skip2; int ch, end, fieldwidth, precision; @@ -222,9 +220,7 @@ next: for (start = fmt;; ++fmt) { } static char * -mklong(str, ch) - char *str; - int ch; +mklong(char *str, int ch) { static char *copy; static int copysize; @@ -252,11 +248,10 @@ mklong(str, ch) } static void -escape(fmt) - register char *fmt; +escape(char *fmt) { - register char *store; - register int value, c; + char *store; + int value, c; for (store = fmt; (c = *fmt) != 0; ++fmt, ++store) { if (c != '\\') { @@ -316,7 +311,7 @@ escape(fmt) } static int -getchr() +getchr(void) { if (!*gargv) return ('\0'); @@ -324,7 +319,7 @@ getchr() } static char * -getstr() +getstr(void) { if (!*gargv) return (""); @@ -333,8 +328,7 @@ getstr() static char *Number = "+-.0123456789"; static int -getint(ip) - int *ip; +getint(int *ip) { long val; @@ -349,8 +343,7 @@ getint(ip) } static int -getlong(lp) - long *lp; +getlong(long *lp) { long val; char *ep; @@ -385,7 +378,7 @@ getlong(lp) } static double -getdouble() +getdouble(void) { if (!*gargv) return ((double)0); @@ -395,9 +388,9 @@ getdouble() } static int -asciicode() +asciicode(void) { - register int ch; + int ch; ch = **gargv; if (ch == '\'' || ch == '"') @@ -407,7 +400,7 @@ asciicode() } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: printf format [arg ...]\n"); } diff --git a/bin/csh/proc.c b/bin/csh/proc.c index 12a66a1073e..475f23f8a20 100644 --- a/bin/csh/proc.c +++ b/bin/csh/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.18 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: proc.c,v 1.19 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: proc.c,v 1.18 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: proc.c,v 1.19 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -76,12 +76,11 @@ static void okpcntl(void); */ /* ARGUSED */ void -pchild(notused) - int notused; +pchild(int notused) { - register struct process *pp; - register struct process *fp; - register int pid; + struct process *pp; + struct process *fp; + int pid; extern int insource; int save_errno = errno; union wait w; @@ -198,9 +197,9 @@ found: } void -pnote() +pnote(void) { - register struct process *pp; + struct process *pp; int flags; sigset_t sigset, osigset; @@ -224,9 +223,9 @@ pnote() * of current and previous job indicators. */ void -pwait() +pwait(void) { - register struct process *fp, *pp; + struct process *fp, *pp; sigset_t sigset, osigset; /* @@ -255,10 +254,9 @@ pwait() * It is assumed to be in the foreground state (PFOREGND) */ void -pjwait(pp) - register struct process *pp; +pjwait(struct process *pp) { - register struct process *fp; + struct process *fp; int jobflags, reason; sigset_t sigset, osigset; @@ -350,11 +348,9 @@ pjwait(pp) */ void /*ARGSUSED*/ -dowait(v, t) - Char **v; - struct command *t; +dowait(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; sigset_t sigset, osigset; pjobs++; @@ -377,9 +373,9 @@ loop: * pflushall - flush all jobs from list (e.g. at fork()) */ static void -pflushall() +pflushall(void) { - register struct process *pp; + struct process *pp; for (pp = proclist.p_next; pp != NULL; pp = pp->p_next) if (pp->p_pid) @@ -392,11 +388,10 @@ pflushall() * space is not done here since pflush is called at interrupt level. */ static void -pflush(pp) - register struct process *pp; +pflush(struct process *pp) { - register struct process *np; - register int idx; + struct process *np; + int idx; if (pp->p_pid == 0) { (void) fprintf(csherr, "BUG: process flushed twice"); @@ -426,8 +421,7 @@ pflush(pp) * pp MUST be the job leader */ static void -pclrcurr(pp) - register struct process *pp; +pclrcurr(struct process *pp) { if (pp == pcurrent) @@ -453,11 +447,9 @@ static Char *cmdp; * an important assumption is made that the process is running. */ void -palloc(pid, t) - int pid; - register struct command *t; +palloc(int pid, struct command *t) { - register struct process *pp; + struct process *pp; int i; pp = (struct process *) xcalloc(1, (size_t) sizeof(struct process)); @@ -520,8 +512,7 @@ palloc(pid, t) } static void -padd(t) - register struct command *t; +padd(struct command *t) { Char **argp; @@ -579,10 +570,9 @@ padd(t) } static void -pads(cp) - Char *cp; +pads(Char *cp) { - register int i; + int i; /* * Avoid the Quoted Space alias hack! Reported by: @@ -612,7 +602,7 @@ pads(cp) * and `` in globbing. */ void -psavejob() +psavejob(void) { pholdjob = pcurrjob; @@ -624,7 +614,7 @@ psavejob() * somewhere, but pendjob cleans up anyway. */ void -prestjob() +prestjob(void) { pcurrjob = pholdjob; @@ -636,9 +626,9 @@ prestjob() * or is about to begin. */ void -pendjob() +pendjob(void) { - register struct process *pp, *tp; + struct process *pp, *tp; if (pcurrjob && (pcurrjob->p_flags & (PFOREGND | PSTOPPED)) == 0) { pp = pcurrjob; @@ -659,11 +649,9 @@ pendjob() * pprint - print a job */ static int -pprint(pp, flag) - register struct process *pp; - bool flag; +pprint(struct process *pp, bool flag) { - register int status, reason; + int status, reason; struct process *tp; int jobflags, pstatus; bool hadnl = 1; /* did we just have a newline */ @@ -825,14 +813,13 @@ prcomd: } static void -ptprint(tp) - register struct process *tp; +ptprint(struct process *tp) { struct timeval tetime, diff; static struct timeval ztime; struct rusage ru; static struct rusage zru; - register struct process *pp = tp; + struct process *pp = tp; ru = zru; tetime = ztime; @@ -850,12 +837,10 @@ ptprint(tp) */ void /*ARGSUSED*/ -dojobs(v, t) - Char **v; - struct command *t; +dojobs(Char **v, struct command *t) { - register struct process *pp; - register int flag = NUMBER | NAME | REASON; + struct process *pp; + int flag = NUMBER | NAME | REASON; int i; if (chkstop) @@ -880,11 +865,9 @@ dojobs(v, t) */ void /*ARGSUSED*/ -dofg(v, t) - Char **v; - struct command *t; +dofg(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; okpcntl(); ++v; @@ -900,11 +883,9 @@ dofg(v, t) */ void /*ARGSUSED*/ -dofg1(v, t) - Char **v; - struct command *t; +dofg1(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; okpcntl(); pp = pfind(v[0]); @@ -917,11 +898,9 @@ dofg1(v, t) */ void /*ARGSUSED*/ -dobg(v, t) - Char **v; - struct command *t; +dobg(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; okpcntl(); ++v; @@ -936,11 +915,9 @@ dobg(v, t) */ void /*ARGSUSED*/ -dobg1(v, t) - Char **v; - struct command *t; +dobg1(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; pp = pfind(v[0]); pstart(pp, 0); @@ -951,9 +928,7 @@ dobg1(v, t) */ void /*ARGSUSED*/ -dostop(v, t) - Char **v; - struct command *t; +dostop(Char **v, struct command *t) { pkill(++v, SIGSTOP); } @@ -963,12 +938,10 @@ dostop(v, t) */ void /*ARGSUSED*/ -dokill(v, t) - Char **v; - struct command *t; +dokill(Char **v, struct command *t) { - register int signum = SIGTERM; - register char *name; + int signum = SIGTERM; + char *name; v++; if (v[0] && v[0][0] == '-') { @@ -1033,12 +1006,10 @@ dokill(v, t) } static void -pkill(v, signum) - Char **v; - int signum; +pkill(Char **v, int signum) { - register struct process *pp, *np; - register int jobflags = 0; + struct process *pp, *np; + int jobflags = 0; int pid, err1 = 0; sigset_t sigset; Char *cp; @@ -1128,11 +1099,9 @@ cont: * pstart - start the job in foreground/background */ void -pstart(pp, foregnd) - register struct process *pp; - int foregnd; +pstart(struct process *pp, int foregnd) { - register struct process *np; + struct process *np; sigset_t sigset, osigset; long jobflags = 0; @@ -1162,10 +1131,9 @@ pstart(pp, foregnd) } void -panystop(neednl) - bool neednl; +panystop(bool neednl) { - register struct process *pp; + struct process *pp; chkstop = 2; for (pp = proclist.p_next; pp; pp = pp->p_next) @@ -1174,10 +1142,9 @@ panystop(neednl) } struct process * -pfind(cp) - Char *cp; +pfind(Char *cp) { - register struct process *pp, *np; + struct process *pp, *np; if (cp == 0 || cp[1] == 0 || eq(cp, STRcent2) || eq(cp, STRcentplus)) { if (pcurrent == NULL) @@ -1201,7 +1168,7 @@ pfind(cp) for (pp = proclist.p_next; pp; pp = pp->p_next) if (pp->p_pid == pp->p_jobid) { if (cp[1] == '?') { - register Char *dp; + Char *dp; for (dp = pp->p_command; *dp; dp++) { if (*dp != cp[2]) @@ -1229,11 +1196,10 @@ pfind(cp) * pgetcurr - find most recent job that is not pp, preferably stopped */ static struct process * -pgetcurr(pp) - register struct process *pp; +pgetcurr(struct process *pp) { - register struct process *np; - register struct process *xp = NULL; + struct process *np; + struct process *xp = NULL; for (np = proclist.p_next; np; np = np->p_next) if (np != pcurrent && np != pp && np->p_pid && @@ -1251,11 +1217,9 @@ pgetcurr(pp) */ void /*ARGSUSED*/ -donotify(v, t) - Char **v; - struct command *t; +donotify(Char **v, struct command *t) { - register struct process *pp; + struct process *pp; pp = pfind(*++v); pp->p_flags |= PNOTIFY; @@ -1274,11 +1238,9 @@ donotify(v, t) */ int -pfork(t, wanttty) - struct command *t; /* command we are forking for */ - int wanttty; +pfork(struct command *t, int wanttty) { - register int pid; + int pid; bool ignint = 0; int pgrp; sigset_t sigset, osigset; @@ -1360,7 +1322,7 @@ pfork(t, wanttty) } static void -okpcntl() +okpcntl(void) { if (tpgrp == -1) stderror(ERR_JOBCONTROL); @@ -1377,8 +1339,7 @@ okpcntl() * I am open to suggestions how to fix that. */ void -pgetty(wanttty, pgrp) - int wanttty, pgrp; +pgetty(int wanttty, int pgrp) { sigset_t sigset, osigset; diff --git a/bin/csh/sem.c b/bin/csh/sem.c index e53650b03eb..7a353334f42 100644 --- a/bin/csh/sem.c +++ b/bin/csh/sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sem.c,v 1.14 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: sem.c,v 1.15 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: sem.c,v 1.9 1995/09/27 00:38:50 jtc Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: sem.c,v 1.14 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: sem.c,v 1.15 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -58,9 +58,7 @@ static void doio(struct command *t, int *, int *); static void chkclob(char *); void -execute(t, wanttty, pipein, pipeout) - register struct command *t; - int wanttty, *pipein, *pipeout; +execute(struct command *t, int wanttty, int *pipein, int *pipeout) { bool forked = 0; struct biltins *bifunc; @@ -456,8 +454,7 @@ execute(t, wanttty, pipein, pipeout) } static void -vffree(i) -int i; +vffree(int i) { _exit(i); } @@ -478,9 +475,7 @@ int i; * code is present and the user can choose it by setting noambiguous */ static Char * -splicepipe(t, cp) - register struct command *t; - Char *cp; /* word after < or > */ +splicepipe(struct command *t, Char *cp) /* word after < or > */ { Char *blk[2]; @@ -521,13 +516,11 @@ splicepipe(t, cp) * We may or maynot be forked here. */ static void -doio(t, pipein, pipeout) - register struct command *t; - int *pipein, *pipeout; +doio(struct command *t, int *pipein, int *pipeout) { - register int fd; - register Char *cp; - register int flags = t->t_dflg; + int fd; + Char *cp; + int flags = t->t_dflg; if (didfds || (flags & F_REPEAT)) return; @@ -615,8 +608,7 @@ doio(t, pipein, pipeout) } void -mypipe(pv) - register int *pv; +mypipe(int *pv) { if (pipe(pv) < 0) @@ -630,8 +622,7 @@ oops: } static void -chkclob(cp) - register char *cp; +chkclob(char *cp) { struct stat stb; diff --git a/bin/csh/set.c b/bin/csh/set.c index a76a272c0eb..a08a0a625ae 100644 --- a/bin/csh/set.c +++ b/bin/csh/set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: set.c,v 1.9 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: set.c,v 1.10 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: set.c,v 1.8 1995/03/21 18:35:52 mycroft Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: set.c,v 1.9 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: set.c,v 1.10 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -68,11 +68,9 @@ static void balance(struct varent *, int, int); void /*ARGSUSED*/ -doset(v, t) - Char **v; - struct command *t; +doset(Char **v, struct command *t) { - register Char *p; + Char *p; Char *vp, op; Char **vecp; bool hadsub; @@ -113,7 +111,7 @@ doset(v, t) if (op && op != '=') stderror(ERR_NAME | ERR_SYNTAX); if (eq(p, STRLparen)) { - register Char **e = v; + Char **e = v; if (hadsub) stderror(ERR_NAME | ERR_SYNTAX); @@ -140,7 +138,7 @@ doset(v, t) dohash(NULL, NULL); } else if (eq(vp, STRhistchars)) { - register Char *pn = value(STRhistchars); + Char *pn = value(STRhistchars); HIST = *pn++; HISTSUB = *pn; @@ -155,7 +153,7 @@ doset(v, t) else if (eq(vp, STRterm)) Setenv(STRTERM, value(vp)); else if (eq(vp, STRhome)) { - register Char *cp; + Char *cp; cp = Strsave(value(vp)); /* get the old value back */ @@ -180,9 +178,7 @@ doset(v, t) } static Char * -getinx(cp, ip) - register Char *cp; - register int *ip; +getinx(Char *cp, int *ip) { *ip = 0; @@ -195,23 +191,18 @@ getinx(cp, ip) } static void -asx(vp, subscr, p) - Char *vp; - int subscr; - Char *p; +asx(Char *vp, int subscr, Char *p) { - register struct varent *v = getvx(vp, subscr); + struct varent *v = getvx(vp, subscr); xfree((ptr_t) v->vec[subscr - 1]); v->vec[subscr - 1] = globone(p, G_APPEND); } static struct varent * -getvx(vp, subscr) - Char *vp; - int subscr; +getvx(Char *vp, int subscr) { - register struct varent *v = adrof(vp); + struct varent *v = adrof(vp); if (v == 0) udvar(vp); @@ -222,11 +213,9 @@ getvx(vp, subscr) void /*ARGSUSED*/ -dolet(v, t) - Char **v; - struct command *t; +dolet(Char **v, struct command *t) { - register Char *p; + Char *p; Char *vp, c, op; bool hadsub; int subscr; @@ -308,10 +297,9 @@ dolet(v, t) } static Char * -xset(cp, vp) - Char *cp, ***vp; +xset(Char *cp, Char ***vp) { - register Char *dp; + Char *dp; if (*cp) { dp = Strsave(cp); @@ -323,15 +311,13 @@ xset(cp, vp) } static Char * -operate(op, vp, p) - int op; - Char *vp, *p; +operate(int op, Char *vp, Char *p) { Char opr[2]; Char *vec[5]; - register Char **v = vec; + Char **v = vec; Char **vecp = v; - register int i; + int i; if (op != '=') { if (*vp) @@ -353,8 +339,7 @@ operate(op, vp, p) static Char *putp; Char * -putn(n) - register int n; +putn(int n) { int num; static Char number[15]; @@ -386,8 +371,7 @@ putn(n) } static void -putn1(n) - register int n; +putn1(int n) { if (n > 9) putn1(n / 10); @@ -395,10 +379,9 @@ putn1(n) } int -getn(cp) - register Char *cp; +getn(Char *cp) { - register int n; + int n; int sign; sign = 0; @@ -419,22 +402,18 @@ getn(cp) } Char * -value1(var, head) - Char *var; - struct varent *head; +value1(Char *var, struct varent *head) { - register struct varent *vp; + struct varent *vp; vp = adrof1(var, head); return (vp == 0 || vp->vec[0] == 0 ? STRNULL : vp->vec[0]); } static struct varent * -madrof(pat, vp) - Char *pat; - register struct varent *vp; +madrof(Char *pat, struct varent *vp) { - register struct varent *vp1; + struct varent *vp1; for (; vp; vp = vp->v_right) { if (vp->v_left && (vp1 = madrof(pat, vp->v_left))) @@ -446,11 +425,9 @@ madrof(pat, vp) } struct varent * -adrof1(name, v) - register Char *name; - register struct varent *v; +adrof1(Char *name, struct varent *v) { - register int cmp; + int cmp; v = v->v_left; while (v && ((cmp = *name - *v->v_name) || @@ -466,10 +443,9 @@ adrof1(name, v) * The caller is responsible for putting value in a safe place */ void -set(var, val) - Char *var, *val; +set(Char *var, Char *val) { - register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **))); + Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **))); vec[0] = val; vec[1] = 0; @@ -477,11 +453,9 @@ set(var, val) } void -set1(var, vec, head) - Char *var, **vec; - struct varent *head; +set1(Char *var, Char **vec, struct varent *head) { - register Char **oldv = vec; + Char **oldv = vec; gflag = 0; tglob(oldv); @@ -500,12 +474,10 @@ set1(var, vec, head) void -setq(name, vec, p) - Char *name, **vec; - register struct varent *p; +setq(Char *name, Char **vec, struct varent *p) { - register struct varent *c; - register int f; + struct varent *c; + int f; f = 0; /* tree hangs off the header's left link */ while ((c = p->v_link[f]) != NULL) { @@ -529,9 +501,7 @@ found: void /*ARGSUSED*/ -unset(v, t) - Char **v; - struct command *t; +unset(Char **v, struct command *t) { unset1(v, &shvhed); #ifdef FILEC @@ -547,12 +517,10 @@ unset(v, t) } void -unset1(v, head) - register Char *v[]; - struct varent *head; +unset1(Char *v[], struct varent *head) { - register struct varent *vp; - register int cnt; + struct varent *vp; + int cnt; while (*++v) { cnt = 0; @@ -564,10 +532,9 @@ unset1(v, head) } void -unsetv(var) - Char *var; +unsetv(Char *var) { - register struct varent *vp; + struct varent *vp; if ((vp = adrof1(var, &shvhed)) == 0) udvar(var); @@ -575,11 +542,10 @@ unsetv(var) } static void -unsetv1(p) - register struct varent *p; +unsetv1(struct varent *p) { - register struct varent *c, *pp; - register int f; + struct varent *c, *pp; + int f; /* * Free associated memory first to avoid complications. @@ -618,20 +584,17 @@ unsetv1(p) } void -setNS(cp) - Char *cp; +setNS(Char *cp) { set(cp, Strsave(STRNULL)); } void /*ARGSUSED*/ -shift(v, t) - Char **v; - struct command *t; +shift(Char **v, struct command *t) { - register struct varent *argv; - register Char *name; + struct varent *argv; + Char *name; v++; name = *v; @@ -648,8 +611,7 @@ shift(v, t) } static void -exportpath(val) - Char **val; +exportpath(Char **val) { Char exppath[BUFSIZ]; @@ -688,14 +650,12 @@ exportpath(val) (p) = t) #else struct varent * -rleft(p) - struct varent *p; +rleft(struct varent *p) { return (p); } struct varent * -rright(p) - struct varent *p; +rright(struct varent *p) { return (p); } @@ -709,17 +669,15 @@ rright(p) * D == 1 means we've just done a delete, otherwise an insert. */ static void -balance(p, f, d) - register struct varent *p; - register int f, d; +balance(struct varent *p, int f, int d) { - register struct varent *pp; + struct varent *pp; #ifndef lint - register struct varent *t; /* used by the rotate macros */ + struct varent *t; /* used by the rotate macros */ #endif - register int ff; + int ff; /* * Ok, from here on, p is the node we're operating on; pp is it's parent; f @@ -804,11 +762,10 @@ balance(p, f, d) } void -plist(p) - register struct varent *p; +plist(struct varent *p) { - register struct varent *c; - register int len; + struct varent *c; + int len; sigset_t sigset; if (setintr) { diff --git a/bin/csh/str.c b/bin/csh/str.c index 45802a11c67..c6bede10f20 100644 --- a/bin/csh/str.c +++ b/bin/csh/str.c @@ -1,4 +1,4 @@ -/* $OpenBSD: str.c,v 1.12 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: str.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $ */ /* $NetBSD: str.c,v 1.6 1995/03/21 09:03:24 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)str.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: str.c,v 1.12 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: str.c,v 1.13 2003/06/11 21:09:50 deraadt Exp $"; #endif #endif /* not lint */ @@ -55,11 +55,10 @@ static char rcsid[] = "$OpenBSD: str.c,v 1.12 2003/06/02 23:32:07 millert Exp $" #ifdef SHORT_STRINGS Char ** -blk2short(src) - register char **src; +blk2short(char **src) { size_t n; - register Char **sdst, **dst; + Char **sdst, **dst; /* * Count @@ -75,11 +74,10 @@ blk2short(src) } char ** -short2blk(src) - register Char **src; +short2blk(Char **src) { size_t n; - register char **sdst, **dst; + char **sdst, **dst; /* * Count @@ -95,12 +93,11 @@ short2blk(src) } Char * -str2short(src) - register char *src; +str2short(char *src) { static Char *sdst; static size_t dstsize = 0; - register Char *dst, *edst; + Char *dst, *edst; if (src == NULL) return (NULL); @@ -127,12 +124,11 @@ str2short(src) } char * -short2str(src) - register Char *src; +short2str(Char *src) { static char *sdst = NULL; static size_t dstsize = 0; - register char *dst, *edst; + char *dst, *edst; if (src == NULL) return (NULL); @@ -158,14 +154,11 @@ short2str(src) } size_t -s_strlcpy(dst, src, siz) - Char *dst; - const Char *src; - size_t siz; +s_strlcpy(Char *dst, const Char *src, size_t siz) { - register Char *d = dst; - register const Char *s = src; - register size_t n = siz; + Char *d = dst; + const Char *s = src; + size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { @@ -187,14 +180,11 @@ s_strlcpy(dst, src, siz) } size_t -s_strlcat(dst, src, siz) - Char *dst; - const Char *src; - size_t siz; +s_strlcat(Char *dst, const Char *src, size_t siz) { - register Char *d = dst; - register const Char *s = src; - register size_t n = siz; + Char *d = dst; + const Char *s = src; + size_t n = siz; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ @@ -218,9 +208,7 @@ s_strlcat(dst, src, siz) } Char * -s_strchr(str, ch) - register Char *str; - int ch; +s_strchr(Char *str, int ch) { do if (*str == ch) @@ -231,11 +219,9 @@ s_strchr(str, ch) } Char * -s_strrchr(str, ch) - register Char *str; - int ch; +s_strrchr(Char *str, int ch) { - register Char *rstr; + Char *rstr; rstr = NULL; do @@ -247,10 +233,9 @@ s_strrchr(str, ch) } size_t -s_strlen(str) - register Char *str; +s_strlen(Char *str) { - register size_t n; + size_t n; for (n = 0; *str++; n++) continue; @@ -258,8 +243,7 @@ s_strlen(str) } int -s_strcmp(str1, str2) - register Char *str1, *str2; +s_strcmp(Char *str1, Char *str2) { for (; *str1 && *str1 == *str2; str1++, str2++) continue; @@ -279,9 +263,7 @@ s_strcmp(str1, str2) } int -s_strncmp(str1, str2, n) - register Char *str1, *str2; - register size_t n; +s_strncmp(Char *str1, Char *str2, size_t n) { if (n == 0) return (0); @@ -308,11 +290,10 @@ s_strncmp(str1, str2, n) } Char * -s_strsave(s) - register Char *s; +s_strsave(Char *s) { Char *n; - register Char *p; + Char *p; if (s == 0) s = STRNULL; @@ -325,11 +306,10 @@ s_strsave(s) } Char * -s_strspl(cp, dp) - Char *cp, *dp; +s_strspl(Char *cp, Char *dp) { Char *ep; - register Char *p, *q; + Char *p, *q; if (!cp) cp = STRNULL; @@ -349,8 +329,7 @@ s_strspl(cp, dp) } Char * -s_strend(cp) - register Char *cp; +s_strend(Char *cp) { if (!cp) return (cp); @@ -360,12 +339,11 @@ s_strend(cp) } Char * -s_strstr(s, t) - register Char *s, *t; +s_strstr(Char *s, Char *t) { do { - register Char *ss = s; - register Char *tt = t; + Char *ss = s; + Char *tt = t; do if (*tt == '\0') @@ -377,12 +355,11 @@ s_strstr(s, t) #endif /* SHORT_STRINGS */ char * -short2qstr(src) - register Char *src; +short2qstr(Char *src) { static char *sdst = NULL; static size_t dstsize = 0; - register char *dst, *edst; + char *dst, *edst; if (src == NULL) return (NULL); @@ -421,8 +398,7 @@ short2qstr(src) * XXX: Should we worry about QUOTE'd chars? */ char * -vis_str(cp) - Char *cp; +vis_str(Char *cp) { static char *sdst = NULL; static size_t dstsize = 0; diff --git a/bin/csh/time.c b/bin/csh/time.c index ec0765c254f..ba5ae145c87 100644 --- a/bin/csh/time.c +++ b/bin/csh/time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: time.c,v 1.9 2003/06/02 23:32:07 millert Exp $ */ +/* $OpenBSD: time.c,v 1.10 2003/06/11 21:09:51 deraadt Exp $ */ /* $NetBSD: time.c,v 1.7 1995/03/21 13:55:25 mycroft Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: time.c,v 1.9 2003/06/02 23:32:07 millert Exp $"; +static char rcsid[] = "$OpenBSD: time.c,v 1.10 2003/06/11 21:09:51 deraadt Exp $"; #endif #endif /* not lint */ @@ -50,7 +50,7 @@ static char rcsid[] = "$OpenBSD: time.c,v 1.9 2003/06/02 23:32:07 millert Exp $" static void pdeltat(struct timeval *, struct timeval *); void -settimes() +settimes(void) { struct rusage ruch; @@ -66,9 +66,7 @@ settimes() */ void /*ARGSUSED*/ -dotime(v, t) - Char **v; - struct command *t; +dotime(Char **v, struct command *t) { struct timeval timedol; struct rusage ru1, ruch; @@ -85,11 +83,9 @@ dotime(v, t) */ void /*ARGSUSED*/ -donice(v, t) - Char **v; - struct command *t; +donice(Char **v, struct command *t) { - register Char *cp; + Char *cp; int nval = 0; v++, cp = *v++; @@ -101,8 +97,7 @@ donice(v, t) } void -ruadd(ru, ru2) - register struct rusage *ru, *ru2; +ruadd(struct rusage *ru, struct rusage *ru2) { timeradd(&ru->ru_utime, &ru2->ru_utime, &ru->ru_utime); timeradd(&ru->ru_stime, &ru2->ru_stime, &ru->ru_stime); @@ -125,18 +120,17 @@ ruadd(ru, ru2) } void -prusage(r0, r1, e, b) - register struct rusage *r0, *r1; - struct timeval *e, *b; +prusage(struct rusage *r0, struct rusage *r1, struct timeval *e, + struct timeval *b) { - register time_t t = + time_t t = (r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 + (r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 + (r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 + (r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 10000; - register char *cp; - register long i; - register struct varent *vp = adrof(STRtime); + char *cp; + long i; + struct varent *vp = adrof(STRtime); int ms = (e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000; @@ -237,8 +231,7 @@ prusage(r0, r1, e, b) } static void -pdeltat(t1, t0) - struct timeval *t1, *t0; +pdeltat(struct timeval *t1, struct timeval *t0) { struct timeval td; @@ -249,10 +242,9 @@ pdeltat(t1, t0) #define P2DIG(i) (void) fprintf(cshout, "%d%d", (i) / 10, (i) % 10) void -psecs(l) - long l; +psecs(long l) { - register int i; + int i; i = l / 3600; if (i) { @@ -270,10 +262,9 @@ minsec: } void -pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */ - long l; +pcsecs(long l) /* PWP: print mm:ss.dd, l is in sec*100 */ { - register int i; + int i; i = l / 360000; if (i) { |