diff --git a/shell/ash.c b/shell/ash.c
index c1603d7..16c5ec0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -211,10 +211,6 @@
 #define digit_val(c)    ((c) - '0')
 
 
-#define _DIAGASSERT(x)
-
-
-
 #define S_DFL 1                 /* default signal handling (SIG_DFL) */
 #define S_CATCH 2               /* signal is caught */
 #define S_IGN 3                 /* signal is ignored (SIG_IGN) */
@@ -304,10 +300,6 @@
 #define NULL (void *)0
 #endif
 
-static inline pointer  ckmalloc (int sz)          { return xmalloc(sz);     }
-static inline pointer  ckrealloc(void *p, int sz) { return xrealloc(p, sz); }
-static inline char *   savestr  (const char *s)   { return xstrdup(s);      }
-
 static pointer stalloc (int);
 static void stunalloc (pointer);
 static void ungrabstackstr (char *, char *);
@@ -1128,6 +1120,10 @@
 static void setparam (char **);
 static void freeparam (volatile struct shparam *);
 
+static void find_command (const char *, struct cmdentry *, int, const char *);
+
+static inline void hashcd (void);
+
 /* reasons for skipping commands (see comment on breakcmd routine) */
 #define SKIPBREAK       1
 #define SKIPCONT        2
@@ -1339,8 +1335,7 @@
 static struct alias **__lookupalias (const char *);
 
 static void
-setalias(name, val)
-	char *name, *val;
+setalias(char *name, char *val)
 {
 	struct alias *ap, **app;
 
@@ -1351,13 +1346,13 @@
 		if (!(ap->flag & ALIASINUSE)) {
 			ckfree(ap->val);
 		}
-		ap->val = savestr(val);
+		ap->val = xstrdup(val);
 		ap->flag &= ~ALIASDEAD;
 	} else {
 		/* not found */
-		ap = ckmalloc(sizeof (struct alias));
-		ap->name = savestr(name);
-		ap->val = savestr(val);
+		ap = xmalloc(sizeof (struct alias));
+		ap->name = xstrdup(name);
+		ap->val = xstrdup(val);
 		ap->flag = 0;
 		ap->next = 0;
 		*app = ap;
@@ -1469,9 +1464,8 @@
 }
 
 static struct alias **
-hashalias(p)
-	const char *p;
-	{
+hashalias(const char *p)
+{
 	unsigned int hashval;
 
 	hashval = *p << 4;
@@ -1481,7 +1475,8 @@
 }
 
 static struct alias *
-freealias(struct alias *ap) {
+freealias(struct alias *ap)
+{
 	struct alias *next;
 
 	if (ap->flag & ALIASINUSE) {
@@ -1498,7 +1493,8 @@
 
 
 static struct alias **
-__lookupalias(const char *name) {
+__lookupalias(const char *name)
+{
 	struct alias **app = hashalias(name);
 
 	for (; *app; app = &(*app)->next) {
@@ -1727,7 +1723,6 @@
 static int waitforjob (struct job *);
 
 static int docd (char *, int);
-static void updatepwd (const char *);
 static void getpwd (void);
 
 static char *padvance (const char **, const char *);
@@ -1736,9 +1731,7 @@
 static char *curdir = nullstr;          /* current working directory */
 
 static int
-cdcmd(argc, argv)
-	int argc;
-	char **argv;
+cdcmd(int argc, char **argv)
 {
 	const char *dest;
 	const char *path;
@@ -1798,40 +1791,29 @@
 		INTON;
 		return -1;
 	}
-	updatepwd(dest);
+	hashcd();
+	/*
+	 * Update curdir (the name of the current directory) in response to a
+	 * cd command.  We also call hashcd to let the routines in exec.c know
+	 * that the current directory has changed.
+	 */
+	/* If dest is NULL, we don't know the current directory */
+	if (dest == NULL || curdir == nullstr)
+		setpwd(0, 1);
+	else
+		setpwd(dest, 1);
+
 	INTON;
 	if (print && iflag)
-		printf(snlfmt, curdir);
+		puts(curdir);
 	return 0;
 }
 
 
-/*
- * Update curdir (the name of the current directory) in response to a
- * cd command.  We also call hashcd to let the routines in exec.c know
- * that the current directory has changed.
- */
-
-static void hashcd (void);
-
-static void
-updatepwd(const char *dir)
-{
-	hashcd();                               /* update command hash table */
-
-	/* If our argument is NULL, we don't know the current directory */
-	if (dir == NULL || curdir == nullstr)  {
-		setpwd(0, 1);
-		return;
-	}
-	setpwd(dir, 1);
-}
-
-
 static int
 pwdcmd(int argc, char **argv)
 {
-	printf(snlfmt, curdir);
+	puts(curdir);
 	return 0;
 }
 
@@ -2134,7 +2116,6 @@
 
 static void evalsubshell (const union node *, int);
 static void expredir (union node *);
-static void prehash (union node *);
 static void eprintlist (struct strlist *);
 
 static union node *parsecmd(int);
@@ -2148,9 +2129,7 @@
 static void evalstring (char *, int);
 
 static int
-evalcmd(argc, argv)
-	int argc;
-	char **argv;
+evalcmd(int argc, char **argv)
 {
 	char *p;
 	char *concat;
@@ -2226,7 +2205,7 @@
 	funcblocksize = 0;
 	funcstringsize = 0;
 	calcsize(n);
-	funcblock = ckmalloc(funcblocksize + funcstringsize);
+	funcblock = xmalloc(funcblocksize + funcstringsize);
 	funcstring = (char *) funcblock + funcblocksize;
 	return copynode(n);
 }
@@ -2384,7 +2363,18 @@
 	jp = makejob(n, pipelen);
 	prevfd = -1;
 	for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) {
-		prehash(lp->n);
+		/*
+		 * Search for a command.  This is called before we fork so that the
+		 * location of the command will be available in the parent as well as
+		 * the child.  The check for "goodname" is an overly conservative
+		 * check that the name will not be subject to expansion.
+		 */
+
+		struct cmdentry entry;
+		union node *lpn = lp->n;
+		if (lpn->type == NCMD && lpn->ncmd.args && goodname(lpn->ncmd.args->narg.text))
+			find_command(lpn->ncmd.args->narg.text, &entry, 0, pathval());
+
 		pip[1] = -1;
 		if (lp->next) {
 			if (pipe(pip) < 0) {
@@ -2428,8 +2418,6 @@
 	}
 }
 
-static void find_command (const char *, struct cmdentry *, int, const char *);
-
 static int
 isassignment(const char *word) {
 	if (!is_name(*word)) {
@@ -2750,9 +2738,7 @@
  * exitstatus.
  */
 static void
-evaltree(n, flags)
-	union node *n;
-	int flags;
+evaltree(union node *n, int flags)
 {
 	int checkexit = 0;
 	if (n == NULL) {
@@ -2972,25 +2958,6 @@
  * Execute a simple command.
  */
 
-/*
- * Search for a command.  This is called before we fork so that the
- * location of the command will be available in the parent as well as
- * the child.  The check for "goodname" is an overly conservative
- * check that the name will not be subject to expansion.
- */
-
-static void
-prehash(n)
-	union node *n;
-{
-	struct cmdentry entry;
-
-	if (n->type == NCMD && n->ncmd.args)
-		if (goodname(n->ncmd.args->narg.text))
-			find_command(n->ncmd.args->narg.text, &entry, 0,
-				     pathval());
-}
-
 
 /*
  * Builtin commands.  Builtin commands whose functions are closely
@@ -3003,9 +2970,7 @@
  */
 
 int
-bltincmd(argc, argv)
-	int argc;
-	char **argv;
+bltincmd(int argc, char **argv)
 {
 	/*
 	 * Preserve exitstatus of a previous possible redirection
@@ -3027,9 +2992,7 @@
  */
 
 static int
-breakcmd(argc, argv)
-	int argc;
-	char **argv;
+breakcmd(int argc, char **argv)
 {
 	int n = argc > 1 ? number(argv[1]) : 1;
 
@@ -3048,9 +3011,7 @@
  */
 
 static int
-returncmd(argc, argv)
-	int argc;
-	char **argv;
+returncmd(int argc, char **argv)
 {
 	int ret = argc > 1 ? number(argv[1]) : oexitstatus;
 
@@ -3070,9 +3031,7 @@
 
 #ifndef CONFIG_FALSE
 static int
-false_main(argc, argv)
-	int argc;
-	char **argv;
+false_main(int argc, char **argv)
 {
 	return 1;
 }
@@ -3080,9 +3039,7 @@
 
 #ifndef CONFIG_TRUE
 static int
-true_main(argc, argv)
-	int argc;
-	char **argv;
+true_main(int argc, char **argv)
 {
 	return 0;
 }
@@ -3132,9 +3089,7 @@
 
 
 static int
-execcmd(argc, argv)
-	int argc;
-	char **argv;
+execcmd(int argc, char **argv)
 {
 	if (argc > 1) {
 		struct strlist *sp;
@@ -3165,10 +3120,7 @@
 static const char *pathopt;     /* set by padvance */
 
 static void
-shellexec(argv, envp, path, idx)
-	char **argv, **envp;
-	const char *path;
-	int idx;
+shellexec(char **argv, char **envp, const char *path, int idx)
 {
 	char *cmdname;
 	int e;
@@ -3208,7 +3160,8 @@
  * Clear traps on a fork.
  */
 static void
-clear_traps(void) {
+clear_traps(void)
+{
 	char **tp;
 
 	for (tp = trap ; tp < &trap[NSIG] ; tp++) {
@@ -3225,7 +3178,8 @@
 
 
 static void
-initshellproc(void) {
+initshellproc(void)
+{
 
 #ifdef ASH_ALIAS
       /* from alias.c: */
@@ -3326,7 +3280,8 @@
 
 
 static void
-popfile(void) {
+popfile(void)
+{
 	struct parsefile *pf = parsefile;
 
 	INTOFF;
@@ -3351,7 +3306,8 @@
  */
 
 static void
-popallfiles(void) {
+popallfiles(void)
+{
 	while (parsefile != &basepf)
 		popfile();
 }
@@ -3389,7 +3345,7 @@
 	}
 	parsefile->fd = fd;
 	if (parsefile->buf == NULL)
-		parsefile->buf = ckmalloc(BUFSIZ);
+		parsefile->buf = xmalloc(BUFSIZ);
 	parselleft = parsenleft = 0;
 	plinno = 1;
 }
@@ -3447,7 +3403,7 @@
 		INTOFF;
 		initshellproc();
 		setinputfile(cmd, 0);
-		commandname = arg0 = savestr(argv[0]);
+		commandname = arg0 = xstrdup(argv[0]);
 		setparam(argv + 1);
 		exraise(EXSHELLPROC);
 	}
@@ -3531,9 +3487,7 @@
 
 
 static int
-hashcmd(argc, argv)
-	int argc;
-	char **argv;
+hashcmd(int argc, char **argv)
 {
 	struct tblentry **pp;
 	struct tblentry *cmdp;
@@ -3585,7 +3539,7 @@
 			if (verbose=='v')
 				printf("%s is a shell keyword\n", name);
 			else
-				printf(snlfmt, name);
+				puts(name);
 			continue;
 		}
 
@@ -3601,10 +3555,8 @@
 }
 
 static void
-printentry(cmdp, verbose)
-	struct tblentry *cmdp;
-	int verbose;
-	{
+printentry(struct tblentry *cmdp, int verbose)
+{
 	int idx;
 	const char *path;
 	char *name;
@@ -3636,7 +3588,7 @@
 		error("internal error: cmdtype %d", cmdp->cmdtype);
 #endif
 	}
-	printf(snlfmt, cmdp->rehash ? "*" : nullstr);
+	puts(cmdp->rehash ? "*" : nullstr);
 }
 
 
@@ -3892,8 +3844,9 @@
  * are executed they will be rehashed.
  */
 
-static void
-hashcd(void) {
+static inline void
+hashcd(void)
+{
 	struct tblentry **pp;
 	struct tblentry *cmdp;
 
@@ -3934,8 +3887,7 @@
  */
 
 static void
-clearcmdentry(firstchange)
-	int firstchange;
+clearcmdentry(int firstchange)
 {
 	struct tblentry **tblp;
 	struct tblentry **pp;
@@ -3965,7 +3917,8 @@
  */
 
 static void
-deletefuncs(void) {
+deletefuncs(void)
+{
 	struct tblentry **tblp;
 	struct tblentry **pp;
 	struct tblentry *cmdp;
@@ -4019,7 +3972,7 @@
 	}
 	if (add && cmdp == NULL) {
 		INTOFF;
-		cmdp = *pp = ckmalloc(sizeof (struct tblentry) - ARB
+		cmdp = *pp = xmalloc(sizeof (struct tblentry) - ARB
 					+ strlen(name) + 1);
 		cmdp->next = NULL;
 		cmdp->cmdtype = CMDUNKNOWN;
@@ -4036,7 +3989,8 @@
  */
 
 static void
-delete_cmd_entry() {
+delete_cmd_entry()
+{
 	struct tblentry *cmdp;
 
 	INTOFF;
@@ -4121,9 +4075,7 @@
 
 #ifdef ASH_CMDCMD
 static int
-commandcmd(argc, argv)
-	int argc;
-	char **argv;
+commandcmd(int argc, char **argv)
 {
 	int c;
 	int default_path = 0;
@@ -4166,9 +4118,7 @@
 #endif
 
 static int
-path_change(newval, bltin)
-	const char *newval;
-	int *bltin;
+path_change(const char *newval, int *bltin)
 {
 	const char *old, *new;
 	int idx;
@@ -4235,7 +4185,7 @@
 static int subevalvar (char *, char *, int, int, int, int, int);
 static int varisset (char *, int);
 static void strtodest (const char *, int, int);
-static void varvalue (char *, int, int);
+static inline void varvalue (char *, int, int);
 static void recordregion (int, int, int);
 static void removerecordregions (int);
 static void ifsbreakup (char *, struct arglist *);
@@ -4244,7 +4194,7 @@
 #if defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(FNMATCH_BROKEN)
 #define preglob(p) _rmescapes((p), RMESCAPE_ALLOC | RMESCAPE_GLOB)
 #if !defined(GLOB_BROKEN)
-static void addglob (const glob_t *);
+static inline void addglob (const glob_t *);
 #endif
 #endif
 #if !(defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN))
@@ -4285,10 +4235,7 @@
  */
 
 static void
-expandarg(arg, arglist, flag)
-	union node *arg;
-	struct arglist *arglist;
-	int flag;
+expandarg(union node *arg, struct arglist *arglist, int flag)
 {
 	struct strlist *sp;
 	char *p;
@@ -4496,9 +4443,7 @@
  */
 
 static void
-argstr(p, flag)
-	char *p;
-	int flag;
+argstr(char *p, int flag)
 {
 	char c;
 	int quotes = flag & (EXP_FULL | EXP_CASE);      /* do CTLESC */
@@ -4510,7 +4455,7 @@
 		switch (c = *p++) {
 		case '\0':
 		case CTLENDVAR: /* ??? */
-			goto breakloop;
+			return;
 		case CTLQUOTEMARK:
 			/* "$@" syntax adherence hack */
 			if (p[0] == CTLVAR && p[2] == '@' && p[3] == '=')
@@ -4558,14 +4503,11 @@
 			STPUTC(c, expdest);
 		}
 	}
-breakloop:;
 	return;
 }
 
 static char *
-exptilde(p, flag)
-	char *p;
-	int flag;
+exptilde(char *p, int flag)
 {
 	char c, *startp = p;
 	struct passwd *pw;
@@ -4720,10 +4662,7 @@
  */
 
 static void
-expbackq(cmd, quoted, flag)
-	union node *cmd;
-	int quoted;
-	int flag;
+expbackq(union node *cmd, int quoted, int flag)
 {
 	volatile struct backcmd in;
 	int i;
@@ -4824,14 +4763,7 @@
 }
 
 static int
-subevalvar(p, str, strloc, subtype, startloc, varflags, quotes)
-	char *p;
-	char *str;
-	int strloc;
-	int subtype;
-	int startloc;
-	int varflags;
-	int quotes;
+subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varflags, int quotes)
 {
 	char *startp;
 	char *loc = NULL;
@@ -4952,9 +4884,7 @@
  */
 
 static int
-varisset(name, nulok)
-	char *name;
-	int nulok;
+varisset(char *name, int nulok)
 {
 	if (*name == '!')
 		return backgndpid != -1;
@@ -5006,7 +4936,7 @@
  * Add the value of a specialized variable to the stack string.
  */
 
-static void
+static inline void
 varvalue(char *name, int quoted, int flags)
 {
 	int num;
@@ -5081,10 +5011,7 @@
  */
 
 static void
-recordregion(start, end, nulonly)
-	int start;
-	int end;
-	int nulonly;
+recordregion(int start, int end, int nulonly)
 {
 	struct ifsregion *ifsp;
 
@@ -5092,7 +5019,7 @@
 		ifsp = &ifsfirst;
 	} else {
 		INTOFF;
-		ifsp = (struct ifsregion *)ckmalloc(sizeof (struct ifsregion));
+		ifsp = (struct ifsregion *)xmalloc(sizeof (struct ifsregion));
 		ifsp->next = NULL;
 		ifslastp->next = ifsp;
 		INTON;
@@ -5111,10 +5038,8 @@
  * searched for IFS characters have been stored by recordregion.
  */
 static void
-ifsbreakup(string, arglist)
-	char *string;
-	struct arglist *arglist;
-	{
+ifsbreakup(char *string, struct arglist *arglist)
+{
 	struct ifsregion *ifsp;
 	struct strlist *sp;
 	char *start;
@@ -5195,7 +5120,7 @@
 }
 
 static void
-ifsfree()
+ifsfree(void)
 {
 	while (ifsfirst.next != NULL) {
 		struct ifsregion *ifsp;
@@ -5233,9 +5158,7 @@
 
 #if defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN)
 static void
-expandmeta(str, flag)
-	struct strlist *str;
-	int flag;
+expandmeta(struct strlist *str, int flag)
 {
 	const char *p;
 	glob_t pglob;
@@ -5275,9 +5198,8 @@
  * Add the result of glob(3) to the list.
  */
 
-static void
-addglob(pglob)
-	const glob_t *pglob;
+static inline void
+addglob(const glob_t *pglob)
 {
 	char **p = pglob->gl_pathv;
 
@@ -5292,9 +5214,7 @@
 
 
 static void
-expandmeta(str, flag)
-	struct strlist *str;
-	int flag;
+expandmeta(struct strlist str, int flag)
 {
 	char *p;
 	struct strlist **savelastp;
@@ -5316,7 +5236,7 @@
 		INTOFF;
 		if (expdir == NULL) {
 			int i = strlen(str->text);
-			expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */
+			expdir = xmalloc(i < 2048 ? 2048 : i); /* XXX */
 		}
 
 		expmeta(expdir, str->text);
@@ -5348,10 +5268,8 @@
  */
 
 static void
-expmeta(enddir, name)
-	char *enddir;
-	char *name;
-	{
+expmeta(char *enddir, char *name)
+{
 	char *p;
 	const char *cp;
 	char *q;
@@ -5484,9 +5402,8 @@
  */
 
 static struct strlist *
-expsort(str)
-	struct strlist *str;
-	{
+expsort(struct strlist *str)
+{
 	int len;
 	struct strlist *sp;
 
@@ -5498,9 +5415,7 @@
 
 
 static struct strlist *
-msort(list, len)
-	struct strlist *list;
-	int len;
+msort(struct strlist *list, int len)
 {
 	struct strlist *p, *q = NULL;
 	struct strlist **lpp;
@@ -5743,8 +5658,7 @@
 }
 #else
 static void
-rmescapes(str)
-	char *str;
+rmescapes(char *str)
 {
 	char *p, *q;
 
@@ -5797,10 +5711,8 @@
  */
 
 static char *
-cvtnum(num, buf)
-	int num;
-	char *buf;
-	{
+cvtnum(int num, char *buf)
+{
 	int len;
 
 	CHECKSTRSPACE(32, buf);
@@ -5811,9 +5723,7 @@
 /*
  * Editline and history functions (and glue).
  */
-static int histcmd(argc, argv)
-	int argc;
-	char **argv;
+static int histcmd(int argc, char **argv)
 {
 	error("not compiled with history support");
 	/* NOTREACHED */
@@ -6133,7 +6043,7 @@
 	INTOFF;
 /*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
 	if (parsefile->strpush) {
-		sp = ckmalloc(sizeof (struct strpush));
+		sp = xmalloc(sizeof (struct strpush));
 		sp->prev = parsefile->strpush;
 		parsefile->strpush = sp;
 	} else
@@ -6177,14 +6087,15 @@
  */
 
 static void
-pushfile(void) {
+pushfile(void)
+{
 	struct parsefile *pf;
 
 	parsefile->nleft = parsenleft;
 	parsefile->lleft = parselleft;
 	parsefile->nextc = parsenextc;
 	parsefile->linno = plinno;
-	pf = (struct parsefile *)ckmalloc(sizeof (struct parsefile));
+	pf = (struct parsefile *)xmalloc(sizeof (struct parsefile));
 	pf->prev = parsefile;
 	pf->fd = -1;
 	pf->strpush = NULL;
@@ -6289,9 +6200,7 @@
 
 #ifdef JOBS
 static int
-killcmd(argc, argv)
-	int argc;
-	char **argv;
+killcmd(int argc, char **argv)
 {
 	int signo = -1;
 	int list = 0;
@@ -6351,13 +6260,13 @@
 			for (i = 1; i < NSIG; i++) {
 				name = u_signal_names(0, &i, 1);
 				if(name)
-					printf(snlfmt, name);
+					puts(name);
 			}
 			return 0;
 		}
 		name = u_signal_names(*argptr, &signo, -1);
 		if (name)
-			printf(snlfmt, name);
+			puts(name);
 		else
 			error("invalid signal number or exit status: %s",
 			      *argptr);
@@ -6381,9 +6290,7 @@
 }
 
 static int
-fgcmd(argc, argv)
-	int argc;
-	char **argv;
+fgcmd(int argc, char **argv)
 {
 	struct job *jp;
 	int pgrp;
@@ -6407,9 +6314,7 @@
 
 
 static int
-bgcmd(argc, argv)
-	int argc;
-	char **argv;
+bgcmd(int argc, char **argv)
 {
 	struct job *jp;
 
@@ -6424,8 +6329,7 @@
 
 
 static void
-restartjob(jp)
-	struct job *jp;
+restartjob(struct job *jp)
 {
 	struct procstat *ps;
 	int i;
@@ -6448,9 +6352,7 @@
 
 
 static int
-jobscmd(argc, argv)
-	int argc;
-	char **argv;
+jobscmd(int argc, char **argv)
 {
 	showjobs(0);
 	return 0;
@@ -6467,8 +6369,7 @@
  */
 
 static void
-showjobs(change)
-	int change;
+showjobs(int change)
 {
 	int jobno;
 	int procno;
@@ -6564,9 +6465,7 @@
 
 
 static int
-waitcmd(argc, argv)
-	int argc;
-	char **argv;
+waitcmd(int argc, char **argv)
 {
 	struct job *job;
 	int status, retval;
@@ -6687,9 +6586,9 @@
 		if (--i < 0) {
 			INTOFF;
 			if (njobs == 0) {
-				jobtab = ckmalloc(4 * sizeof jobtab[0]);
+				jobtab = xmalloc(4 * sizeof jobtab[0]);
 			} else {
-				jp = ckmalloc((njobs + 4) * sizeof jobtab[0]);
+				jp = xmalloc((njobs + 4) * sizeof jobtab[0]);
 				memcpy(jp, jobtab, njobs * sizeof jp[0]);
 				/* Relocate `ps' pointers */
 				for (i = 0; i < njobs; i++)
@@ -6715,7 +6614,7 @@
 	jp->jobctl = jobctl;
 #endif
 	if (nprocs > 1) {
-		jp->ps = ckmalloc(nprocs * sizeof (struct procstat));
+		jp->ps = xmalloc(nprocs * sizeof (struct procstat));
 	} else {
 		jp->ps = &jp->ps0;
 	}
@@ -7507,7 +7406,7 @@
 {
 	char *name;
 
-	cmdnextc = name = ckmalloc(MAXCMDTEXT);
+	cmdnextc = name = xmalloc(MAXCMDTEXT);
 	cmdnleft = MAXCMDTEXT - 4;
 	cmdtxt(n);
 	*cmdnextc = '\0';
@@ -7606,9 +7505,7 @@
  */
 
 int
-ash_main(argc, argv)
-	int argc;
-	char **argv;
+ash_main(int argc, char **argv)
 {
 	struct jmploc jmploc;
 	struct stackmark smark;
@@ -7788,8 +7685,7 @@
  */
 
 static void
-read_profile(name)
-	const char *name;
+read_profile(const char *name)
 {
 	int fd;
 	int xflag_save;
@@ -7870,16 +7766,14 @@
 }
 
 static int
-dotcmd(argc, argv)
-	int argc;
-	char **argv;
+dotcmd(int argc, char **argv)
 {
 	struct strlist *sp;
 	volatile struct shparam saveparam;
 	exitstatus = 0;
 
 	for (sp = cmdenviron; sp ; sp = sp->next)
-		setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
+		setvareq(xstrdup(sp->text), VSTRFIXED|VTEXTFIXED);
 
 	if (argc >= 2) {                /* That's what SVR2 does */
 		char *fullname;
@@ -7912,9 +7806,7 @@
 
 
 static int
-exitcmd(argc, argv)
-	int argc;
-	char **argv;
+exitcmd(int argc, char **argv)
 {
 	if (stoppedjobs())
 		return 0;
@@ -7940,7 +7832,7 @@
 		if (blocksize < MINSIZE)
 			blocksize = MINSIZE;
 		INTOFF;
-		sp = ckmalloc(sizeof(struct stack_block) - MINSIZE + blocksize);
+		sp = xmalloc(sizeof(struct stack_block) - MINSIZE + blocksize);
 		sp->prev = stackp;
 		stacknxt = sp->space;
 		stacknleft = blocksize;
@@ -8024,7 +7916,7 @@
 		oldstackp = stackp;
 		sp = stackp;
 		stackp = sp->prev;
-		sp = ckrealloc((pointer)sp, sizeof(struct stack_block) - MINSIZE + newlen);
+		sp = xrealloc((pointer)sp, sizeof(struct stack_block) - MINSIZE + newlen);
 		sp->prev = stackp;
 		stackp = sp;
 		stacknxt = sp->space;
@@ -8225,9 +8117,7 @@
 
 
 static int
-umaskcmd(argc, argv)
-	int argc;
-	char **argv;
+umaskcmd(int argc, char **argv)
 {
 	static const char permuser[3] = "ugo";
 	static const char permmode[3] = "rwx";
@@ -8345,9 +8235,7 @@
 };
 
 static int
-ulimitcmd(argc, argv)
-	int argc;
-	char **argv;
+ulimitcmd(int argc, char **argv)
 {
 	static const char unlimited_string[] = "unlimited";
 	int     c;
@@ -8530,7 +8418,8 @@
  */
 
 static char *
-single_quote(const char *s) {
+single_quote(const char *s)
+{
 	char *p;
 
 	STARTSTACKSTR(p);
@@ -8594,7 +8483,7 @@
 
 static void sizenodelist (const struct nodelist *);
 static struct nodelist *copynodelist (const struct nodelist *);
-static char *nodesavestr (const char *);
+static char *nodexstrdup (const char *);
 
 #define CALCSIZE_TABLE
 #define COPYNODE_TABLE
@@ -8736,7 +8625,7 @@
 		  if (!(*p & NODE_MBRMASK)) { /* standard node */
 			  *((union node **)nn) = copynode(*((const union node **) no));
 		  } else if ((*p & NODE_MBRMASK) == NODE_CHARPTR) { /* string */
-			  *((const char **)nn) = nodesavestr(*((const char **)no));
+			  *((const char **)nn) = nodexstrdup(*((const char **)no));
 		  } else if (*p & NODE_NODELIST) { /* nodelist */
 			  *((struct nodelist **)nn)
 				  = copynodelist(*((const struct nodelist **) no));
@@ -8787,7 +8676,7 @@
 	    new->nif.test = copynode(n->nif.test);
 	    break;
       case NFOR:
-	    new->nfor.var = nodesavestr(n->nfor.var);
+	    new->nfor.var = nodexstrdup(n->nfor.var);
 	    new->nfor.body = copynode(n->nfor.body);
 	    new->nfor.args = copynode(n->nfor.args);
 	    break;
@@ -8803,7 +8692,7 @@
       case NDEFUN:
       case NARG:
 	    new->narg.backquote = copynodelist(n->narg.backquote);
-	    new->narg.text = nodesavestr(n->narg.text);
+	    new->narg.text = nodexstrdup(n->narg.text);
 	    new->narg.next = copynode(n->narg.next);
 	    break;
       case NTO:
@@ -8971,7 +8860,7 @@
 
 
 static char *
-nodesavestr(const char *s)
+nodexstrdup(const char *s)
 {
 	const char *p = s;
 	char *q = funcstring;
@@ -8993,9 +8882,7 @@
  */
 
 static void
-procargs(argc, argv)
-	int argc;
-	char **argv;
+procargs(int argc, char **argv)
 {
 	int i;
 
@@ -9154,9 +9041,9 @@
 	int nparam;
 
 	for (nparam = 0 ; argv[nparam] ; nparam++);
-	ap = newparam = ckmalloc((nparam + 1) * sizeof *ap);
+	ap = newparam = xmalloc((nparam + 1) * sizeof *ap);
 	while (*argv) {
-		*ap++ = savestr(*argv++);
+		*ap++ = xstrdup(*argv++);
 	}
 	*ap = NULL;
 	freeparam(&shellparam);
@@ -9191,9 +9078,7 @@
  */
 
 static int
-shiftcmd(argc, argv)
-	int argc;
-	char **argv;
+shiftcmd(int argc, char **argv)
 {
 	int n;
 	char **ap1, **ap2;
@@ -9224,9 +9109,7 @@
  */
 
 static int
-setcmd(argc, argv)
-	int argc;
-	char **argv;
+setcmd(int argc, char **argv)
 {
 	if (argc == 1)
 		return showvarscmd(argc, argv);
@@ -9272,9 +9155,7 @@
  */
 
 static int
-getoptscmd(argc, argv)
-	int argc;
-	char **argv;
+getoptscmd(int argc, char **argv)
 {
 	char **optbase;
 
@@ -9304,9 +9185,7 @@
  */
 
 static int
-setvarsafe(name, val, flags)
-	const char *name, *val;
-	int flags;
+setvarsafe(const char *name, const char *val, int flags)
 {
 	struct jmploc jmploc;
 	struct jmploc *volatile savehandler = handler;
@@ -9326,12 +9205,7 @@
 }
 
 static int
-getopts(optstr, optvar, optfirst, myoptind, optoff)
-	char *optstr;
-	char *optvar;
-	char **optfirst;
-	int *myoptind;
-	int *optoff;
+getopts(char *optstr, char *optvar, char **optfirst, int *myoptind, int *optoff)
 {
 	char *p, *q;
 	char c = '?';
@@ -9591,8 +9465,7 @@
 
 
 static union node *
-list(nlflag)
-	int nlflag;
+list(int nlflag)
 {
 	union node *n1, *n2, *n3;
 	int tok;
@@ -10853,7 +10726,7 @@
 	str = NULL;
 	savelen = out - stackblock();
 	if (savelen > 0) {
-		str = ckmalloc(savelen);
+		str = xmalloc(savelen);
 		memcpy(str, stackblock(), savelen);
 	}
 	savehandler = handler;
@@ -11012,9 +10885,8 @@
  */
 
 static int
-noexpand(text)
-	char *text;
-	{
+noexpand(char *text)
+{
 	char *p;
 	char c;
 
@@ -11059,8 +10931,7 @@
  */
 
 static void
-synexpect(token)
-	int token;
+synexpect(int token)
 {
 	char msg[64];
 	int l;
@@ -11308,7 +11179,7 @@
 	int fd1dup = flags & REDIR_BACKQ;; /* stdout `cmd` redir to pipe */
 
 	if (flags & REDIR_PUSH) {
-		sv = ckmalloc(sizeof (struct redirtab));
+		sv = xmalloc(sizeof (struct redirtab));
 		for (i = 0 ; i < 10 ; i++)
 			sv->renamed[i] = EMPTY;
 		sv->next = redirlist;
@@ -11440,9 +11311,7 @@
  */
 
 static int
-dup_as_newfd(from, to)
-	int from;
-	int to;
+dup_as_newfd(int from, int to)
 {
 	int newfd;
 
@@ -11477,11 +11346,7 @@
 
 
 static void
-shtree(n, ind, pfx, fp)
-	union node *n;
-	int ind;
-	char *pfx;
-	FILE *fp;
+shtree(union node *n, int ind, char *pfx, FILE *fp)
 {
 	struct nodelist *lp;
 	const char *s;
@@ -11532,9 +11397,7 @@
 
 
 static void
-shcmd(cmd, fp)
-	union node *cmd;
-	FILE *fp;
+shcmd(union node *cmd, FILE *fp)
 {
 	union node *np;
 	int first;
@@ -11585,10 +11448,8 @@
 }
 
 static void
-sharg(arg, fp)
-	union node *arg;
-	FILE *fp;
-	{
+sharg(union node *arg, FILE *fp)
+{
 	char *p;
 	struct nodelist *bqlist;
 	int subtype;
@@ -11672,10 +11533,7 @@
 
 
 static void
-indent(amount, pfx, fp)
-	int amount;
-	char *pfx;
-	FILE *fp;
+indent(int amount, char *pfx, FILE *fp)
 {
 	int i;
 
@@ -11697,8 +11555,7 @@
 
 
 static void
-trputc(c)
-	int c;
+trputc(int c)
 {
 	if (tracefile == NULL)
 		return;
@@ -11722,8 +11579,7 @@
 
 
 static void
-trputs(s)
-	const char *s;
+trputs(const char *s)
 {
 	if (tracefile == NULL)
 		return;
@@ -11734,8 +11590,7 @@
 
 
 static void
-trstring(s)
-	char *s;
+trstring(char *s)
 {
 	char *p;
 	char c;
@@ -11775,8 +11630,7 @@
 
 
 static void
-trargs(ap)
-	char **ap;
+trargs(char **ap)
 {
 	if (tracefile == NULL)
 		return;
@@ -11792,7 +11646,8 @@
 
 
 static void
-opentrace() {
+opentrace()
+{
 	char s[100];
 #ifdef O_APPEND
 	int flags;
@@ -11832,9 +11687,7 @@
  */
 
 static int
-trapcmd(argc, argv)
-	int argc;
-	char **argv;
+trapcmd(int argc, char **argv)
 {
 	char *action;
 	char **ap;
@@ -11871,7 +11724,7 @@
 			if (action[0] == '-' && action[1] == '\0')
 				action = NULL;
 			else
-				action = savestr(action);
+				action = xstrdup(action);
 		}
 		if (trap[signo])
 			ckfree(trap[signo]);
@@ -11974,8 +11827,7 @@
  */
 
 static void
-ignoresig(signo)
-	int signo;
+ignoresig(int signo)
 {
 	if (sigmode[signo - 1] != S_IGN && sigmode[signo - 1] != S_HARD_IGN) {
 		signal(signo, SIG_IGN);
@@ -12113,9 +11965,7 @@
  */
 
 static void
-setvar(name, val, flags)
-	const char *name, *val;
-	int flags;
+setvar(const char *name, const char *val, int flags)
 {
 	const char *p;
 	int len;
@@ -12147,7 +11997,7 @@
 		len += vallen = strlen(val);
 	}
 	INTOFF;
-	nameeq = ckmalloc(len);
+	nameeq = xmalloc(len);
 	memcpy(nameeq, name, namelen);
 	nameeq[namelen] = '=';
 	if (val) {
@@ -12169,9 +12019,7 @@
  */
 
 static void
-setvareq(s, flags)
-	char *s;
-	int flags;
+setvareq(char *s, int flags)
 {
 	struct var *vp, **vpp;
 
@@ -12206,7 +12054,7 @@
 		return;
 	}
 	/* not found */
-	vp = ckmalloc(sizeof (*vp));
+	vp = xmalloc(sizeof (*vp));
 	vp->flags = flags;
 	vp->text = s;
 	vp->next = *vpp;
@@ -12221,14 +12069,13 @@
  */
 
 static void
-listsetvar(mylist)
-	struct strlist *mylist;
-	{
+listsetvar(struct strlist *mylist)
+{
 	struct strlist *lp;
 
 	INTOFF;
 	for (lp = mylist ; lp ; lp = lp->next) {
-		setvareq(savestr(lp->text), 0);
+		setvareq(xstrdup(lp->text), 0);
 	}
 	INTON;
 }
@@ -12240,8 +12087,7 @@
  */
 
 static const char *
-lookupvar(name)
-	const char *name;
+lookupvar(const char *name)
 {
 	struct var *v;
 
@@ -12322,7 +12168,7 @@
 					ckfree(vp);
 			} else {
 				if (vp->flags & VSTACK) {
-					vp->text = savestr(vp->text);
+					vp->text = xstrdup(vp->text);
 					vp->flags &=~ VSTACK;
 				}
 				prev = &vp->next;
@@ -12341,9 +12187,7 @@
  */
 
 static int
-showvarscmd(argc, argv)
-	int argc;
-	char **argv;
+showvarscmd(int argc, char **argv)
 {
 	showvars(nullstr, VUNSET, VUNSET);
 	return 0;
@@ -12356,9 +12200,7 @@
  */
 
 static int
-exportcmd(argc, argv)
-	int argc;
-	char **argv;
+exportcmd(int argc, char **argv)
 {
 	struct var *vp;
 	char *name;
@@ -12395,9 +12237,7 @@
 /* funcnest nonzero if we are currently evaluating a function */
 
 static int
-localcmd(argc, argv)
-	int argc;
-	char **argv;
+localcmd(int argc, char **argv)
 {
 	char *name;
 
@@ -12418,18 +12258,17 @@
  */
 
 static void
-mklocal(name)
-	char *name;
-	{
+mklocal(char *name)
+{
 	struct localvar *lvp;
 	struct var **vpp;
 	struct var *vp;
 
 	INTOFF;
-	lvp = ckmalloc(sizeof (struct localvar));
+	lvp = xmalloc(sizeof (struct localvar));
 	if (name[0] == '-' && name[1] == '\0') {
 		char *p;
-		p = ckmalloc(sizeof optet_vals);
+		p = xmalloc(sizeof optet_vals);
 		lvp->text = memcpy(p, optet_vals, sizeof optet_vals);
 		vp = NULL;
 	} else {
@@ -12437,7 +12276,7 @@
 		vp = *findvar(vpp, name);
 		if (vp == NULL) {
 			if (strchr(name, '='))
-				setvareq(savestr(name), VSTRFIXED);
+				setvareq(xstrdup(name), VSTRFIXED);
 			else
 				setvar(name, NULL, VSTRFIXED);
 			vp = *vpp;      /* the new variable */
@@ -12448,7 +12287,7 @@
 			lvp->flags = vp->flags;
 			vp->flags |= VSTRFIXED|VTEXTFIXED;
 			if (strchr(name, '='))
-				setvareq(savestr(name), 0);
+				setvareq(xstrdup(name), 0);
 		}
 	}
 	lvp->vp = vp;
@@ -12487,9 +12326,7 @@
 
 
 static int
-setvarcmd(argc, argv)
-	int argc;
-	char **argv;
+setvarcmd(int argc, char **argv)
 {
 	if (argc <= 2)
 		return unsetcmd(argc, argv);
@@ -12508,9 +12345,7 @@
  */
 
 static int
-unsetcmd(argc, argv)
-	int argc;
-	char **argv;
+unsetcmd(int argc, char **argv)
 {
 	char **ap;
 	int i;
@@ -12646,7 +12481,7 @@
 /*
  * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
  * This file contains code for the times builtin.
- * $Id: ash.c,v 1.36 2001/11/12 16:57:26 kraai Exp $
+ * $Id: ash.c,v 1.37 2001/12/06 03:37:38 aaronl Exp $
  */
 static int timescmd (int argc, char **argv)
 {
@@ -12695,7 +12530,7 @@
 			return 0;
 		}
 		snprintf(p, 12, "%ld", result);
-		setvar(argv[1], savestr(p), 0);
+		setvar(argv[1], xstrdup(p), 0);
 	} else if (argc >= 3)
 		synerror("invalid operand");
 	return !result;
