shithub: riscv

Download patch

ref: 801664db7f4ed740d40f40f93f1aa4dd48e1c329
parent: a6e8789ff9b5412cb207f7adcf31fcf831d9bc00
author: Jacob Moody <moody@posixcafe.org>
date: Sun Jul 23 16:38:06 EDT 2023

ape/pdksh: ansi-ify function declarations

--- a/sys/src/ape/cmd/pdksh/alloc.c
+++ b/sys/src/ape/cmd/pdksh/alloc.c
@@ -51,8 +51,7 @@
 
 /* create empty Area */
 Area *
-ainit(ap)
-	register Area *ap;
+ainit(register Area *ap)
 {
 	ap->freelist = &aempty;
 	ACHECK(ap);
@@ -61,8 +60,7 @@
 
 /* free all object in Area */
 void
-afreeall(ap)
-	register Area *ap;
+afreeall(register Area *ap)
 {
 	register Block *bp;
 	register Block *tmp;
@@ -82,9 +80,7 @@
 
 /* allocate object from Area */
 void *
-alloc(size, ap)
-	size_t size;
-	register Area *ap;
+alloc(size_t size, register Area *ap)
 {
 	int cells, acells;
 	Block *bp = 0;
@@ -150,12 +146,7 @@
  * objects.  Returns the `allocated' object.
  */
 static void *
-asplit(ap, bp, fp, fpp, cells)
-	Area *ap;
-	Block *bp;
-	Cell *fp;
-	Cell *fpp;
-	int cells;
+asplit(Area *ap, Block *bp, Cell *fp, Cell *fpp, int cells)
 {
 	Cell *dp = fp;	/* allocated object */
 	int split = (fp-1)->size - cells;
@@ -184,10 +175,7 @@
 
 /* change size of object -- like realloc */
 void *
-aresize(ptr, size, ap)
-	register void *ptr;
-	size_t size;
-	Area *ap;
+aresize(register void *ptr, size_t size, Area *ap)
 {
 	int cells;
 	Cell *dp = (Cell*) ptr;
@@ -320,9 +308,7 @@
 }
 
 void
-afree(ptr, ap)
-	void *ptr;
-	register Area *ap;
+afree(void *ptr, register Area *ap)
 {
 	register Block *bp;
 	register Cell *fp, *fpp;
@@ -380,9 +366,7 @@
 }
 
 static void
-ablockfree(bp, ap)
-	Block *bp;
-	Area *ap;
+ablockfree(Block *bp, Area *ap)
 {
 	/* NOTE: If this code changes, similar changes may be
 	 * needed in alloc() (where realloc fails).
@@ -401,8 +385,7 @@
 
 # if DEBUG_ALLOC
 void
-acheck(ap)
-	Area *ap;
+acheck(Area *ap)
 {
 	Block *bp, *bpp;
 	Cell *dp, *dptmp, *fp;
@@ -498,10 +481,7 @@
 }
 
 void
-aprint(ap, ptr, size)
-	register Area *ap;
-	void *ptr;
-	size_t size;
+aprint(register Area *ap, void *ptr, size_t size)
 {
 	Block *bp;
 
--- a/sys/src/ape/cmd/pdksh/c_ksh.c
+++ b/sys/src/ape/cmd/pdksh/c_ksh.c
@@ -11,8 +11,7 @@
 #endif /* __CYGWIN__ */
 
 int
-c_cd(wp)
-	char	**wp;
+c_cd(char **wp)
 {
 	int optc;
 	int physical = Flag(FPHYSICAL);
@@ -173,8 +172,7 @@
 }
 
 int
-c_pwd(wp)
-	char	**wp;
+c_pwd(char **wp)
 {
 	int optc;
 	int physical = Flag(FPHYSICAL);
@@ -218,8 +216,7 @@
 }
 
 int
-c_print(wp)
-	char **wp;
+c_print(char **wp)
 {
 #define PO_NL		BIT(0)	/* print newline */
 #define PO_EXPAND	BIT(1)	/* expand backslash sequences */
@@ -442,8 +439,7 @@
 }
 
 int
-c_whence(wp)
-	char **wp;
+c_whence(char **wp)
 {
 	struct tbl *tp;
 	char *id;
@@ -565,8 +561,7 @@
 
 /* Deal with command -vV - command -p dealt with in comexec() */
 int
-c_command(wp)
-	char **wp;
+c_command(char **wp)
 {
 	/* Let c_whence do the work.  Note that c_command() must be
 	 * a distinct function from c_whence() (tested in comexec()).
@@ -576,8 +571,7 @@
 
 /* typeset, export, and readonly */
 int
-c_typeset(wp)
-	char **wp;
+c_typeset(char **wp)
 {
 	struct block *l = e->loc;
 	struct tbl *vp, **p;
@@ -873,8 +867,7 @@
 }
 	
 int
-c_alias(wp)
-	char **wp;
+c_alias(char **wp)
 {
 	struct table *t = &aliases;
 	int rv = 0, rflag = 0, tflag, Uflag = 0, pflag = 0;
@@ -1010,8 +1003,7 @@
 }
 
 int
-c_unalias(wp)
-	char **wp;
+c_unalias(char **wp)
 {
 	register struct table *t = &aliases;
 	register struct tbl *ap;
@@ -1064,8 +1056,7 @@
 
 #ifdef KSH
 int
-c_let(wp)
-	char **wp;
+c_let(char **wp)
 {
 	int rv = 1;
 	long val;
@@ -1084,8 +1075,7 @@
 #endif /* KSH */
 
 int
-c_jobs(wp)
-	char **wp;
+c_jobs(char **wp)
 {
 	int optc;
 	int flag = 0;
@@ -1122,8 +1112,7 @@
 
 #ifdef JOBS
 int
-c_fgbg(wp)
-	char **wp;
+c_fgbg(char **wp)
 {
 	int bg = strcmp(*wp, "bg") == 0;
 	int UNINITIALIZED(rv);
@@ -1155,11 +1144,7 @@
 
 /* format a single kill item */
 static char *
-kill_fmt_entry(arg, i, buf, buflen)
-	void *arg;
-	int i;
-	char *buf;
-	int buflen;
+kill_fmt_entry(void *arg, int i, char *buf, int buflen)
 {
 	struct kill_info *ki = (struct kill_info *) arg;
 
@@ -1179,8 +1164,7 @@
 
 
 int
-c_kill(wp)
-	char **wp;
+c_kill(char **wp)
 {
 	Trap *t = (Trap *) 0;
 	char *p;
@@ -1288,8 +1272,7 @@
 }
 
 void
-getopts_reset(val)
-	int val;
+getopts_reset(int val)
 {
 	if (val >= 1) {
 		ksh_getopt_reset(&user_opt,
@@ -1299,8 +1282,7 @@
 }
 
 int
-c_getopts(wp)
-	char **wp;
+c_getopts(char **wp)
 {
 	int	argc;
 	const char *options;
@@ -1399,8 +1381,7 @@
 
 #ifdef EMACS
 int
-c_bind(wp)
-	char **wp;
+c_bind(char **wp)
 {
 	int rv = 0, macro = 0, list = 0;
 	register char *cp;
--- a/sys/src/ape/cmd/pdksh/c_sh.c
+++ b/sys/src/ape/cmd/pdksh/c_sh.c
@@ -12,15 +12,13 @@
 
 /* :, false and true */
 int
-c_label(wp)
-	char **wp;
+c_label(char **wp)
 {
 	return wp[0][0] == 'f' ? 1 : 0;
 }
 
 int
-c_shift(wp)
-	char **wp;
+c_shift(char **wp)
 {
 	register struct block *l = e->loc;
 	register int n;
@@ -51,8 +49,7 @@
 }
 
 int
-c_umask(wp)
-	char **wp;
+c_umask(char **wp)
 {
 	register int i;
 	register char *cp;
@@ -171,8 +168,7 @@
 }
 
 int
-c_dot(wp)
-	char **wp;
+c_dot(char **wp)
 {
 	char *file, *cp;
 	char **argv;
@@ -210,8 +206,7 @@
 }
 
 int
-c_wait(wp)
-	char **wp;
+c_wait(char **wp)
 {
 	int UNINITIALIZED(rv);
 	int sig;
@@ -233,8 +228,7 @@
 }
 
 int
-c_read(wp)
-	char **wp;
+c_read(char **wp)
 {
 	register int c = 0;
 	int expand = 1, history = 0;
@@ -419,8 +413,7 @@
 }
 
 int
-c_eval(wp)
-	char **wp;
+c_eval(char **wp)
 {
 	register struct source *s;
 
@@ -460,8 +453,7 @@
 }
 
 int
-c_trap(wp)
-	char **wp;
+c_trap(char **wp)
 {
 	int i;
 	char *s;
@@ -520,8 +512,7 @@
 }
 
 int
-c_exitreturn(wp)
-	char **wp;
+c_exitreturn(char **wp)
 {
 	int how = LEXIT;
 	int n;
@@ -563,8 +554,7 @@
 }
 
 int
-c_brkcont(wp)
-	char **wp;
+c_brkcont(char **wp)
 {
 	int n, quit;
 	struct env *ep, *last_ep = (struct env *) 0;
@@ -617,8 +607,7 @@
 }
 
 int
-c_set(wp)
-	char **wp;
+c_set(char **wp)
 {
 	int argi, setargs;
 	struct block *l = e->loc;
@@ -653,8 +642,7 @@
 }
 
 int
-c_unset(wp)
-	char **wp;
+c_unset(char **wp)
 {
 	register char *id;
 	int optc, unset_var = 1;
@@ -691,8 +679,7 @@
 }
 
 int
-c_times(wp)
-	char **wp;
+c_times(char **wp)
 {
 	struct tms all;
 
@@ -709,9 +696,7 @@
  * time pipeline (really a statement, not a built-in command)
  */
 int
-timex(t, f)
-	struct op *t;
-	int f;
+timex(struct op *t, int f)
 {
 #define TF_NOARGS	BIT(0)
 #define TF_NOREAL	BIT(1)		/* don't report real time */
@@ -766,9 +751,7 @@
 }
 
 void
-timex_hook(t, app)
-	struct op *t;
-	char ** volatile *app;
+timex_hook(struct op *t, char ** volatile *app)
 {
 	char **wp = *app;
 	int optc;
@@ -801,8 +784,7 @@
 }
 
 static char *
-clocktos(t)
-	clock_t t;
+clocktos(clock_t t)
 {
 	static char temp[22]; /* enough for 64 bit clock_t */
 	register int i;
@@ -827,8 +809,7 @@
 
 /* exec with no args - args case is taken care of in comexec() */
 int
-c_exec(wp)
-	char ** wp;
+c_exec(char ** wp)
 {
 	int i;
 
@@ -855,8 +836,7 @@
 
 /* dummy function, special case in comexec() */
 int
-c_builtin(wp)
-	char ** wp;
+c_builtin(char ** wp)
 {
 	return 0;
 }
--- a/sys/src/ape/cmd/pdksh/c_test.c
+++ b/sys/src/ape/cmd/pdksh/c_test.c
@@ -98,8 +98,7 @@
 static void	ptest_error ARGS((Test_env *te, int offset, const char *msg));
 
 int
-c_test(wp)
-	char **wp;
+c_test(char **wp)
 {
 	int argc;
 	int res;
@@ -183,10 +182,7 @@
  */
 
 Test_op
-test_isop(te, meta, s)
-	Test_env *te;
-	Test_meta meta;
-	const char *s;
+test_isop(Test_env *te, Test_meta meta, const char *s)
 {
 	char sc1;
 	const struct t_op *otab;
@@ -206,12 +202,7 @@
 }
 
 int
-test_eval(te, op, opnd1, opnd2, do_eval)
-	Test_env *te;
-	Test_op op;
-	const char *opnd1;
-	const char *opnd2;
-	int do_eval;
+test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, int do_eval)
 {
 	int res;
 	int not;
@@ -416,9 +407,7 @@
 
 /* Nasty kludge to handle Korn's bizarre /dev/fd hack */
 static int
-test_stat(path, statb)
-	const char *path;
-	struct stat *statb;
+test_stat(const char *path, struct stat *statb)
 {
 #if !defined(HAVE_DEV_FD)
 	int fd;
@@ -434,9 +423,7 @@
  * non-directories when running as root.
  */
 static int
-test_eaccess(path, mode)
-	const char *path;
-	int mode;
+test_eaccess(const char *path, int mode)
 {
 	int res;
 
@@ -481,8 +468,7 @@
 }
 
 int
-test_parse(te)
-	Test_env *te;
+test_parse(Test_env *te)
 {
 	int res;
 
@@ -495,9 +481,7 @@
 }
 
 static int
-test_oexpr(te, do_eval)
-	Test_env *te;
-	int do_eval;
+test_oexpr(Test_env *te, int do_eval)
 {
 	int res;
 
@@ -510,9 +494,7 @@
 }
 
 static int
-test_aexpr(te, do_eval)
-	Test_env *te;
-	int do_eval;
+test_aexpr(Test_env *te, int do_eval)
 {
 	int res;
 
@@ -525,9 +507,7 @@
 }
 
 static int
-test_nexpr(te, do_eval)
-	Test_env *te;
-	int do_eval;
+test_nexpr(Test_env *te, int do_eval)
 {
 	if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT))
 		return !test_nexpr(te, do_eval);
@@ -535,9 +515,7 @@
 }
 
 static int
-test_primary(te, do_eval)
-	Test_env *te;
-	int do_eval;
+test_primary(Test_env *te, int do_eval)
 {
 	const char *opnd1, *opnd2;
 	int res;
@@ -596,9 +574,7 @@
  * TM_UNOP and TM_BINOP, the returned value is a Test_op).
  */
 static int
-ptest_isa(te, meta)
-	Test_env *te;
-	Test_meta meta;
+ptest_isa(Test_env *te, Test_meta meta)
 {
 	/* Order important - indexed by Test_meta values */
 	static const char *const tokens[] = {
@@ -624,10 +600,7 @@
 }
 
 static const char *
-ptest_getopnd(te, op, do_eval)
-	Test_env *te;
-	Test_op op;
-	int do_eval;
+ptest_getopnd(Test_env *te, Test_op op, int do_eval)
 {
 	if (te->pos.wp >= te->wp_end)
 		return op == TO_FILTT ? "1" : (const char *) 0;
@@ -635,21 +608,13 @@
 }
 
 static int
-ptest_eval(te, op, opnd1, opnd2, do_eval)
-	Test_env *te;
-	Test_op op;
-	const char *opnd1;
-	const char *opnd2;
-	int do_eval;
+ptest_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, int do_eval)
 {
 	return test_eval(te, op, opnd1, opnd2, do_eval);
 }
 
 static void
-ptest_error(te, offset, msg)
-	Test_env *te;
-	int offset;
-	const char *msg;
+ptest_error(Test_env *te, int offset, const char *msg)
 {
 	const char *op = te->pos.wp + offset >= te->wp_end ?
 				(const char *) 0 : te->pos.wp[offset];
--- a/sys/src/ape/cmd/pdksh/c_ulimit.c
+++ b/sys/src/ape/cmd/pdksh/c_ulimit.c
@@ -39,8 +39,7 @@
 #endif /* RLIM_INFINITY */
 
 int
-c_ulimit(wp)
-	char **wp;
+c_ulimit(char **wp)
 {
 	static const struct limits {
 		const char	*name;
--- a/sys/src/ape/cmd/pdksh/eval.c
+++ b/sys/src/ape/cmd/pdksh/eval.c
@@ -55,9 +55,7 @@
 
 /* compile and expand word */
 char *
-substitute(cp, f)
-	const char *cp;
-	int f;
+substitute(const char *cp, int f)
 {
 	struct source *s, *sold;
 
@@ -76,9 +74,7 @@
  * expand arg-list
  */
 char **
-eval(ap, f)
-	register char **ap;
-	int f;
+eval(register char **ap, int f)
 {
 	XPtrV w;
 
@@ -103,9 +99,7 @@
  * expand string
  */
 char *
-evalstr(cp, f)
-	char *cp;
-	int f;
+evalstr(char *cp, int f)
 {
 	XPtrV w;
 
@@ -121,9 +115,7 @@
  * used from iosetup to expand redirection files
  */
 char *
-evalonestr(cp, f)
-	register char *cp;
-	int f;
+evalonestr(register char *cp, int f)
 {
 	XPtrV w;
 
@@ -156,10 +148,7 @@
 } SubType;
 
 void
-expand(cp, wp, f)
-	char *cp;		/* input word */
-	register XPtrV *wp;	/* output words */
-	int f;			/* DO* flags */
+expand(char *cp, XPtrV *wp, int f)
 {
 	register int UNINITIALIZED(c);
 	register int type;	/* expansion type */
@@ -684,12 +673,7 @@
  * Prepare to generate the string returned by ${} substitution.
  */
 static int
-varsub(xp, sp, word, stypep, slenp)
-	Expand *xp;
-	char *sp;
-	char *word;
-	int *stypep;	/* becomes qualifier type */
-	int *slenp;	/* " " len (=, :=, etc.) valid iff *stypep != 0 */
+varsub(Expand *xp, char *sp, char *word, int *stypep, int *slenp)
 {
 	int c;
 	int state;	/* next state: XBASE, XARG, XSUB, XNULLSUB */
@@ -835,9 +819,7 @@
  * Run the command in $(...) and read its output.
  */
 static int
-comsub(xp, cp)
-	register Expand *xp;
-	char *cp;
+comsub(register Expand *xp, char *cp)
 {
 	Source *s, *sold;
 	register struct op *t;
@@ -887,10 +869,7 @@
  */
 
 static char *
-trimsub(str, pat, how)
-	register char *str;
-	char *pat;
-	int how;
+trimsub(register char *str, char *pat, int how)
 {
 	register char *end = strchr(str, 0);
 	register char *p, c;
@@ -940,10 +919,7 @@
 
 /* XXX cp not const 'cause slashes are temporarily replaced with nulls... */
 static void
-glob(cp, wp, markdirs)
-	char *cp;
-	register XPtrV *wp;
-	int markdirs;
+glob(char *cp, register XPtrV *wp, int markdirs)
 {
 	int oldsize = XPsize(*wp);
 
@@ -963,10 +939,7 @@
  * the number of matches found.
  */
 int
-glob_str(cp, wp, markdirs)
-	char *cp;
-	XPtrV *wp;
-	int markdirs;
+glob_str(char *cp, XPtrV *wp, int markdirs)
 {
 	int oldsize = XPsize(*wp);
 	XString xs;
@@ -980,12 +953,7 @@
 }
 
 static void
-globit(xs, xpp, sp, wp, check)
-	XString *xs;		/* dest string */
-	char **xpp;		/* ptr to dest end */
-	char *sp;		/* source path */
-	register XPtrV *wp;	/* output list */
-	int check;		/* GF_* flags */
+globit(XString *xs, char **xpp, char *sp, XPtrV *wp, int check)
 {
 	register char *np;	/* next source component */
 	char *xp = *xpp;
@@ -1132,10 +1100,7 @@
  */
 static int	copy_non_glob ARGS((XString *xs, char **xpp, char *p));
 static int
-copy_non_glob(xs, xpp, p)
-	XString *xs;
-	char **xpp;
-	char *p;
+copy_non_glob(XString *xs, char **xpp, char *p)
 {
 	char *xp;
 	int len = strlen(p);
@@ -1172,9 +1137,7 @@
 
 /* remove MAGIC from string */
 char *
-debunk(dp, sp)
-	char *dp;
-	const char *sp;
+debunk(char *dp, const char *sp)
 {
 	char *d, *s;
 
@@ -1201,11 +1164,7 @@
  * past the name, otherwise returns 0.
  */
 static char *
-maybe_expand_tilde(p, dsp, dpp, isassign)
-	char *p;
-	XString *dsp;
-	char **dpp;
-	int isassign;
+maybe_expand_tilde(char *p, XString *dsp, char **dpp, int isassign)
 {
 	XString ts;
 	char *dp = *dpp;
@@ -1243,8 +1202,7 @@
  */
 
 static char *
-tilde(cp)
-	char *cp;
+tilde(char *cp)
 {
 	char *dp;
 
@@ -1270,8 +1228,7 @@
  */
 
 static char *
-homedir(name)
-	char *name;
+homedir(char *name)
 {
 	register struct tbl *ap;
 
@@ -1295,11 +1252,7 @@
 
 #ifdef BRACE_EXPAND
 static void
-alt_expand(wp, start, exp_start, end, fdo)
-	XPtrV *wp;
-	char *start, *exp_start;
-	char *end;
-	int fdo;
+alt_expand(XPtrV *wp, char *start, *exp_start, char *end, int fdo)
 {
 	int UNINITIALIZED(count);
 	char *brace_start, *brace_end, *UNINITIALIZED(comma);
--- a/sys/src/ape/cmd/pdksh/exec.c
+++ b/sys/src/ape/cmd/pdksh/exec.c
@@ -51,8 +51,7 @@
  * we now use this function always.
  */
 int
-fd_clexec(fd)
-    int fd;
+fd_clexec(int fd)
 {
 #ifndef F_SETFD
 	if (fd >= 0 && fd < sizeof(clexec_tab)) {
@@ -70,9 +69,7 @@
  * execute command tree
  */
 int
-execute(t, flags)
-	struct op * volatile t;
-	volatile int flags;	/* if XEXEC don't fork */
+execute(struct op *t, int flags)
 {
 	int i;
 	volatile int rv = 0;
@@ -441,11 +438,7 @@
  */
 
 static int
-comexec(t, tp, ap, flags)
-	struct op *t;
-	struct tbl *volatile tp;
-	register char **ap;
-	int volatile flags;
+comexec(struct op *t, struct tbl *volatile tp, register char **ap, int volatile flags)
 {
 	int i;
 	int rv = 0;
@@ -741,9 +734,7 @@
 }
 
 static void
-scriptexec(tp, ap)
-	register struct op *tp;
-	register char **ap;
+scriptexec(register struct op *tp, register char **ap)
 {
 	char *shell;
 
@@ -855,8 +846,7 @@
 }
 
 int
-shcomexec(wp)
-	register char **wp;
+shcomexec(register char **wp)
 {
 	register struct tbl *tp;
 
@@ -871,10 +861,7 @@
  * is created if none is found.
  */
 struct tbl *
-findfunc(name, h, create)
-	const char *name;
-	unsigned int h;
-	int create;
+findfunc(const char *name, unsigned int h, int create)
 {
 	struct block *l;
 	struct tbl *tp = (struct tbl *) 0;
@@ -899,9 +886,7 @@
  * function did not exist, returns 0 otherwise.
  */
 int
-define(name, t)
-	const char *name;
-	struct op *t;
+define(const char *name, struct op *t)
 {
 	struct tbl *tp;
 	int was_set = 0;
@@ -944,9 +929,7 @@
  * add builtin
  */
 void
-builtin(name, func)
-	const char *name;
-	int (*func) ARGS((char **));
+builtin(const char *name, int (*func) ARGS((char **)))
 {
 	register struct tbl *tp;
 	Tflag flag;
@@ -974,9 +957,7 @@
  * either function, hashed command, or built-in (in that order)
  */
 struct tbl *
-findcom(name, flags)
-	const char *name;
-	int	flags;		/* FC_* */
+findcom(char *name, int flags)
 {
 	static struct tbl temp;
 	unsigned int h = hash(name);
@@ -1073,8 +1054,7 @@
  * flush executable commands with relative paths
  */
 void
-flushcom(all)
-	int all;		/* just relative or all */
+flushcom(int all)
 {
 	struct tbl *tp;
 	struct tstate ts;
@@ -1091,10 +1071,7 @@
 
 /* Check if path is something we want to find.  Returns -1 for failure. */
 int
-search_access(path, mode, errnop)
-	const char *path;
-	int mode;
-	int *errnop;		/* set if candidate found, but not suitable */
+search_access(const char *path, int mode, int *errnop)
 {
 #ifndef OS2
 	int ret, err = 0;
@@ -1161,10 +1138,7 @@
 
 #ifdef OS2
 static int
-search_access1(path, mode, errnop)
-	const char *path;
-	int mode;
-	int *errnop;		/* set if candidate found, but not suitable */
+search_access1(char *path, int mode, int *errnop)
 {
 	int ret, err = 0;
 	struct stat statb;
@@ -1188,11 +1162,7 @@
  * search for command with PATH
  */
 char *
-search(name, path, mode, errnop)
-	const char *name;
-	const char *path;
-	int mode;		/* R_OK or X_OK */
-	int *errnop;		/* set if candidate found, but not suitable */
+search(const char *name, const char *path, int mode, int *errnop)
 {
 	const char *sp, *p;
 	char *xp;
@@ -1258,9 +1228,7 @@
 }
 
 static int
-call_builtin(tp, wp)
-	struct tbl *tp;
-	char **wp;
+call_builtin(struct tbl *tp, char **wp)
 {
 	int rv;
 
@@ -1281,9 +1249,7 @@
  * set up redirection, saving old fd's in e->savefd
  */
 static int
-iosetup(iop, tp)
-	register struct ioword *iop;
-	struct tbl *tp;
+iosetup(register struct ioword *iop, struct tbl *tp)
 {
 	register int u = -1;
 	char *cp = iop->name;
@@ -1419,9 +1385,7 @@
  * if unquoted here, expand here temp file into second temp file.
  */
 static int
-herein(content, sub)
-	const char *content;
-	int sub;
+herein(const char *content, int sub)
 {
 	volatile int fd = -1;
 	struct source *s, *volatile osource;
@@ -1488,9 +1452,7 @@
  *	print the args in column form - assuming that we can
  */
 static char *
-do_selectargs(ap, print_menu)
-	register char **ap;
-	bool_t print_menu;
+do_selectargs(register char **ap, bool_t print_menu)
 {
 	static const char *const read_args[] = {
 					"read", "-r", "REPLY", (char *) 0
@@ -1530,11 +1492,7 @@
 
 /* format a single select menu item */
 static char *
-select_fmt_entry(arg, i, buf, buflen)
-	void *arg;
-	int i;
-	char *buf;
-	int buflen;
+select_fmt_entry(void *arg, int i, char *buf, int buflen)
 {
 	struct select_menu_info *smi = (struct select_menu_info *) arg;
 
@@ -1547,8 +1505,7 @@
  *	print a select style menu
  */
 int
-pr_menu(ap)
-	char *const *ap;
+pr_menu(char *const *ap)
 {
 	struct select_menu_info smi;
 	char *const *pp;
@@ -1600,9 +1557,7 @@
  * TM_UNOP and TM_BINOP, the returned value is a Test_op).
  */
 static int
-dbteste_isa(te, meta)
-	Test_env *te;
-	Test_meta meta;
+dbteste_isa(Test_env *te, Test_meta meta)
 {
 	int ret = 0;
 	int uqword;
@@ -1641,10 +1596,7 @@
 }
 
 static const char *
-dbteste_getopnd(te, op, do_eval)
-	Test_env *te;
-	Test_op op;
-	int do_eval;
+dbteste_getopnd(Test_env *te, Test_op op, int do_eval)
 {
 	char *s = *te->pos.wp;
 
@@ -1665,21 +1617,13 @@
 }
 
 static int
-dbteste_eval(te, op, opnd1, opnd2, do_eval)
-	Test_env *te;
-	Test_op op;
-	const char *opnd1;
-	const char *opnd2;
-	int do_eval;
+dbteste_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, int do_eval)
 {
 	return test_eval(te, op, opnd1, opnd2, do_eval);
 }
 
 static void
-dbteste_error(te, offset, msg)
-	Test_env *te;
-	int offset;
-	const char *msg;
+dbteste_error(Test_env *te, int offset, const char *msg)
 {
 	te->flags |= TEF_ERROR;
 	internal_errorf(0, "dbteste_error: %s (offset %d)", msg, offset);
--- a/sys/src/ape/cmd/pdksh/expr.c
+++ b/sys/src/ape/cmd/pdksh/expr.c
@@ -141,10 +141,7 @@
  * parse and evalute expression
  */
 int
-evaluate(expr, rval, error_ok)
-	const char *expr;
-	long *rval;
-	int error_ok;
+evaluate(const char *expr, long *rval, int error_ok)
 {
 	struct tbl v;
 	int ret;
@@ -160,10 +157,7 @@
  * parse and evalute expression, storing result in vp.
  */
 int
-v_evaluate(vp, expr, error_ok)
-	struct tbl *vp;
-	const char *expr;
-	volatile int error_ok;
+v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok)
 {
 	struct tbl *v;
 	Expr_state curstate;
@@ -215,10 +209,7 @@
 }
 
 static void
-evalerr(es, type, str)
-	Expr_state *es;
-	enum error_type type;
-	const char *str;
+evalerr(Expr_state *es, enum error_type type, const char *str)
 {
 	char tbuf[2];
 	const char *s;
@@ -274,9 +265,7 @@
 }
 
 static struct tbl *
-evalexpr(es, prec)
-	Expr_state *es;
-	enum prec prec;
+evalexpr(Expr_state *es, enum prec prec)
 {
 	struct tbl *vl, UNINITIALIZED(*vr), *vasn;
 	enum token op;
@@ -455,8 +444,7 @@
 }
 
 static void
-token(es)
-	Expr_state *es;
+token(Expr_state *es)
 {
 	const char *cp;
 	int c;
@@ -529,11 +517,7 @@
 
 /* Do a ++ or -- operation */
 static struct tbl *
-do_ppmm(es, op, vasn, is_prefix)
-	Expr_state *es;
-	enum token op;
-	struct tbl *vasn;
-	bool_t is_prefix;
+do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool_t is_prefix)
 {
 	struct tbl *vl;
 	int oval;
@@ -553,10 +537,7 @@
 }
 
 static void
-assign_check(es, op, vasn)
-	Expr_state *es;
-	enum token op;
-	struct tbl *vasn;
+assign_check(Expr_state *es, enum token op, struct tbl *vasn)
 {
 	if (vasn->name[0] == '\0' && !(vasn->flag & EXPRLVALUE))
 		evalerr(es, ET_LVALUE, opinfo[(int) op].name);
@@ -565,7 +546,7 @@
 }
 
 static struct tbl *
-tempvar()
+tempvar(void)
 {
 	register struct tbl *vp;
 
@@ -580,9 +561,7 @@
 
 /* cast (string) variable to temporary integer variable */
 static struct tbl *
-intvar(es, vp)
-	Expr_state *es;
-	struct tbl *vp;
+intvar(Expr_state *es, struct tbl *vp)
 {
 	struct tbl *vq;
 
--- a/sys/src/ape/cmd/pdksh/history.c
+++ b/sys/src/ape/cmd/pdksh/history.c
@@ -73,8 +73,7 @@
 
 
 int
-c_fc(wp)
-	char **wp;
+c_fc(char **wp)
 {
 	struct shf *shf;
 	struct temp UNINITIALIZED(*tf);
@@ -285,8 +284,7 @@
 
 /* Save cmd in history, execute cmd (cmd gets trashed) */
 static int
-hist_execute(cmd)
-	char *cmd;
+hist_execute(char *cmd)
 {
 	Source *sold;
 	int ret;
@@ -326,11 +324,7 @@
 }
 
 static int
-hist_replace(hp, pat, rep, global)
-	char **hp;
-	const char *pat;
-	const char *rep;
-	int global;
+hist_replace(char **hp, const char *pat, const char *rep, int global)
 {
 	char *line;
 
@@ -375,10 +369,7 @@
  * pattern is a number or string
  */
 static char **
-hist_get(str, approx, allow_cur)
-	const char *str;
-	int approx;
-	int allow_cur;
+hist_get(const char *str, int approx, int allow_cur)
 {
 	char **hp = (char **) 0;
 	int n;
@@ -419,8 +410,7 @@
 
 /* Return a pointer to the newest command in the history */
 static char **
-hist_get_newest(allow_cur)
-	int allow_cur;
+hist_get_newest(int allow_cur)
 {
 	if (histptr < history || (!allow_cur && histptr == history)) {
 		bi_errorf("no history (yet)");
@@ -433,7 +423,7 @@
 
 /* Return a pointer to the newest command in the history */
 static char **
-hist_get_oldest()
+hist_get_oldest(void)
 {
 	if (histptr <= history) {
 		bi_errorf("no history (yet)");
@@ -446,7 +436,7 @@
 /* Back up over last histsave */
 /******************************/
 static void
-histbackup()
+histbackup(void)
 {
 	static int last_line = -1;
 
@@ -462,7 +452,7 @@
  * Return the current position.
  */
 char **
-histpos()
+histpos(void)
 {
 	return current;
 }
@@ -474,8 +464,7 @@
 }
 
 int
-histnum(n)
-	int	n;
+histnum(int	n)
 {
 	int	last = histptr - history;
 
@@ -496,11 +485,7 @@
  * direction.
  */
 int
-findhist(start, fwd, str, anchored)
-	int	start;
-	int	fwd;
-	const char  *str;
-	int	anchored;
+findhist(int start, int fwd, const char *str, int anchored)
 {
 	char	**hp;
 	int	maxhist = histptr - history;
@@ -524,8 +509,7 @@
  *	this means reallocating the dataspace
  */
 void
-sethistsize(n)
-	int n;
+sethistsize(int n)
 {
 	if (n > 0 && n != histsize) {
 		int cursize = histptr - history;
@@ -549,8 +533,7 @@
  *	maintenance
  */
 void
-sethistfile(name)
-	const char *name;
+sethistfile(const char *name)
 {
 	/* if not started then nothing to do */
 	if (hstarted == 0)
@@ -589,7 +572,7 @@
  *	initialise the history vector
  */
 void
-init_histvec()
+init_histvec(void)
 {
 	if (history == (char **)NULL) {
 		histsize = HISTORYSIZE;
@@ -630,9 +613,7 @@
  * commands
  */
 void
-histappend(cmd, nl_separate)
-	const char *cmd;
-	int	nl_separate;
+histappend(const char *cmd, int	nl_separate)
 {
 	int	hlen, clen;
 	char	*p;
@@ -658,8 +639,7 @@
  * to save its history.
  */
 void
-hist_init(s)
-	Source *s;
+hist_init(Source *s)
 {
 	char *f;
 	FILE *fh;
@@ -724,7 +704,7 @@
  */
 
 void
-hist_finish()
+hist_finish(void)
 {
   static int once;
   FILE *fh;
@@ -762,10 +742,7 @@
  * save command in history
  */
 void
-histsave(lno, cmd, dowrite)
-	int lno;
-	const char *cmd;
-	int dowrite;
+histsave(int lno, const char *cmd, int dowrite)
 {
 	register char **hp;
 	char *c, *cp;
@@ -813,8 +790,7 @@
 # define COMMAND		0xff
 
 void
-hist_init(s)
-	Source *s;
+hist_init(Source *s)
 {
 	unsigned char	*base;
 	int	lines;
@@ -891,9 +867,7 @@
 } State;
 
 static int
-hist_count_lines(base, bytes)
-	register unsigned char *base;
-	register int bytes;
+hist_count_lines(register unsigned char *base, register int bytes)
 {
 	State state = shdr;
 	register lines = 0;
@@ -926,9 +900,7 @@
  *	Shrink the history file to histsize lines
  */
 static int
-hist_shrink(oldbase, oldbytes)
-	unsigned char *oldbase;
-	int oldbytes;
+hist_shrink(unsigned char *oldbase, int oldbytes)
 {
 	int fd;
 	char	nfile[1024];
@@ -980,10 +952,7 @@
  *	return the pointer and the number of bytes left
  */
 static unsigned char *
-hist_skip_back(base, bytes, no)
-	unsigned char *base;
-	int *bytes;
-	int no;
+hist_skip_back(unsigned char *base, int *bytes, int no)
 {
 	register int lines = 0;
 	register unsigned char *ep;
@@ -1009,10 +978,7 @@
  *	load the history structure from the stored data
  */
 static void
-histload(s, base, bytes)
-	Source *s;
-	register unsigned char *base;
-	register int bytes;
+histload(Source *s, register unsigned char *base, register int bytes)
 {
 	State state;
 	int	lno;
@@ -1062,10 +1028,7 @@
  *	Insert a line into the history at a specified number
  */
 static void
-histinsert(s, lno, line)
-	Source *s;
-	int lno;
-	unsigned char *line;
+histinsert(Source *s, int lno, unsigned char *line)
 {
 	register char **hp;
 
@@ -1085,9 +1048,7 @@
  *	and we should read those commands to update our history
  */
 static void
-writehistfile(lno, cmd)
-	int lno;
-	char *cmd;
+writehistfile(int lno, char *cmd)
 {
 	int	sizenow;
 	unsigned char	*base;
@@ -1143,7 +1104,7 @@
 }
 
 void
-hist_finish()
+hist_finish(void)
 {
 	(void) flock(histfd, LOCK_UN);
 	(void) close(histfd);
@@ -1154,8 +1115,7 @@
  *	add magic to the history file
  */
 static int
-sprinkle(fd)
-	int fd;
+sprinkle(int fd)
 {
 	static char mag[] = { HMAGIC1, HMAGIC2 };
 
@@ -1167,23 +1127,19 @@
 
 /* No history to be compiled in: dummy routines to avoid lots more ifdefs */
 void
-init_histvec()
+init_histvec(void)
 {
 }
 void
-hist_init(s)
-	Source *s;
+hist_init(Source *s)
 {
 }
 void
-hist_finish()
+hist_finish(void)
 {
 }
 void
-histsave(lno, cmd, dowrite)
-	int lno;
-	const char *cmd;
-	int dowrite;
+histsave(int lno, const char *cmd, int dowrite)
 {
 	errorf("history not enabled");
 }
--- a/sys/src/ape/cmd/pdksh/io.c
+++ b/sys/src/ape/cmd/pdksh/io.c
@@ -124,8 +124,7 @@
 
 /* used by error reporting functions to print "ksh: .kshrc[25]: " */
 void
-error_prefix(fileline)
-	int fileline;
+error_prefix(int fileline)
 {
 	/* Avoid foo: foo[2]: ... */
 	if (!fileline || !source || !source->file
@@ -181,7 +180,7 @@
 static struct shf *kshdebug_shf;
 
 void
-kshdebug_init_()
+kshdebug_init_(void)
 {
 	if (kshdebug_shf)
 		shf_close(kshdebug_shf);
@@ -216,10 +215,7 @@
 }
 
 void
-kshdebug_dump_(str, mem, nbytes)
-	const char *str;
-	const void *mem;
-	int nbytes;
+kshdebug_dump_(const char *str, const void *mem, int nbytes)
 {
 	int i, j;
 	int nprow = 16;
@@ -242,8 +238,7 @@
 
 /* test if we can seek backwards fd (returns 0 or SHF_UNBUF) */
 int
-can_seek(fd)
-	int fd;
+can_seek(int fd)
 {
 	struct stat statb;
 
@@ -254,7 +249,7 @@
 struct shf	shf_iob[3];
 
 void
-initio()
+initio(void)
 {
 	shf_fdopen(1, SHF_WR, shl_stdout);	/* force buffer allocation */
 	shf_fdopen(2, SHF_WR, shl_out);
@@ -265,10 +260,7 @@
 
 /* A dup2() with error checking */
 int
-ksh_dup2(ofd, nfd, errok)
-	int ofd;
-	int nfd;
-	int errok;
+ksh_dup2(int ofd, int nfd, int errok)
 {
 	int ret = dup2(ofd, nfd);
 
@@ -289,9 +281,7 @@
  * set close-on-exec flag.
  */
 int
-savefd(fd, noclose)
-	int fd;
-	int noclose;
+savefd(int fd, int noclose)
 {
 	int nfd;
 
@@ -311,8 +301,7 @@
 }
 
 void
-restfd(fd, ofd)
-	int fd, ofd;
+restfd(int fd, int ofd)
 {
 	if (fd == 2)
 		shf_flush(&shf_iob[fd]);
@@ -325,8 +314,7 @@
 }
 
 void
-openpipe(pv)
-	register int *pv;
+openpipe(register int *pv)
 {
 	if (pipe(pv) < 0)
 		errorf("can't create pipe - try again");
@@ -335,8 +323,7 @@
 }
 
 void
-closepipe(pv)
-	register int *pv;
+closepipe(register int *pv)
 {
 	close(pv[0]);
 	close(pv[1]);
@@ -346,10 +333,7 @@
  * a string (the X in 2>&X, read -uX, print -uX) into a file descriptor.
  */
 int
-check_fd(name, mode, emsgp)
-	char *name;
-	int mode;
-	const char **emsgp;
+check_fd(char *name, int mode, const char **emsgp)
 {
 	int fd, fl;
 
@@ -404,7 +388,7 @@
 #ifdef KSH
 /* Called once from main */
 void
-coproc_init()
+coproc_init(void)
 {
 	coproc.read = coproc.readw = coproc.write = -1;
 	coproc.njobs = 0;
@@ -413,8 +397,7 @@
 
 /* Called by c_read() when eof is read - close fd if it is the co-process fd */
 void
-coproc_read_close(fd)
-	int fd;
+coproc_read_close(int fd)
 {
 	if (coproc.read >= 0 && fd == coproc.read) {
 		coproc_readw_close(fd);
@@ -427,8 +410,7 @@
  * read pipe, so reads will actually terminate.
  */
 void
-coproc_readw_close(fd)
-	int fd;
+coproc_readw_close(int fd)
 {
 	if (coproc.readw >= 0 && coproc.read >= 0 && fd == coproc.read) {
 		close(coproc.readw);
@@ -440,8 +422,7 @@
  * when co-process input is dup'd
  */
 void
-coproc_write_close(fd)
-	int fd;
+coproc_write_close(int fd)
 {
 	if (coproc.write >= 0 && fd == coproc.write) {
 		close(coproc.write);
@@ -453,9 +434,7 @@
  * (Used by check_fd() and by c_read/c_print to deal with -p option).
  */
 int
-coproc_getfd(mode, emsgp)
-	int mode;
-	const char **emsgp;
+coproc_getfd(int mode, const char **emsgp)
 {
 	int fd = (mode & R_OK) ? coproc.read : coproc.write;
 
@@ -470,8 +449,7 @@
  * Should be called with SIGCHLD blocked.
  */
 void
-coproc_cleanup(reuse)
-	int reuse;
+coproc_cleanup(int reuse)
 {
 	/* This to allow co-processes to share output pipe */
 	if (!reuse || coproc.readw < 0 || coproc.read < 0) {
@@ -497,10 +475,7 @@
  */
 
 struct temp *
-maketemp(ap, type, tlist)
-	Area *ap;
-	Temp_type type;
-	struct temp **tlist;
+maketemp(Area *ap, Temp_type type, struct temp **tlist)
 {
 	static unsigned int inc;
 	struct temp *tp;
--- a/sys/src/ape/cmd/pdksh/jobs.c
+++ b/sys/src/ape/cmd/pdksh/jobs.c
@@ -58,16 +58,13 @@
 int tcgetpgrp ARGS((int fd));
 
 int
-tcsetpgrp(fd, grp)
-	int fd;
-	pid_t grp;
+tcsetpgrp(int fd, pid_t grp)
 {
 	return ioctl(fd, TIOCSPGRP, &grp);
 }
 
 int
-tcgetpgrp(fd)
-	int	fd;
+tcgetpgrp(int fd)
 {
 	int r, grp;
 
@@ -224,8 +221,7 @@
 
 /* initialize job control */
 void
-j_init(mflagset)
-	int mflagset;
+j_init(int mflagset)
 {
 	child_max = CHILD_MAX; /* so syscon() isn't always being called */
 
@@ -279,7 +275,7 @@
 
 /* job cleanup before shell exit */
 void
-j_exit()
+j_exit(void)
 {
 	/* kill stopped, and possibly running, jobs */
 	Job	*j;
@@ -329,7 +325,7 @@
 #ifdef JOBS
 /* turn job control on or off according to Flag(FMONITOR) */
 void
-j_change()
+j_change(void)
 {
 	int i;
 
@@ -424,10 +420,7 @@
 
 /* execute tree in child subprocess */
 int
-exchild(t, flags, close_fd)
-	struct op	*t;
-	int		flags;
-	int		close_fd;	/* used if XPCLOSE or XCCLOSE */
+exchild(struct op *t, int flags, int close_fd)
 {
 	static Proc	*last_proc;	/* for pipelines */
 
@@ -684,7 +677,7 @@
 
 /* start the last job: only used for `command` jobs */
 void
-startlast()
+startlast(void)
 {
 #ifdef JOB_SIGS
 	sigset_t omask;
@@ -704,7 +697,7 @@
 
 /* wait for last job: only used for `command` jobs */
 int
-waitlast()
+waitlast(void)
 {
 	int	rv;
 	Job	*j;
@@ -737,9 +730,7 @@
 
 /* wait for child, interruptable. */
 int
-waitfor(cp, sigp)
-	const char *cp;
-	int	*sigp;
+waitfor(const char *cp, int	*sigp)
 {
 	int	rv;
 	Job	*j;
@@ -800,9 +791,7 @@
 
 /* kill (built-in) a job */
 int
-j_kill(cp, sig)
-	const char *cp;
-	int	sig;
+j_kill(const char *cp, int sig)
 {
 	Job	*j;
 	Proc	*p;
@@ -849,9 +838,7 @@
 #ifdef JOBS
 /* fg and bg built-ins: called only if Flag(FMONITOR) set */
 int
-j_resume(cp, bg)
-	const char *cp;
-	int	bg;
+j_resume(const char *cp, int bg)
 {
 	Job	*j;
 	Proc	*p;
@@ -957,7 +944,7 @@
 
 /* are there any running or stopped jobs ? */
 int
-j_stopped_running()
+j_stopped_running(void)
 {
 	Job	*j;
 	int	which = 0;
@@ -984,10 +971,7 @@
 
 /* list jobs for jobs built-in */
 int
-j_jobs(cp, slp, nflag)
-	const char *cp;
-	int	slp;		/* 0: short, 1: long, 2: pgrp */
-	int	nflag;
+j_jobs(const char *cp, int slp, int nflag)
 {
 	Job	*j, *tmp;
 	int	how;
@@ -1040,7 +1024,7 @@
 
 /* list jobs for top-level notification */
 void
-j_notify()
+j_notify(void)
 {
 	Job	*j, *tmp;
 #ifdef JOB_SIGS
@@ -1072,7 +1056,7 @@
 
 /* Return pid of last process in last asynchornous job */
 pid_t
-j_async()
+j_async(void)
 {
 #ifdef JOB_SIGS
 	sigset_t omask;
@@ -1095,8 +1079,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-j_set_async(j)
-	Job *j;
+j_set_async(Job *j)
 {
 	Job	*jl, *oldest;
 
@@ -1131,8 +1114,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-j_startjob(j)
-	Job *j;
+j_startjob(Job *j)
 {
 	Proc	*p;
 
@@ -1162,10 +1144,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static int
-j_waitj(j, flags, where)
-	Job	*j;
-	int	flags;		/* see JW_* */
-	const char *where;
+j_waitj(Job *j, int flags, const char *where)
 {
 	int	rv;
 
@@ -1300,8 +1279,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static RETSIGTYPE
-j_sigchld(sig)
-	int	sig;
+j_sigchld(int sig)
 {
 	int		errno_ = errno;
 	Job		*j;
@@ -1387,8 +1365,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-check_job(j)
-	Job	*j;
+check_job(Job *j)
 {
 	int	jstate;
 	Proc	*p;
@@ -1496,10 +1473,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-j_print(j, how, shf)
-	Job		*j;
-	int		how;
-	struct shf	*shf;
+j_print(Job *j, int how, struct shf *shf)
 {
 	Proc	*p;
 	int	state;
@@ -1605,9 +1579,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static Job *
-j_lookup(cp, ecodep)
-	const char *cp;
-	int	*ecodep;
+j_lookup(const char *cp, int *ecodep)
 {
 	Job		*j, *last_match;
 	Proc		*p;
@@ -1700,7 +1672,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static Job *
-new_job()
+new_job(void)
 {
 	int	i;
 	Job	*newj, *j;
@@ -1728,7 +1700,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static Proc *
-new_proc()
+new_proc(void)
 {
 	Proc	*p;
 
@@ -1747,9 +1719,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-remove_job(j, where)
-	Job	*j;
-	const char *where;
+remove_job(Job *j, const char *where)
 {
 	Proc	*p, *tmp;
 	Job	**prev, *curr;
@@ -1789,9 +1759,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-put_job(j, where)
-	Job	*j;
-	int	where;
+put_job(Job *j, int where)
 {
 	Job	**prev, *curr;
 
@@ -1826,8 +1794,7 @@
  * If jobs are compiled in then this routine expects sigchld to be blocked.
  */
 static void
-kill_job(j)
-	Job	*j;
+kill_job(Job *j)
 {
 	Proc	*p;
 
@@ -1838,10 +1805,7 @@
 
 /* put a more useful name on a process than snptreef does (in certain cases) */
 static void
-fill_command(c, len, t)
-	char		*c;
-	int		len;
-	struct op	*t;
+fill_command(char *c, int len, struct op *t)
 {
 	int		alen;
 	char		**ap;
--- a/sys/src/ape/cmd/pdksh/lex.c
+++ b/sys/src/ape/cmd/pdksh/lex.c
@@ -95,8 +95,7 @@
  */
 
 int
-yylex(cf)
-	int cf;
+yylex(int cf)
 {
 	Lex_state states[STATE_BSIZE], *statep;
 	State_info state_info;
@@ -764,7 +763,7 @@
 }
 
 static void
-gethere()
+gethere(void)
 {
 	register struct ioword **p;
 
@@ -778,8 +777,7 @@
  */
 
 static void
-readhere(iop)
-	struct ioword *iop;
+readhere(struct ioword *iop)
 {
 	register int c;
 	char *volatile eof;
@@ -864,9 +862,7 @@
  */
 
 Source *
-pushs(type, areap)
-	int type;
-	Area *areap;
+pushs(int type, Area *areap)
 {
 	register Source *s;
 
@@ -889,7 +885,7 @@
 }
 
 static int
-getsc__()
+getsc__(void)
 {
 	register Source *s = source;
 	register int c;
@@ -990,8 +986,7 @@
 }
 
 static void
-getsc_line(s)
-	Source *s;
+getsc_line(Source *s)
 {
 	char *xp = Xstring(s->xs, xp);
 	int interactive = Flag(FTALKING) && s->type == SSTDIN;
@@ -1103,9 +1098,7 @@
 }
 
 void
-set_prompt(to, s)
-	int to;
-	Source *s;
+set_prompt(int to, Source *s)
 {
 	cur_prompt = to;
 
@@ -1161,9 +1154,7 @@
 
 /* See also related routine, promptlen() in edit.c */
 void
-pprompt(cp, ntruncate)
-	const char *cp;
-	int ntruncate;
+pprompt(const char *cp, int ntruncate)
 {
 #if 0
 	char nbuf[32];
@@ -1207,9 +1198,7 @@
  * the :[-+?=#%] or close-brace.
  */
 static char *
-get_brace_var(wsp, wp)
-	XString *wsp;
-	char *wp;
+get_brace_var(XString *wsp, char *wp)
 {
 	enum parse_state {
 			   PS_INITIAL, PS_SAW_HASH, PS_IDENT,
@@ -1284,8 +1273,7 @@
  * (Returned string double null terminated)
  */
 static int
-arraysub(strp)
-	char **strp;
+arraysub(char **strp)
 {
 	XString ws;
 	char	*wp;
@@ -1312,8 +1300,7 @@
 
 /* Unget a char: handles case when we are already at the start of the buffer */
 static const char *
-ungetsc(c)
-	int c;
+ungetsc(int c)
 {
 	if (backslash_skip)
 		backslash_skip--;
@@ -1365,9 +1352,7 @@
 }
 
 static Lex_state *
-push_state_(si, old_end)
-	State_info *si;
-	Lex_state *old_end;
+push_state_(State_info *si, Lex_state *old_end)
 {
 	Lex_state	*new = alloc(sizeof(Lex_state) * STATE_BSIZE, ATEMP);
 
@@ -1378,9 +1363,7 @@
 }
 
 static Lex_state *
-pop_state_(si, old_end)
-	State_info *si;
-	Lex_state *old_end;
+pop_state_(State_info *si, Lex_state *old_end)
 {
 	Lex_state *old_base = si->base;
 
--- a/sys/src/ape/cmd/pdksh/mail.c
+++ b/sys/src/ape/cmd/pdksh/mail.c
@@ -35,7 +35,7 @@
 static void     mprintit    ARGS((mbox_t *mbp));
 
 void
-mcheck()
+mcheck(void)
 {
 	register mbox_t	*mbp;
 	time_t		 now;
@@ -79,15 +79,13 @@
 }
 
 void
-mcset(interval)
-	long interval;
+mcset(long interval)
 {
 	mailcheck_interval = interval;
 }
 
 void
-mbset(p)
-	register char	*p;
+mbset(register char	*p)
 {
 	struct stat	stbuf;
 
@@ -105,8 +103,7 @@
 }
 
 void
-mpset(mptoparse)
-	register char	*mptoparse;
+mpset(register char	*mptoparse)
 {
 	register mbox_t	*mbp;
 	register char	*mpath, *mmsg, *mval;
@@ -145,8 +142,7 @@
 }
 
 static void
-munset(mlist)
-register mbox_t	*mlist;
+munset(mbox_t *mlist)
 {
 	register mbox_t	*mbp;
 
@@ -160,9 +156,7 @@
 }
 
 static mbox_t *
-mballoc(p, m)
-	char	*p;
-	char	*m;
+mballoc(char *p, char *m)
 {
 	struct stat	stbuf;
 	register mbox_t	*mbp;
@@ -179,8 +173,7 @@
 }
 
 static void
-mprintit( mbp )
-mbox_t	*mbp;
+mprintit(mbox_t *mbp)
 {
 	struct tbl	*vp;
 
--- a/sys/src/ape/cmd/pdksh/main.c
+++ b/sys/src/ape/cmd/pdksh/main.c
@@ -79,9 +79,7 @@
 };
 
 int
-main(argc, argv)
-	int argc;
-	register char **argv;
+main(int argc, register char **argv)
 {
 	register int i;
 	int argi;
@@ -431,11 +429,7 @@
 }
 
 int
-include(name, argc, argv, intr_ok)
-	const char *name;
-	int argc;
-	char **argv;
-	int intr_ok;
+include(const char *name, int argc, char **argv, int intr_ok)
 {
 	register Source *volatile s = NULL;
 	Source *volatile sold;
@@ -507,8 +501,7 @@
 }
 
 int
-command(comm)
-	const char *comm;
+command(const char *comm)
 {
 	register Source *s;
 
@@ -521,9 +514,7 @@
  * run the commands from the input source, returning status.
  */
 int
-shell(s, toplevel)
-	Source *volatile s;		/* input source */
-	int volatile toplevel;
+shell(Source *s, int toplevel)
 {
 	struct op *t;
 	volatile int wastty = s->flags & SF_TTY;
@@ -626,8 +617,7 @@
 
 /* return to closest error handler or shell(), exit if none found */
 void
-unwind(i)
-	int i;
+unwind(int i)
 {
 	/* ordering for EXIT vs ERR is a bit odd (this is what at&t ksh does) */
 	if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR)
@@ -661,8 +651,7 @@
 }
 
 void
-newenv(type)
-	int type;
+newenv(int type)
 {
 	register struct env *ep;
 
@@ -678,7 +667,7 @@
 }
 
 void
-quitenv()
+quitenv(void)
 {
 	register struct env *ep = e;
 	register int fd;
@@ -730,7 +719,7 @@
 
 /* Called after a fork to cleanup stuff left over from parents environment */
 void
-cleanup_parents_env()
+cleanup_parents_env(void)
 {
 	struct env *ep;
 	int fd;
@@ -755,7 +744,7 @@
 
 /* Called just before an execve cleanup stuff temporary files */
 void
-cleanup_proc_env()
+cleanup_proc_env(void)
 {
 	struct env *ep;
 
@@ -765,7 +754,7 @@
 
 /* remove temp files and free ATEMP Area */
 static void
-reclaim()
+reclaim(void)
 {
 	remove_temps(e->temps);
 	e->temps = NULL;
@@ -773,8 +762,7 @@
 }
 
 static void
-remove_temps(tp)
-	struct temp *tp;
+remove_temps(struct temp *tp)
 {
 #ifdef OS2
 	static struct temp *delayed_remove;
@@ -819,8 +807,7 @@
 
 /* Returns true if name refers to a restricted shell */
 static int
-is_restricted(name)
-	char *name;
+is_restricted(char *name)
 {
 	char *p;
 
@@ -837,9 +824,7 @@
 }
 
 void
-aerror(ap, msg)
-	Area *ap;
-	const char *msg;
+aerror(Area *ap, const char *msg)
 {
 	internal_errorf(1, "alloc: %s", msg);
 	errorf(null); /* this is never executed - keeps gcc quiet */
--- a/sys/src/ape/cmd/pdksh/misc.c
+++ b/sys/src/ape/cmd/pdksh/misc.c
@@ -23,9 +23,7 @@
  * Fast character classes
  */
 void
-setctypes(s, t)
-	register const char *s;
-	register int t;
+setctypes(register const char *s, register int t)
 {
 	register int i;
 
@@ -39,7 +37,7 @@
 }
 
 void
-initctypes()
+initctypes(void)
 {
 	register int c;
 
@@ -60,9 +58,7 @@
 /* convert unsigned long to base N string */
 
 char *
-ulton(n, base)
-	register unsigned long n;
-	int base;
+ulton(register unsigned long n, int base)
 {
 	register char *p;
 	static char buf [20];
@@ -77,9 +73,7 @@
 }
 
 char *
-str_save(s, ap)
-	register const char *s;
-	Area *ap;
+str_save(register const char *s, Area *ap)
 {
 	return s ? strcpy((char*) alloc((size_t)strlen(s)+1, ap), s) : NULL;
 }
@@ -89,10 +83,7 @@
  * (unless n < 0).
  */
 char *
-str_nsave(s, n, ap)
-	register const char *s;
-	int n;
-	Area *ap;
+str_nsave(register const char *s, int n, Area *ap)
 {
 	char *ns;
 
@@ -105,10 +96,7 @@
 
 /* called from expand.h:XcheckN() to grow buffer */
 char *
-Xcheck_grow_(xsp, xp, more)
-	XString *xsp;
-	char *xp;
-	int more;
+Xcheck_grow_(XString *xsp, char *xp, int more)
 {
 	char *old_beg = xsp->beg;
 
@@ -168,8 +156,7 @@
  * translate -o option into F* constant (also used for test -o option)
  */
 int
-option(n)
-	const char *n;
+option(const char *n)
 {
 	int i;
 
@@ -193,11 +180,7 @@
 
 /* format a single select menu item */
 static char *
-options_fmt_entry(arg, i, buf, buflen)
-	void *arg;
-	int i;
-	char *buf;
-	int buflen;
+options_fmt_entry(void *arg, int i, char *buf, int buflen)
 {
 	struct options_info *oi = (struct options_info *) arg;
 
@@ -208,8 +191,7 @@
 }
 
 static void
-printoptions(verbose)
-	int verbose;
+printoptions(int verbose)
 {
 	int i;
 
@@ -241,7 +223,7 @@
 }
 
 char *
-getoptions()
+getoptions(void)
 {
 	int i;
 	char m[(int) FNFLAGS + 1];
@@ -256,10 +238,7 @@
 
 /* change a Flag(*) value; takes care of special actions */
 void
-change_flag(f, what, newval)
-	enum sh_flag f;	/* flag to change */
-	int what;	/* what is changing the flag (command line vs set) */
-	int newval;
+change_flag(enum sh_flag f, int what, int newval)
 {
 	int oldval;
 
@@ -289,10 +268,7 @@
  * non-option arguments, -1 if there is an error.
  */
 int
-parse_args(argv, what, setargsp)
-	char **argv;
-	int	what;		/* OF_CMDLINE or OF_SET */
-	int	*setargsp;
+parse_args(char **argv, int what, int *setargsp)
 {
 	static char cmd_opts[NELEM(options) + 3]; /* o:\0 */
 	static char set_opts[NELEM(options) + 5]; /* Ao;s\0 */
@@ -427,9 +403,7 @@
 
 /* parse a decimal number: returns 0 if string isn't a number, 1 otherwise */
 int
-getn(as, ai)
-	const char *as;
-	int *ai;
+getn(const char *as, int *ai)
 {
 	const char *s;
 	register int n;
@@ -448,9 +422,7 @@
 
 /* getn() that prints error */
 int
-bi_getn(as, ai)
-	const char *as;
-	int *ai;
+bi_getn(const char *as, int *ai)
 {
 	int rv = getn(as, ai);
 
@@ -470,9 +442,7 @@
  */
 
 int
-gmatch(s, p, isfile)
-	const char *s, *p;
-	int isfile;
+gmatch(char *s, char *p, int isfile)
 {
 	const char *se, *pe;
 
@@ -513,8 +483,7 @@
 - return ?
 */
 int
-has_globbing(xp, xpe)
-	const char *xp, *xpe;
+has_globbing(const char *xp, const char *xpe)
 {
 	const unsigned char *p = (const unsigned char *) xp;
 	const unsigned char *pe = (const unsigned char *) xpe;
@@ -568,10 +537,7 @@
 
 /* Function must return either 0 or 1 (assumed by code for 0x80|'!') */
 static int
-do_gmatch(s, se, p, pe, isfile)
-	const unsigned char *s, *p;
-	const unsigned char *se, *pe;
-	int isfile;
+do_gmatch(unsigned char *s, unsigned char *se, const unsigned char *p, unsigned char *pe, int isfile)
 {
 	register int sc, pc;
 	const unsigned char *prest, *psub, *pnext;
@@ -703,9 +669,7 @@
 }
 
 static const unsigned char *
-cclass(p, sub)
-	const unsigned char *p;
-	register int sub;
+cclass(const unsigned char *p, register int sub)
 {
 	register int c, d, not, found = 0;
 	const unsigned char *orig_p = p;
@@ -750,10 +714,7 @@
 
 /* Look for next ) or | (if match_sep) in *(foo|bar) pattern */
 const unsigned char *
-pat_scan(p, pe, match_sep)
-	const unsigned char *p;
-	const unsigned char *pe;
-	int match_sep;
+pat_scan(const unsigned char *p, const unsigned char *pe, int match_sep)
 {
 	int nest = 0;
 
@@ -778,10 +739,7 @@
 static void qsort1 ARGS((void **base, void **lim, int (*f)(void *, void *)));
 
 void
-qsortp(base, n, f)
-	void **base;				/* base address */
-	size_t n;				/* elements */
-	int (*f) ARGS((void *, void *));	/* compare function */
+qsortp(void **base, size_t n, int (*f) ARGS((void *, void *)))
 {
 	qsort1(base, base + n, f);
 }
@@ -794,9 +752,7 @@
 }
 
 static void
-qsort1(base, lim, f)
-	void **base, **lim;
-	int (*f) ARGS((void *, void *));
+qsort1(void **base, void **lim, int (*f) ARGS((void *, void *)))
 {
 	register void **i, **j;
 	register void **lptr, **hptr;
@@ -865,8 +821,7 @@
 }
 
 int
-xstrcmp(p1, p2)
-	void *p1, *p2;
+xstrcmp(void *p1, void *p2)
 {
 	return (strcmp((char *)p1, (char *)p2));
 }
@@ -873,9 +828,7 @@
 
 /* Initialize a Getopt structure */
 void
-ksh_getopt_reset(go, flags)
-	Getopt *go;
-	int flags;
+ksh_getopt_reset(Getopt *go, int flags)
 {
 	go->optind = 1;
 	go->optarg = (char *) 0;
@@ -911,10 +864,7 @@
  *	  in go->info.
  */
 int
-ksh_getopt(argv, go, options)
-	char **argv;
-	Getopt *go;
-	const char *options;
+ksh_getopt(char **argv, Getopt *go, const char *options)
 {
 	char c;
 	char *o;
@@ -1014,8 +964,7 @@
  * No trailing newline is printed.
  */
 void
-print_value_quoted(s)
-	const char *s;
+print_value_quoted(const char *s)
 {
 	const char *p;
 	int inquote = 0;
@@ -1048,12 +997,7 @@
  * element
  */
 void
-print_columns(shf, n, func, arg, max_width)
-	struct shf *shf;
-	int n;
-	char *(*func) ARGS((void *, int, char *, int));
-	void *arg;
-	int max_width;
+print_columns(struct shf *shf, int n, char *(*func) ARGS((void *, int, char *, int)), void *arg, int max_width)
 {
 	char *str = (char *) alloc(max_width + 1, ATEMP);
 	int i;
@@ -1099,9 +1043,7 @@
 
 /* Strip any nul bytes from buf - returns new length (nbytes - # of nuls) */
 int
-strip_nuls(buf, nbytes)
-	char *buf;
-	int nbytes;
+strip_nuls(char *buf, int nbytes)
 {
 	char *dst;
 
@@ -1132,10 +1074,7 @@
  * Returns dst.
  */
 char *
-str_zcpy(dst, src, dsize)
-	char *dst;
-	const char *src;
-	int dsize;
+str_zcpy(char *dst, const char *src, int dsize)
 {
 	if (dsize > 0) {
 		int len = strlen(src);
@@ -1152,10 +1091,7 @@
  * and restarts read.
  */
 int
-blocking_read(fd, buf, nbytes)
-	int fd;
-	char *buf;
-	int nbytes;
+blocking_read(int fd, char *buf, int nbytes)
 {
 	int ret;
 	int tried_reset = 0;
@@ -1184,8 +1120,7 @@
  * 1 if it was.
  */
 int
-reset_nonblock(fd)
-	int fd;
+reset_nonblock(int fd)
 {
 	int flags;
 	int blocking_flags;
@@ -1241,9 +1176,7 @@
 
 /* Like getcwd(), except bsize is ignored if buf is 0 (MAXPATHLEN is used) */
 char *
-ksh_get_wd(buf, bsize)
-	char *buf;
-	int bsize;
+ksh_get_wd(char *buf, int bsize)
 {
 #ifdef HAVE_GETCWD
 	char *b;
--- a/sys/src/ape/cmd/pdksh/path.c
+++ b/sys/src/ape/cmd/pdksh/path.c
@@ -64,12 +64,7 @@
  *	was appened to result.
  */
 int
-make_path(cwd, file, cdpathp, xsp, phys_pathp)
-	const char *cwd;
-	const char *file;
-	char	**cdpathp;	/* & of : separated list */
-	XString	*xsp;
-	int	*phys_pathp;
+make_path(const char *cwd, const char *file, char **cdpathp, XString *xsp, int *phys_pathp)
 {
 	int	rval = 0;
 	int	use_cdpath = 1;
@@ -142,8 +137,7 @@
  * ie, simplify_path("/a/b/c/./../d/..") returns "/a/b"
  */
 void
-simplify_path(path)
-	char	*path;
+simplify_path(char *path)
 {
 	char	*cur;
 	char	*t;
@@ -225,8 +219,7 @@
 
 
 void
-set_current_wd(path)
-	char *path;
+set_current_wd(char *path)
 {
 	int len;
 	char *p = path;
@@ -245,8 +238,7 @@
 
 #ifdef S_ISLNK
 char *
-get_phys_path(path)
-	const char *path;
+get_phys_path(const char *path)
 {
 	XString xs;
 	char *xp;
@@ -266,10 +258,7 @@
 }
 
 static char *
-do_phys_path(xsp, xp, path)
-	XString *xsp;
-	char *xp;
-	const char *path;
+do_phys_path(XString *xsp, char *xp, const char *path)
 {
 	const char *p, *q;
 	int len, llen;
--- a/sys/src/ape/cmd/pdksh/shf.c
+++ b/sys/src/ape/cmd/pdksh/shf.c
@@ -25,11 +25,7 @@
  * fails.
  */
 struct shf *
-shf_open(name, oflags, mode, sflags)
-	const char *name;
-	int oflags;
-	int mode;
-	int sflags;
+shf_open(const char *name, int oflags, int mode, int sflags)
 {
 	struct shf *shf;
 	int bsize = sflags & SHF_UNBUF ? (sflags & SHF_RD ? 1 : 0) : SHF_BSIZE;
@@ -69,10 +65,7 @@
 
 /* Set up the shf structure for a file descriptor.  Doesn't fail. */
 struct shf *
-shf_fdopen(fd, sflags, shf)
-	int fd;
-	int sflags;
-	struct shf *shf;
+shf_fdopen(int fd, int sflags, struct shf *shf)
 {
 	int bsize = sflags & SHF_UNBUF ? (sflags & SHF_RD ? 1 : 0) : SHF_BSIZE;
 
@@ -122,10 +115,7 @@
 
 /* Set up an existing shf (and buffer) to use the given fd */
 struct shf *
-shf_reopen(fd, sflags, shf)
-	int fd;
-	int sflags;
-	struct shf *shf;
+shf_reopen(int fd, int sflags, struct shf *shf)
 {
 	int bsize = sflags & SHF_UNBUF ? (sflags & SHF_RD ? 1 : 0) : SHF_BSIZE;
 
@@ -172,11 +162,7 @@
  * When writing, a byte is reserved for a trailing null - see shf_sclose().
  */
 struct shf *
-shf_sopen(buf, bsize, sflags, shf)
-	char *buf;
-	int bsize;
-	int sflags;
-	struct shf *shf;
+shf_sopen(char *buf, int bsize, int sflags, struct shf *shf)
 {
 	/* can't have a read+write string */
 	if (!(sflags & (SHF_RD | SHF_WR))
@@ -209,8 +195,7 @@
 
 /* Flush and close file descriptor, free the shf structure */
 int
-shf_close(shf)
-	struct shf *shf;
+shf_close(struct shf *shf)
 {
 	int ret = 0;
 
@@ -229,8 +214,7 @@
 
 /* Flush and close file descriptor, don't free file structure */
 int
-shf_fdclose(shf)
-	struct shf *shf;
+shf_fdclose(struct shf *shf)
 {
 	int ret = 0;
 
@@ -252,8 +236,7 @@
  * (does not free string if it was allocated).
  */
 char *
-shf_sclose(shf)
-	struct shf *shf;
+shf_sclose(struct shf *shf)
 {
 	unsigned char *s = shf->buf;
 
@@ -269,8 +252,7 @@
 
 /* Flush and free file structure, don't close file descriptor */
 int
-shf_finish(shf)
-	struct shf *shf;
+shf_finish(struct shf *shf)
 {
 	int ret = 0;
 
@@ -288,8 +270,7 @@
  * buffered.  Returns 0 for success, EOF for (write) error.
  */
 int
-shf_flush(shf)
-	struct shf *shf;
+shf_flush(struct shf *shf)
 {
 	if (shf->flags & SHF_STRING)
 		return (shf->flags & SHF_WR) ? EOF : 0;
@@ -320,9 +301,7 @@
  * buffer.  Returns 0 for success, EOF for (write) error.
  */
 static int
-shf_emptybuf(shf, flags)
-	struct shf *shf;
-	int flags;
+shf_emptybuf(struct shf *shf, int flags)
 {
 	int ret = 0;
 
@@ -403,8 +382,7 @@
 
 /* Fill up a read buffer.  Returns EOF for a read error, 0 otherwise. */
 static int
-shf_fillbuf(shf)
-	struct shf *shf;
+shf_fillbuf(struct shf *shf)
 {
 	if (shf->flags & SHF_STRING)
 		return 0;
@@ -450,10 +428,7 @@
  * buffer.  Returns 0 for success, EOF otherwise.
  */
 int
-shf_seek(shf, where, from)
-	struct shf *shf;
-	off_t where;
-	int from;
+shf_seek(struct shf *shf, off_t where, int from)
 {
 	if (shf->fd < 0) {
 		errno = EINVAL;
@@ -498,10 +473,7 @@
  * a read error occurred.
  */
 int
-shf_read(buf, bsize, shf)
-	char *buf;
-	int bsize;
-	struct shf *shf;
+shf_read(char *buf, int bsize, struct shf *shf)
 {
 	int orig_bsize = bsize;
 	int ncopy;
@@ -535,10 +507,7 @@
  * end of file, returns a pointer to the null byte in buf otherwise.
  */
 char *
-shf_getse(buf, bsize, shf)
-	char *buf;
-	int bsize;
-	struct shf *shf;
+shf_getse(char *buf, int bsize, struct shf *shf)
 {
 	unsigned char *end;
 	int ncopy;
@@ -585,8 +554,7 @@
 
 /* Returns the char read.  Returns EOF for error and end of file. */
 int
-shf_getchar(shf)
-	struct shf *shf;
+shf_getchar(struct shf *shf)
 {
 	if (!(shf->flags & SHF_RD))
 		internal_errorf(1, "shf_getchar: flags %x", shf->flags);
@@ -601,9 +569,7 @@
  * successful, EOF if there is no room.
  */
 int
-shf_ungetc(c, shf)
-	int c;
-	struct shf *shf;
+shf_ungetc(int c, struct shf *shf)
 {
 	if (!(shf->flags & SHF_RD))
 		internal_errorf(1, "shf_ungetc: flags %x", shf->flags);
@@ -638,9 +604,7 @@
  * the char could not be written.
  */
 int
-shf_putchar(c, shf)
-	int c;
-	struct shf *shf;
+shf_putchar(int c, struct shf *shf)
 {
 	if (!(shf->flags & SHF_WR))
 		internal_errorf(1, "shf_putchar: flags %x", shf->flags);
@@ -682,9 +646,7 @@
  * the string could not be written.
  */
 int
-shf_puts(s, shf)
-	const char *s;
-	struct shf *shf;
+shf_puts(const char *s, struct shf *shf)
 {
 	if (!s)
 		return EOF;
@@ -694,10 +656,7 @@
 
 /* Write a buffer.  Returns nbytes if successful, EOF if there is an error. */
 int
-shf_write(buf, nbytes, shf)
-	const char *buf;
-	int nbytes;
-	struct shf *shf;
+shf_write(const char *buf, int nbytes, struct shf *shf)
 {
 	int orig_nbytes = nbytes;
 	int n;
@@ -871,8 +830,7 @@
 #include <math.h>
 
 static double
-my_ceil(d)
-	double	d;
+my_ceil(double d)
 {
 	double		i;
 
@@ -881,10 +839,7 @@
 #endif /* FP */
 
 int
-shf_vfprintf(shf, fmt, args)
-	struct shf *shf;
-	const char *fmt;
-	va_list args;
+shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
 {
 	char		c, *s;
 	int		UNINITIALIZED(tmp);
--- a/sys/src/ape/cmd/pdksh/syn.c
+++ b/sys/src/ape/cmd/pdksh/syn.c
@@ -58,7 +58,7 @@
 	((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
 
 static void
-yyparse()
+yyparse(void)
 {
 	int c;
 
@@ -73,8 +73,7 @@
 }
 
 static struct op *
-pipeline(cf)
-	int cf;
+pipeline(int cf)
 {
 	register struct op *t, *p, *tl = NULL;
 
@@ -94,7 +93,7 @@
 }
 
 static struct op *
-andor()
+andor(void)
 {
 	register struct op *t, *p;
 	register int c;
@@ -112,8 +111,7 @@
 }
 
 static struct op *
-c_list(multi)
-	int multi;
+c_list(int multi)
 {
 	register struct op *t = NULL, *p, *tl = NULL;
 	register int c;
@@ -150,8 +148,7 @@
 }
 
 static struct ioword *
-synio(cf)
-	int cf;
+synio(int cf)
 {
 	register struct ioword *iop;
 	int ishere;
@@ -175,8 +172,7 @@
 }
 
 static void
-musthave(c, cf)
-	int c, cf;
+musthave(int c, int cf)
 {
 	if ((token(cf)) != c)
 		syntaxerr((char *) 0);
@@ -183,8 +179,7 @@
 }
 
 static struct op *
-nested(type, smark, emark)
-	int type, smark, emark;
+nested(int type, int smark, int emark)
 {
 	register struct op *t;
 	struct nesting_state old_nesting;
@@ -197,8 +192,7 @@
 }
 
 static struct op *
-get_command(cf)
-	int cf;
+get_command(int cf)
 {
 	register struct op *t;
 	register int c, iopn = 0, syniocf;
@@ -414,7 +408,7 @@
 }
 
 static struct op *
-dogroup()
+dogroup(void)
 {
 	register int c;
 	register struct op *list;
@@ -437,7 +431,7 @@
 }
 
 static struct op *
-thenpart()
+thenpart(void)
 {
 	register struct op *t;
 
@@ -451,7 +445,7 @@
 }
 
 static struct op *
-elsepart()
+elsepart(void)
 {
 	register struct op *t;
 
@@ -474,7 +468,7 @@
 }
 
 static struct op *
-caselist()
+caselist(void)
 {
 	register struct op *t, *tl;
 	int c;
@@ -500,8 +494,7 @@
 }
 
 static struct op *
-casepart(endtok)
-	int endtok;
+casepart(int endtok)
 {
 	register struct op *t;
 	register int c;
@@ -529,9 +522,7 @@
 }
 
 static struct op *
-function_body(name, ksh_func)
-	char *name;
-	int ksh_func;	/* function foo { ... } vs foo() { .. } */
+function_body(char *name, int ksh_func)
 {
 	char *sname, *p;
 	struct op *t;
@@ -590,7 +581,7 @@
 }
 
 static char **
-wordlist()
+wordlist(void)
 {
 	register int c;
 	XPtrV args;
@@ -620,10 +611,7 @@
  */
 
 static struct op *
-block(type, t1, t2, wp)
-	int type;
-	struct op *t1, *t2;
-	char **wp;
+block(int type, struct op *t1, struct op *t2, char **wp)
 {
 	register struct op *t;
 
@@ -678,7 +666,7 @@
 };
 
 void
-initkeywords()
+initkeywords(void)
 {
 	register struct tokeninfo const *tt;
 	register struct tbl *p;
@@ -695,8 +683,7 @@
 }
 
 static void
-syntaxerr(what)
-	const char *what;
+syntaxerr(const char *what)
 {
 	char redir[6];	/* 2<<- is the longest redirection, I think */
 	const char *s;
@@ -748,9 +735,7 @@
 }
 
 static void
-nesting_push(save, tok)
-	struct nesting_state *save;
-	int tok;
+nesting_push(struct nesting_state *save, int tok)
 {
 	*save = nesting;
 	nesting.start_token = tok;
@@ -758,15 +743,13 @@
 }
 
 static void
-nesting_pop(saved)
-	struct nesting_state *saved;
+nesting_pop(struct nesting_state *saved)
 {
 	nesting = *saved;
 }
 
 static struct op *
-newtp(type)
-	int type;
+newtp(int type)
 {
 	register struct op *t;
 
@@ -781,8 +764,7 @@
 }
 
 struct op *
-compile(s)
-	Source *s;
+compile(Source *s)
 {
 	nesting.start_token = 0;
 	nesting.start_line = 0;
@@ -803,8 +785,7 @@
  *	$ 
  */
 static int
-assign_command(s)
-	char *s;
+assign_command(char *s)
 {
 	char c = *s;
 
@@ -818,8 +799,7 @@
 
 /* Check if we are in the middle of reading an alias */
 static int
-inalias(s)
-	struct source *s;
+inalias(struct source *s)
 {
 	for (; s && s->type == SALIAS; s = s->next)
 		if (!(s->flags & SF_ALIASEND))
@@ -852,9 +832,7 @@
  * TM_UNOP and TM_BINOP, the returned value is a Test_op).
  */
 static int
-dbtestp_isa(te, meta)
-	Test_env *te;
-	Test_meta meta;
+dbtestp_isa(Test_env *te, Test_meta meta)
 {
 	int c = tpeek(ARRAYVAR | (meta == TM_BINOP ? 0 : CONTIN));
 	int uqword = 0;
@@ -898,10 +876,7 @@
 }
 
 static const char *
-dbtestp_getopnd(te, op, do_eval)
-	Test_env *te;
-	Test_op op;
-	int do_eval;
+dbtestp_getopnd(Test_env *te, Test_op op, int do_eval)
 {
 	int c = tpeek(ARRAYVAR);
 
@@ -915,21 +890,13 @@
 }
 
 static int
-dbtestp_eval(te, op, opnd1, opnd2, do_eval)
-	Test_env *te;
-	Test_op op;
-	const char *opnd1;
-	const char *opnd2;
-	int do_eval;
+dbtestp_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, int do_eval)
 {
 	return 1;
 }
 
 static void
-dbtestp_error(te, offset, msg)
-	Test_env *te;
-	int offset;
-	const char *msg;
+dbtestp_error(Test_env *te, int offset, const char *msg)
 {
 	te->flags |= TEF_ERROR;
 
--- a/sys/src/ape/cmd/pdksh/table.c
+++ b/sys/src/ape/cmd/pdksh/table.c
@@ -11,8 +11,7 @@
 
 
 unsigned int
-hash(n)
-	register const char * n;
+hash(register const char * n)
 {
 	register unsigned int h = 0;
 
@@ -22,10 +21,7 @@
 }
 
 void
-tinit(tp, ap, tsize)
-	register struct table *tp;
-	register Area *ap;
-	int tsize;
+tinit(register struct table *tp, register Area *ap, int tsize)
 {
 	tp->areap = ap;
 	tp->tbls = NULL;
@@ -35,9 +31,7 @@
 }
 
 static void
-texpand(tp, nsize)
-	register struct table *tp;
-	int nsize;
+texpand(register struct table *tp, int nsize)
 {
 	register int i;
 	register struct tbl *tblp, **p;
@@ -69,10 +63,7 @@
 }
 
 struct tbl *
-tsearch(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
-	unsigned int h;			/* hash(n) */
+tsearch(struct table *tp, const char *n, unsigned int h)
 {
 	register struct tbl **pp, *p;
 
@@ -92,10 +83,7 @@
 }
 
 struct tbl *
-tenter(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
-	unsigned int h;			/* hash(n) */
+tenter(struct table *tp, const char *n, unsigned int h)
 {
 	register struct tbl **pp, *p;
 	register int len;
@@ -134,16 +122,13 @@
 }
 
 void
-tdelete(p)
-	register struct tbl *p;
+tdelete(register struct tbl *p)
 {
 	p->flag = 0;
 }
 
 void
-twalk(ts, tp)
-	struct tstate *ts;
-	struct table *tp;
+twalk(struct tstate *ts, struct table *tp)
 {
 	ts->left = tp->size;
 	ts->next = tp->tbls;
@@ -150,8 +135,7 @@
 }
 
 struct tbl *
-tnext(ts)
-	struct tstate *ts;
+tnext(struct tstate *ts)
 {
 	while (--ts->left >= 0) {
 		struct tbl *p = *ts->next++;
@@ -162,15 +146,13 @@
 }
 
 static int
-tnamecmp(p1, p2)
-	void *p1, *p2;
+tnamecmp(void *p1, void *p2)
 {
 	return strcmp(((struct tbl *)p1)->name, ((struct tbl *)p2)->name);
 }
 
 struct tbl **
-tsort(tp)
-	register struct table *tp;
+tsort(register struct table *tp)
 {
 	register int i;
 	register struct tbl **p, **sp, **dp;
@@ -193,8 +175,7 @@
 void tprintinfo ARGS((struct table *tp));
 
 void
-tprintinfo(tp)
-	struct table *tp;
+tprintinfo(struct table *tp)
 {
 	struct tbl *te;
 	char *n;
--- a/sys/src/ape/cmd/pdksh/trap.c
+++ b/sys/src/ape/cmd/pdksh/trap.c
@@ -39,7 +39,7 @@
 static struct sigaction Sigact_ign, Sigact_trap;
 
 void
-inittraps()
+inittraps(void)
 {
 #ifdef HAVE_SYS_SIGLIST
 # ifndef SYS_SIGLIST_DECLARED
@@ -76,7 +76,7 @@
 static RETSIGTYPE alarm_catcher ARGS((int sig));
 
 void
-alarm_init()
+alarm_init(void)
 {
 	sigtraps[SIGALRM].flags |= TF_SHELL_USES;
 	setsig(&sigtraps[SIGALRM], alarm_catcher,
@@ -84,8 +84,7 @@
 }
 
 static RETSIGTYPE
-alarm_catcher(sig)
-	int sig;
+alarm_catcher(int sig)
 {
 	if (ksh_tmout_state == TMOUT_READING) {
 		int left = alarm(0);
@@ -101,9 +100,7 @@
 #endif /* KSH */
 
 Trap *
-gettrap(name, igncase)
-	const char *name;
-	int igncase;
+gettrap(const char *name, int igncase)
 {
 	int i;
 	register Trap *p;
@@ -126,8 +123,7 @@
  * trap signal handler
  */
 RETSIGTYPE
-trapsig(i)
-	int i;
+trapsig(int i)
 {
 	Trap *p = &sigtraps[i];
 
@@ -151,7 +147,7 @@
  * work if user has trapped SIGINT.
  */
 void
-intrcheck()
+intrcheck(void)
 {
 	if (intrsig)
 		runtraps(TF_DFL_INTR|TF_FATAL);
@@ -161,7 +157,7 @@
  * termination has been received.
  */
 int
-fatal_trap_check()
+fatal_trap_check(void)
 {
 	int i;
 	Trap *p;
@@ -179,7 +175,7 @@
  * is set.
  */
 int
-trap_pending()
+trap_pending(void)
 {
 	int i;
 	Trap *p;
@@ -197,8 +193,7 @@
  * can interrupt commands.
  */
 void
-runtraps(flag)
-	int flag;
+runtraps(int flag)
 {
 	int i;
 	register Trap *p;
@@ -227,8 +222,7 @@
 }
 
 void
-runtrap(p)
-	Trap *p;
+runtrap(Trap *p)
 {
 	int	i = p->signal;
 	char	*trapstr = p->trap;
@@ -274,7 +268,7 @@
  
 /* clear pending traps and reset user's trap handlers; used after fork(2) */
 void
-cleartraps()
+cleartraps(void)
 {
 	int i;
 	Trap *p;
@@ -291,7 +285,7 @@
 
 /* restore signals just before an exec(2) */
 void
-restoresigs()
+restoresigs(void)
 {
 	int i;
 	Trap *p;
@@ -303,9 +297,7 @@
 }
 
 void
-settrap(p, s)
-	Trap *p;
-	char *s;
+settrap(Trap *p, char *s)
 {
 	handler_t f;
 
@@ -341,7 +333,7 @@
  * kill shell (unless user catches it and exits)
  */
 int
-block_pipe()
+block_pipe(void)
 {
 	int restore_dfl = 0;
 	Trap *p = &sigtraps[SIGPIPE];
@@ -359,8 +351,7 @@
 
 /* Called by c_print() to undo whatever block_pipe() did */
 void
-restore_pipe(restore_dfl)
-	int restore_dfl;
+restore_pipe(int restore_dfl)
 {
 	if (restore_dfl)
 		setsig(&sigtraps[SIGPIPE], SIG_DFL, SS_RESTORE_CURR);
@@ -371,10 +362,7 @@
  * FTALKING.
  */
 int
-setsig(p, f, flags)
-	Trap *p;
-	handler_t f;
-	int flags;
+setsig(Trap *p, handler_t f, int flags)
 {
 	struct sigaction sigact;
 
@@ -425,9 +413,7 @@
 
 /* control what signal is set to before an exec() */
 void
-setexecsig(p, restore)
-	Trap *p;
-	int restore;
+setexecsig(Trap *p, int restore)
 {
 	/* XXX debugging */
 	if (!(p->flags & (TF_ORIG_IGN|TF_ORIG_DFL)))
--- a/sys/src/ape/cmd/pdksh/tree.c
+++ b/sys/src/ape/cmd/pdksh/tree.c
@@ -20,10 +20,7 @@
  */
 
 static void
-ptree(t, indent, shf)
-	register struct op *t;
-	int indent;
-	register struct shf *shf;
+ptree(register struct op *t, int indent, register struct shf *shf)
 {
 	register char **w;
 	struct ioword **ioact;
@@ -207,10 +204,7 @@
 }
 
 static void
-pioact(shf, indent, iop)
-	register struct shf *shf;
-	int indent;
-	register struct ioword *iop;
+pioact(register struct shf *shf, int indent, register struct ioword *iop)
 {
 	int flag = iop->flag;
 	int type = flag & IOTYPE;
@@ -268,9 +262,7 @@
  */
 
 static void
-tputC(c, shf)
-	register int c;
-	register struct shf *shf;
+tputC(int c, struct shf *shf)
 {
 	if ((c&0x60) == 0) {		/* C0|C1 */
 		tputc((c&0x80) ? '$' : '^', shf);
@@ -283,9 +275,7 @@
 }
 
 static void
-tputS(wp, shf)
-	register char *wp;
-	register struct shf *shf;
+tputS(char *wp, struct shf *shf)
 {
 	register int c, quoted=0;
 
@@ -411,11 +401,7 @@
 }
 
 static void
-vfptreef(shf, indent, fmt, va)
-	register struct shf *shf;
-	int indent;
-	const char *fmt;
-	register va_list va;
+vfptreef(register struct shf *shf, int indent, const char *fmt, register va_list va)
 {
 	register int c;
 
@@ -483,9 +469,7 @@
  */
 
 struct op *
-tcopy(t, ap)
-	register struct op *t;
-	Area *ap;
+tcopy(register struct op *t, Area *ap)
 {
 	register struct op *r;
 	register char **tw, **rw;
@@ -534,9 +518,7 @@
 }
 
 char *
-wdcopy(wp, ap)
-	const char *wp;
-	Area *ap;
+wdcopy(const char *wp, Area *ap)
 {
 	size_t len = wdscan(wp, EOS) - wp;
 	return memcpy(alloc(len, ap), wp, len);
@@ -544,9 +526,7 @@
 
 /* return the position of prefix c in wp plus 1 */
 char *
-wdscan(wp, c)
-	register const char *wp;
-	register int c;
+wdscan(register const char *wp, register int c)
 {
 	register int nest = 0;
 
@@ -602,8 +582,7 @@
  * (string is allocated from ATEMP)
  */
 char *
-wdstrip(wp)
-	const char *wp;
+wdstrip(const char *wp)
 {
 	struct shf shf;
 	int c;
@@ -670,9 +649,7 @@
 }
 
 static	struct ioword **
-iocopy(iow, ap)
-	register struct ioword **iow;
-	Area *ap;
+iocopy(register struct ioword **iow, Area *ap)
 {
 	register struct ioword **ior;
 	register int i;
@@ -705,9 +682,7 @@
  */
 
 void
-tfree(t, ap)
-	register struct op *t;
-	Area *ap;
+tfree(register struct op *t, Area *ap)
 {
 	register char **w;
 
@@ -739,9 +714,7 @@
 }
 
 static	void
-iofree(iow, ap)
-	struct ioword **iow;
-	Area *ap;
+iofree(struct ioword **iow, Area *ap)
 {
 	register struct ioword **iop;
 	register struct ioword *p;
--- a/sys/src/ape/cmd/pdksh/tty.c
+++ b/sys/src/ape/cmd/pdksh/tty.c
@@ -5,9 +5,7 @@
 #undef EXTERN
 
 int
-get_tty(fd, ts)
-	int fd;
-	TTY_state *ts;
+get_tty(int fd, TTY_state *ts)
 {
 	int ret;
 
@@ -35,10 +33,7 @@
 }
 
 int
-set_tty(fd, ts, flags)
-	int fd;
-	TTY_state *ts;
-	int flags;
+set_tty(int fd, TTY_state *ts, int flags)
 {
 	int ret = 0;
 
@@ -97,8 +92,7 @@
  * foreground job completion and for setting up tty process group.
  */
 void
-tty_init(init_ttystate)
-	int init_ttystate;
+tty_init(int init_ttystate)
 {
 	int	do_close = 1;
 	int	tfd;
@@ -168,7 +162,7 @@
 }
 
 void
-tty_close()
+tty_close(void)
 {
 	if (tty_fd >= 0) {
 		close(tty_fd);
--- a/sys/src/ape/cmd/pdksh/var.c
+++ b/sys/src/ape/cmd/pdksh/var.c
@@ -29,7 +29,7 @@
  * assume caller has allocated and set up e->loc
  */
 void
-newblock()
+newblock(void)
 {
 	register struct block *l;
 	static char *const empty[] = {null};
@@ -55,7 +55,7 @@
  * pop a block handling special variables
  */
 void
-popblock()
+popblock(void)
 {
 	register struct block *l = e->loc;
 	register struct tbl *vp, **vpp = l->vars.tbls, *vq;
@@ -76,7 +76,7 @@
 
 /* called by main() to initialize variable data structures */
 void
-initvar()
+initvar(void)
 {
 	static const struct {
 		const char *name;
@@ -153,8 +153,7 @@
  * Search for variable, if not found create globally.
  */
 struct tbl *
-global(n)
-	register const char *n;
+global(register const char *n)
 {
 	register struct block *l = e->loc;
 	register struct tbl *vp;
@@ -235,9 +234,7 @@
  * Search for local variable, if not found create locally.
  */
 struct tbl *
-local(n, copy)
-	register const char *n;
-	bool_t copy;
+local(register const char *n, bool_t copy)
 {
 	register struct block *l = e->loc;
 	register struct tbl *vp;
@@ -281,8 +278,7 @@
 
 /* get variable string value */
 char *
-str_val(vp)
-	register struct tbl *vp;
+str_val(register struct tbl *vp)
 {
 	char *s;
 
@@ -330,8 +326,7 @@
 
 /* get variable integer value, with error checking */
 long
-intval(vp)
-	register struct tbl *vp;
+intval(register struct tbl *vp)
 {
 	long num;
 	int base;
@@ -345,10 +340,7 @@
 
 /* set variable to string value */
 int
-setstr(vq, s, error_ok)
-	register struct tbl *vq;
-	const char *s;
-	int error_ok;
+setstr(register struct tbl *vq, const char *s, int error_ok)
 {
 	if (vq->flag & RDONLY) {
 		warningf(TRUE, "%s: is read only", vq->name);
@@ -388,9 +380,7 @@
 
 /* set variable to integer */
 void
-setint(vq, n)
-	register struct tbl *vq;
-	long n;
+setint(register struct tbl *vq, long n)
 {
 	if (!(vq->flag&INTEGER)) {
 		register struct tbl *vp = &vtemp;
@@ -408,9 +398,7 @@
 }
 
 int
-getint(vp, nump)
-	struct tbl *vp;
-	long *nump;
+getint(struct tbl *vp, long *nump)
 {
 	register char *s;
 	register int c;
@@ -467,8 +455,7 @@
  * (vq and vp may be the same)
  */
 struct tbl *
-setint_v(vq, vp)
-	register struct tbl *vq, *vp;
+setint_v(register struct tbl *vq, struct tbl *vp)
 {
 	int base;
 	long num;
@@ -489,9 +476,7 @@
 }
 
 static char *
-formatstr(vp, s)
-	struct tbl *vp;
-	const char *s;
+formatstr(struct tbl *vp, const char *s)
 {
 	int olen, nlen;
 	char *p, *q;
@@ -553,9 +538,7 @@
  * make vp->val.s be "name=value" for quick exporting.
  */
 static void
-export(vp, val)
-	register struct tbl *vp;
-	const char *val;
+export(register struct tbl *vp, const char *val)
 {
 	register char *xp;
 	char *op = (vp->flag&ALLOC) ? vp->val.s : NULL;
@@ -579,10 +562,7 @@
  * LCASEV, UCASEV_AL), and optionally set its value if an assignment.
  */
 struct tbl *
-typeset(var, set, clr, field, base)
-	register const char *var;
-	Tflag clr, set;
-	int field, base;
+typeset(register const char *var, Tflag set, Tflag clr, int field, int base)
 {
 	register struct tbl *vp;
 	struct tbl *vpbase, *t;
@@ -733,9 +713,7 @@
  * the name lookup (eg, x[2]).
  */
 void
-unset(vp, array_ref)
-	register struct tbl *vp;
-	int array_ref;
+unset(register struct tbl *vp, int array_ref)
 {
 	if (vp->flag & ALLOC)
 		afree((void*)vp->val.s, vp->areap);
@@ -763,9 +741,7 @@
  * null if whole string is legal).
  */
 char *
-skip_varname(s, aok)
-	const char *s;
-	int aok;
+skip_varname(const char *s, int aok)
 {
 	int alen;
 
@@ -780,9 +756,7 @@
 
 /* Return a pointer to the first character past any legal variable name.  */
 char *
-skip_wdvarname(s, aok)
-	const char *s;
-	int aok;	/* skip array de-reference? */
+skip_wdvarname(const char *s, int aok)
 {
 	if (s[0] == CHAR && letter(s[1])) {
 		do
@@ -813,9 +787,7 @@
 
 /* Check if coded string s is a variable name */
 int
-is_wdvarname(s, aok)
-	const char *s;
-	int aok;
+is_wdvarname(const char *s, int aok)
 {
 	char *p = skip_wdvarname(s, aok);
 
@@ -824,8 +796,7 @@
 
 /* Check if coded string s is a variable assignment */
 int
-is_wdvarassign(s)
-	const char *s;
+is_wdvarassign(const char *s)
 {
 	char *p = skip_wdvarname(s, TRUE);
 
@@ -836,7 +807,7 @@
  * Make the exported environment from the exported names in the dictionary.
  */
 char **
-makenv()
+makenv(void)
 {
 	struct block *l = e->loc;
 	XPtrV env;
@@ -878,7 +849,7 @@
  * if the parent doesn't use $RANDOM.
  */
 void
-change_random()
+change_random(void)
 {
     rand();
 }
@@ -889,8 +860,7 @@
 
 /* Test if name is a special parameter */
 static int
-special(name)
-	register const char * name;
+special(register const char * name)
 {
 	register struct tbl *tp;
 
@@ -900,8 +870,7 @@
 
 /* Make a variable non-special */
 static void
-unspecial(name)
-	register const char * name;
+unspecial(register const char * name)
 {
 	register struct tbl *tp;
 
@@ -916,8 +885,7 @@
 static	int	user_lineno;		/* what user set $LINENO to */
 
 static void
-getspec(vp)
-	register struct tbl *vp;
+getspec(register struct tbl *vp)
 {
 	switch (special(vp->name)) {
 #ifdef KSH
@@ -958,8 +926,7 @@
 }
 
 static void
-setspec(vp)
-	register struct tbl *vp;
+setspec(register struct tbl *vp)
 {
 	char *s;
 
@@ -1059,8 +1026,7 @@
 }
 
 static void
-unsetspec(vp)
-	register struct tbl *vp;
+unsetspec(register struct tbl *vp)
 {
 	switch (special(vp->name)) {
 	  case V_PATH:
@@ -1118,9 +1084,7 @@
  * vp, indexed by val.
  */
 static struct tbl *
-arraysearch(vp, val)
-	struct tbl *vp;
-	int val;
+arraysearch(struct tbl *vp, int val)
 {
 	struct tbl *prev, *curr, *new;
 
@@ -1162,8 +1126,7 @@
  * bracket.
  */
 int
-array_ref_len(cp)
-	const char *cp;
+array_ref_len(const char *cp)
 {
 	const char *s = cp;
 	int c;
@@ -1181,8 +1144,7 @@
  * Make a copy of the base of an array name
  */
 char *
-arrayname(str)
-	const char *str;
+arrayname(const char *str)
 {
 	const char *p;
 
@@ -1196,10 +1158,7 @@
 /* Set (or overwrite, if !reset) the array variable var to the values in vals.
  */
 void
-set_array(var, reset, vals)
-	const char *var;
-	int reset;
-	char **vals;
+set_array(const char *var, int reset, char **vals)
 {
 	struct tbl *vp, *vq;
 	int i;