(anything *)0 -> NULL
This commit is contained in:
		
							
								
								
									
										40
									
								
								c_ksh.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								c_ksh.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/c_ksh.c,v 2.4 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/c_ksh.c,v 2.5 2004/12/18 19:22:28 tg Exp $ */ | ||||||
| /*	$OpenBSD: c_ksh.c,v 1.18 2004/02/10 13:03:36 jmc Exp $	*/ | /*	$OpenBSD: c_ksh.c,v 1.18 2004/02/10 13:03:36 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -13,7 +13,7 @@ | |||||||
| #include <sys/cygwin.h> | #include <sys/cygwin.h> | ||||||
| #endif /* __CYGWIN__ */ | #endif /* __CYGWIN__ */ | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/c_ksh.c,v 2.4 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/c_ksh.c,v 2.5 2004/12/18 19:22:28 tg Exp $"); | ||||||
|  |  | ||||||
| int | int | ||||||
| c_cd(char **wp) | c_cd(char **wp) | ||||||
| @@ -82,7 +82,7 @@ c_cd(char **wp) | |||||||
| 		 * we could try to find another substitution. For now | 		 * we could try to find another substitution. For now | ||||||
| 		 * we don't | 		 * we don't | ||||||
| 		 */ | 		 */ | ||||||
| 		if ((cp = strstr(current_wd, wp[0])) == (char *) 0) { | 		if ((cp = strstr(current_wd, wp[0])) == NULL) { | ||||||
| 			bi_errorf("bad substitution"); | 			bi_errorf("bad substitution"); | ||||||
| 			return 1; | 			return 1; | ||||||
| 		} | 		} | ||||||
| @@ -104,7 +104,7 @@ c_cd(char **wp) | |||||||
| 	/* xp will have a bogus value after make_path() - set it to 0 | 	/* xp will have a bogus value after make_path() - set it to 0 | ||||||
| 	 * so that if it's used, it will cause a dump | 	 * so that if it's used, it will cause a dump | ||||||
| 	 */ | 	 */ | ||||||
| 	xp = (char *) 0; | 	xp = NULL; | ||||||
|  |  | ||||||
| 	cdpath = str_val(global("CDPATH")); | 	cdpath = str_val(global("CDPATH")); | ||||||
| 	do { | 	do { | ||||||
| @@ -118,7 +118,7 @@ c_cd(char **wp) | |||||||
| 			simplify_path(Xstring(xs, xp)); | 			simplify_path(Xstring(xs, xp)); | ||||||
| 			rval = chdir(try = Xstring(xs, xp)); | 			rval = chdir(try = Xstring(xs, xp)); | ||||||
| 		} | 		} | ||||||
| 	} while (rval < 0 && cdpath != (char *) 0); | 	} while (rval < 0 && cdpath != NULL); | ||||||
|  |  | ||||||
| 	if (rval < 0) { | 	if (rval < 0) { | ||||||
| 		if (cdnode) | 		if (cdnode) | ||||||
| @@ -139,7 +139,7 @@ c_cd(char **wp) | |||||||
| 		setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR); | 		setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR); | ||||||
|  |  | ||||||
| 	if (!ISABSPATH(Xstring(xs, xp))) { | 	if (!ISABSPATH(Xstring(xs, xp))) { | ||||||
| 		pwd = (char *) 0; | 		pwd = NULL; | ||||||
| 	} else | 	} else | ||||||
| #ifdef S_ISLNK | #ifdef S_ISLNK | ||||||
| 	if (!physical || !(pwd = get_phys_path(Xstring(xs, xp)))) | 	if (!physical || !(pwd = get_phys_path(Xstring(xs, xp)))) | ||||||
| @@ -194,14 +194,14 @@ c_pwd(char **wp) | |||||||
| 	} | 	} | ||||||
| #ifdef S_ISLNK | #ifdef S_ISLNK | ||||||
| 	p = current_wd[0] ? (physical ? get_phys_path(current_wd) : current_wd) | 	p = current_wd[0] ? (physical ? get_phys_path(current_wd) : current_wd) | ||||||
| 			  : (char *) 0; | 			  : NULL; | ||||||
| #else /* S_ISLNK */ | #else /* S_ISLNK */ | ||||||
| 	p = current_wd[0] ? current_wd : (char *) 0; | 	p = current_wd[0] ? current_wd : NULL; | ||||||
| #endif /* S_ISLNK */ | #endif /* S_ISLNK */ | ||||||
| 	if (p && eaccess(p, R_OK) < 0) | 	if (p && eaccess(p, R_OK) < 0) | ||||||
| 		p = (char *) 0; | 		p = NULL; | ||||||
| 	if (!p) { | 	if (!p) { | ||||||
| 		p = ksh_get_wd((char *) 0, 0); | 		p = ksh_get_wd(NULL, 0); | ||||||
| 		if (!p) { | 		if (!p) { | ||||||
| 			bi_errorf("can't get current directory - %s", | 			bi_errorf("can't get current directory - %s", | ||||||
| 				strerror(errno)); | 				strerror(errno)); | ||||||
| @@ -563,7 +563,7 @@ c_typeset(char **wp) | |||||||
|  		break; |  		break; | ||||||
|  	} |  	} | ||||||
|  |  | ||||||
| 	fieldstr = basestr = (char *) 0; | 	fieldstr = basestr = NULL; | ||||||
| 	builtin_opt.flags |= GF_PLUSOPT; | 	builtin_opt.flags |= GF_PLUSOPT; | ||||||
| 	/* at&t ksh seems to have 0-9 as options, which are multiplied | 	/* at&t ksh seems to have 0-9 as options, which are multiplied | ||||||
| 	 * to get a number that is used with -L, -R, -Z or -i (eg, -1R2 | 	 * to get a number that is used with -L, -R, -Z or -i (eg, -1R2 | ||||||
| @@ -879,7 +879,7 @@ c_alias(char **wp) | |||||||
| 	/* "hash -r" means reset all the tracked aliases.. */ | 	/* "hash -r" means reset all the tracked aliases.. */ | ||||||
| 	if (rflag) { | 	if (rflag) { | ||||||
| 		static const char *const args[] = { | 		static const char *const args[] = { | ||||||
| 			    "unalias", "-ta", (const char *) 0 | 			    "unalias", "-ta", NULL | ||||||
| 			}; | 			}; | ||||||
|  |  | ||||||
| 		if (!tflag || *wp) { | 		if (!tflag || *wp) { | ||||||
| @@ -944,7 +944,7 @@ c_alias(char **wp) | |||||||
| 				afree((void*)ap->val.s, APERM); | 				afree((void*)ap->val.s, APERM); | ||||||
| 			} | 			} | ||||||
| 			/* ignore values for -t (at&t ksh does this) */ | 			/* ignore values for -t (at&t ksh does this) */ | ||||||
| 			newval = tflag ? search(alias, path, X_OK, (int *) 0) | 			newval = tflag ? search(alias, path, X_OK, NULL) | ||||||
| 					: val; | 					: val; | ||||||
| 			if (newval) { | 			if (newval) { | ||||||
| 				ap->val.s = str_save(newval, APERM); | 				ap->val.s = str_save(newval, APERM); | ||||||
| @@ -1022,7 +1022,7 @@ c_let(char **wp) | |||||||
| 	int rv = 1; | 	int rv = 1; | ||||||
| 	long val; | 	long val; | ||||||
|  |  | ||||||
| 	if (wp[1] == (char *) 0) /* at&t ksh does this */ | 	if (wp[1] == NULL) /* at&t ksh does this */ | ||||||
| 		bi_errorf("no arguments"); | 		bi_errorf("no arguments"); | ||||||
| 	else | 	else | ||||||
| 		for (wp++; *wp; wp++) | 		for (wp++; *wp; wp++) | ||||||
| @@ -1061,7 +1061,7 @@ c_jobs(char **wp) | |||||||
| 		} | 		} | ||||||
| 	wp += builtin_opt.optind; | 	wp += builtin_opt.optind; | ||||||
| 	if (!*wp) { | 	if (!*wp) { | ||||||
| 		if (j_jobs((char *) 0, flag, nflag)) | 		if (j_jobs(NULL, flag, nflag)) | ||||||
| 			rv = 1; | 			rv = 1; | ||||||
| 	} else { | 	} else { | ||||||
| 		for (; *wp; wp++) | 		for (; *wp; wp++) | ||||||
| @@ -1127,7 +1127,7 @@ kill_fmt_entry(void *arg, int i, char *buf, int buflen) | |||||||
| int | int | ||||||
| c_kill(char **wp) | c_kill(char **wp) | ||||||
| { | { | ||||||
| 	Trap *t = (Trap *) 0; | 	Trap *t = NULL; | ||||||
| 	char *p; | 	char *p; | ||||||
| 	int lflag = 0; | 	int lflag = 0; | ||||||
| 	int i, n, rv, sig; | 	int i, n, rv, sig; | ||||||
| @@ -1274,12 +1274,12 @@ c_getopts(char **wp) | |||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (e->loc->next == (struct block *) 0) { | 	if (e->loc->next == NULL) { | ||||||
| 		internal_errorf(0, "c_getopts: no argv"); | 		internal_errorf(0, "c_getopts: no argv"); | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
| 	/* Which arguments are we parsing... */ | 	/* Which arguments are we parsing... */ | ||||||
| 	if (*wp == (char *) 0) | 	if (*wp == NULL) | ||||||
| 		wp = e->loc->next->argv; | 		wp = e->loc->next->argv; | ||||||
| 	else | 	else | ||||||
| 		*--wp = e->loc->next->argv[0]; | 		*--wp = e->loc->next->argv[0]; | ||||||
| @@ -1295,7 +1295,7 @@ c_getopts(char **wp) | |||||||
| 	      return 1; | 	      return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	user_opt.optarg = (char *) 0; | 	user_opt.optarg = NULL; | ||||||
| 	optc = ksh_getopt(wp, &user_opt, options); | 	optc = ksh_getopt(wp, &user_opt, options); | ||||||
|  |  | ||||||
| 	if (optc >= 0 && optc != '?' && (user_opt.info & GI_PLUS)) { | 	if (optc >= 0 && optc != '?' && (user_opt.info & GI_PLUS)) { | ||||||
| @@ -1323,7 +1323,7 @@ c_getopts(char **wp) | |||||||
| 	/* Paranoia: ensure no bizarre results. */ | 	/* Paranoia: ensure no bizarre results. */ | ||||||
| 	if (voptarg->flag & INTEGER) | 	if (voptarg->flag & INTEGER) | ||||||
| 	    typeset("OPTARG", 0, INTEGER, 0, 0); | 	    typeset("OPTARG", 0, INTEGER, 0, 0); | ||||||
| 	if (user_opt.optarg == (char *) 0) | 	if (user_opt.optarg == NULL) | ||||||
| 		unset(voptarg, 0); | 		unset(voptarg, 0); | ||||||
| 	else | 	else | ||||||
| 		/* This can't fail (have cleared readonly/integer) */ | 		/* This can't fail (have cleared readonly/integer) */ | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								c_sh.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								c_sh.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/c_sh.c,v 2.4 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/c_sh.c,v 2.5 2004/12/18 19:22:28 tg Exp $ */ | ||||||
| /*	$OpenBSD: c_sh.c,v 1.17 2003/03/13 09:03:07 deraadt Exp $	*/ | /*	$OpenBSD: c_sh.c,v 1.17 2003/03/13 09:03:07 deraadt Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "ksh_time.h" | #include "ksh_time.h" | ||||||
| #include "ksh_times.h" | #include "ksh_times.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/c_sh.c,v 2.4 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/c_sh.c,v 2.5 2004/12/18 19:22:28 tg Exp $"); | ||||||
|  |  | ||||||
| static	char *clocktos(clock_t t); | static	char *clocktos(clock_t t); | ||||||
|  |  | ||||||
| @@ -200,7 +200,7 @@ c_dot(char **wp) | |||||||
| 			; | 			; | ||||||
| 	} else { | 	} else { | ||||||
| 		argc = 0; | 		argc = 0; | ||||||
| 		argv = (char **) 0; | 		argv = NULL; | ||||||
| 	} | 	} | ||||||
| 	i = include(file, argc, argv, 0); | 	i = include(file, argc, argv, 0); | ||||||
| 	if (i < 0) { /* should not happen */ | 	if (i < 0) { /* should not happen */ | ||||||
| @@ -219,8 +219,8 @@ c_wait(char **wp) | |||||||
| 	if (ksh_getopt(wp, &builtin_opt, null) == '?') | 	if (ksh_getopt(wp, &builtin_opt, null) == '?') | ||||||
| 		return 1; | 		return 1; | ||||||
| 	wp += builtin_opt.optind; | 	wp += builtin_opt.optind; | ||||||
| 	if (*wp == (char *) 0) { | 	if (*wp == NULL) { | ||||||
| 		while (waitfor((char *) 0, &sig) >= 0) | 		while (waitfor(NULL, &sig) >= 0) | ||||||
| 			; | 			; | ||||||
| 		rv = sig; | 		rv = sig; | ||||||
| 	} else { | 	} else { | ||||||
| @@ -348,7 +348,7 @@ c_read(char **wp) | |||||||
| 						/* set prompt in case this is | 						/* set prompt in case this is | ||||||
| 						 * called from .profile or $ENV | 						 * called from .profile or $ENV | ||||||
| 						 */ | 						 */ | ||||||
| 						set_prompt(PS2, (Source *) 0); | 						set_prompt(PS2, NULL); | ||||||
| 						pprompt(prompt, 0); | 						pprompt(prompt, 0); | ||||||
| 					} | 					} | ||||||
| 				} else if (c != EOF) | 				} else if (c != EOF) | ||||||
| @@ -540,7 +540,7 @@ int | |||||||
| c_brkcont(char **wp) | c_brkcont(char **wp) | ||||||
| { | { | ||||||
| 	int n, quit; | 	int n, quit; | ||||||
| 	struct env *ep, *last_ep = (struct env *) 0; | 	struct env *ep, *last_ep = NULL; | ||||||
| 	char *arg; | 	char *arg; | ||||||
|  |  | ||||||
| 	if (ksh_getopt(wp, &builtin_opt, null) == '?') | 	if (ksh_getopt(wp, &builtin_opt, null) == '?') | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								c_test.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								c_test.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/c_test.c,v 2.2 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/c_test.c,v 2.3 2004/12/18 19:22:28 tg Exp $ */ | ||||||
| /*	$OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $	*/ | /*	$OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -14,7 +14,7 @@ | |||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
| #include "c_test.h" | #include "c_test.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/c_test.c,v 2.2 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/c_test.c,v 2.3 2004/12/18 19:22:28 tg Exp $"); | ||||||
|  |  | ||||||
| /* test(1) accepts the following grammar: | /* test(1) accepts the following grammar: | ||||||
| 	oexpr	::= aexpr | aexpr "-o" oexpr ; | 	oexpr	::= aexpr | aexpr "-o" oexpr ; | ||||||
| @@ -164,7 +164,7 @@ c_test(char **wp) | |||||||
| 				if (!Flag(FPOSIX) && strcmp(opnd1, "-t") == 0) | 				if (!Flag(FPOSIX) && strcmp(opnd1, "-t") == 0) | ||||||
| 				    break; | 				    break; | ||||||
| 				res = (*te.eval)(&te, TO_STNZE, opnd1, | 				res = (*te.eval)(&te, TO_STNZE, opnd1, | ||||||
| 						(char *) 0, 1); | 						NULL, 1); | ||||||
| 				if (invert & 1) | 				if (invert & 1) | ||||||
| 					res = !res; | 					res = !res; | ||||||
| 				return !res; | 				return !res; | ||||||
| @@ -540,7 +540,7 @@ test_primary(Test_env *te, int do_eval) | |||||||
| 			return 0; | 			return 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return (*te->eval)(te, op, opnd1, (const char *) 0, do_eval); | 		return (*te->eval)(te, op, opnd1, NULL, do_eval); | ||||||
| 	} | 	} | ||||||
| 	opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); | 	opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); | ||||||
| 	if (!opnd1) { | 	if (!opnd1) { | ||||||
| @@ -561,7 +561,7 @@ test_primary(Test_env *te, int do_eval) | |||||||
| 		(*te->error)(te, -1, "missing expression operator"); | 		(*te->error)(te, -1, "missing expression operator"); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	return (*te->eval)(te, TO_STNZE, opnd1, (const char *) 0, do_eval); | 	return (*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -602,7 +602,7 @@ static const char * | |||||||
| ptest_getopnd(Test_env *te, Test_op op, int do_eval GCC_FUNC_ATTR(unused)) | ptest_getopnd(Test_env *te, Test_op op, int do_eval GCC_FUNC_ATTR(unused)) | ||||||
| { | { | ||||||
| 	if (te->pos.wp >= te->wp_end) | 	if (te->pos.wp >= te->wp_end) | ||||||
| 		return op == TO_FILTT ? "1" : (const char *) 0; | 		return op == TO_FILTT ? "1" : NULL; | ||||||
| 	return *te->pos.wp++; | 	return *te->pos.wp++; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -616,7 +616,7 @@ static void | |||||||
| ptest_error(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 *op = te->pos.wp + offset >= te->wp_end ? | ||||||
| 				(const char *) 0 : te->pos.wp[offset]; | 				NULL : te->pos.wp[offset]; | ||||||
|  |  | ||||||
| 	te->flags |= TEF_ERROR; | 	te->flags |= TEF_ERROR; | ||||||
| 	if (op) | 	if (op) | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								edit.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								edit.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/edit.c,v 2.3 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/edit.c,v 2.4 2004/12/18 19:22:28 tg Exp $ */ | ||||||
| /*	$OpenBSD: edit.c,v 1.18 2003/08/22 18:17:10 fgsch Exp $	*/ | /*	$OpenBSD: edit.c,v 1.18 2003/08/22 18:17:10 fgsch Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -21,7 +21,7 @@ | |||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/edit.c,v 2.3 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/edit.c,v 2.4 2004/12/18 19:22:28 tg Exp $"); | ||||||
|  |  | ||||||
| #if defined(TIOCGWINSZ) | #if defined(TIOCGWINSZ) | ||||||
| static RETSIGTYPE x_sigwinch(int sig); | static RETSIGTYPE x_sigwinch(int sig); | ||||||
| @@ -439,10 +439,10 @@ x_print_expansions(int nwords, char *const *words, int is_command) | |||||||
|  |  | ||||||
| 		/* Special case for 1 match (prefix is whole word) */ | 		/* Special case for 1 match (prefix is whole word) */ | ||||||
| 		if (nwords == 1) | 		if (nwords == 1) | ||||||
| 			prefix_len = x_basename(words[0], (char *) 0); | 			prefix_len = x_basename(words[0], NULL); | ||||||
| 		/* Any (non-trailing) slashes in non-common word suffixes? */ | 		/* Any (non-trailing) slashes in non-common word suffixes? */ | ||||||
| 		for (i = 0; i < nwords; i++) | 		for (i = 0; i < nwords; i++) | ||||||
| 			if (x_basename(words[i] + prefix_len, (char *) 0) | 			if (x_basename(words[i] + prefix_len, NULL) | ||||||
| 							> prefix_len) | 							> prefix_len) | ||||||
| 				break; | 				break; | ||||||
| 		/* All in same directory? */ | 		/* All in same directory? */ | ||||||
| @@ -454,7 +454,7 @@ x_print_expansions(int nwords, char *const *words, int is_command) | |||||||
| 			XPinit(l, nwords + 1); | 			XPinit(l, nwords + 1); | ||||||
| 			for (i = 0; i < nwords; i++) | 			for (i = 0; i < nwords; i++) | ||||||
| 				XPput(l, words[i] + prefix_len); | 				XPput(l, words[i] + prefix_len); | ||||||
| 			XPput(l, (char *) 0); | 			XPput(l, NULL); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -545,7 +545,7 @@ x_file_glob(int flags GCC_FUNC_ATTR(unused), const char *str, | |||||||
| 	} | 	} | ||||||
| 	afree(toglob, ATEMP); | 	afree(toglob, ATEMP); | ||||||
|  |  | ||||||
| 	*wordsp = nwords ? words : (char **) 0; | 	*wordsp = nwords ? words : NULL; | ||||||
|  |  | ||||||
| 	return nwords; | 	return nwords; | ||||||
| } | } | ||||||
| @@ -605,7 +605,7 @@ x_command_glob(int flags, const char *str, int slen, char ***wordsp) | |||||||
| 	nwords = XPsize(w); | 	nwords = XPsize(w); | ||||||
|  |  | ||||||
| 	if (!nwords) { | 	if (!nwords) { | ||||||
| 		*wordsp = (char **) 0; | 		*wordsp = NULL; | ||||||
| 		XPfree(w); | 		XPfree(w); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| @@ -623,7 +623,7 @@ x_command_glob(int flags, const char *str, int slen, char ***wordsp) | |||||||
| 			alloc(sizeof(struct path_order_info) * nwords, ATEMP); | 			alloc(sizeof(struct path_order_info) * nwords, ATEMP); | ||||||
| 		for (i = 0; i < nwords; i++) { | 		for (i = 0; i < nwords; i++) { | ||||||
| 			info[i].word = words[i]; | 			info[i].word = words[i]; | ||||||
| 			info[i].base = x_basename(words[i], (char *) 0); | 			info[i].base = x_basename(words[i], NULL); | ||||||
| 			if (!last_info || info[i].base != last_info->base | 			if (!last_info || info[i].base != last_info->base | ||||||
| 			    || FILENCMP(words[i], | 			    || FILENCMP(words[i], | ||||||
| 					last_info->word, info[i].base) != 0) | 					last_info->word, info[i].base) != 0) | ||||||
| @@ -738,7 +738,7 @@ x_cf_glob(int flags, const char *buf, int buflen, int pos, int *startp, int *end | |||||||
| 	nwords = (is_command ? x_command_glob : x_file_glob)(flags, | 	nwords = (is_command ? x_command_glob : x_file_glob)(flags, | ||||||
| 				    buf + *startp, len, &words); | 				    buf + *startp, len, &words); | ||||||
| 	if (nwords == 0) { | 	if (nwords == 0) { | ||||||
| 		*wordsp = (char **) 0; | 		*wordsp = NULL; | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -761,7 +761,7 @@ add_glob(const char *str, int slen) | |||||||
| 	bool_t saw_slash = FALSE; | 	bool_t saw_slash = FALSE; | ||||||
|  |  | ||||||
| 	if (slen < 0) | 	if (slen < 0) | ||||||
| 		return (char *) 0; | 		return NULL; | ||||||
|  |  | ||||||
| 	toglob = str_nsave(str, slen + 1, ATEMP); /* + 1 for "*" */ | 	toglob = str_nsave(str, slen + 1, ATEMP); /* + 1 for "*" */ | ||||||
| 	toglob[slen] = '\0'; | 	toglob[slen] = '\0'; | ||||||
| @@ -840,7 +840,7 @@ x_basename(const char *s, const char *se) | |||||||
| { | { | ||||||
| 	const char *p; | 	const char *p; | ||||||
|  |  | ||||||
| 	if (se == (char *) 0) | 	if (se == NULL) | ||||||
| 		se = s + strlen(s); | 		se = s + strlen(s); | ||||||
| 	if (s == se) | 	if (s == se) | ||||||
| 		return 0; | 		return 0; | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								emacs.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								emacs.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/emacs.c,v 2.4 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/emacs.c,v 2.5 2004/12/18 19:22:28 tg Exp $ */ | ||||||
| /*	$OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $	*/ | /*	$OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -18,7 +18,7 @@ | |||||||
| #include <locale.h> | #include <locale.h> | ||||||
| #include "edit.h" | #include "edit.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/emacs.c,v 2.4 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/emacs.c,v 2.5 2004/12/18 19:22:28 tg Exp $"); | ||||||
|  |  | ||||||
| static	Area	aedit; | static	Area	aedit; | ||||||
| #define	AEDIT	&aedit		/* area for kill ring and macro defns */ | #define	AEDIT	&aedit		/* area for kill ring and macro defns */ | ||||||
| @@ -318,7 +318,7 @@ x_emacs(char *buf, size_t len) | |||||||
| 	xlp_valid = TRUE; | 	xlp_valid = TRUE; | ||||||
| 	xmp = NULL; | 	xmp = NULL; | ||||||
| 	x_curprefix = 0; | 	x_curprefix = 0; | ||||||
| 	macroptr = (char *) 0; | 	macroptr = NULL; | ||||||
| 	x_histp = histptr + 1; | 	x_histp = histptr + 1; | ||||||
| 	x_last_command = XFUNC_error; | 	x_last_command = XFUNC_error; | ||||||
|  |  | ||||||
| @@ -404,7 +404,7 @@ x_ins_string(int c GCC_FUNC_ATTR(unused)) | |||||||
| 	macroptr = x_atab[c>>8][c & CHARMASK]; | 	macroptr = x_atab[c>>8][c & CHARMASK]; | ||||||
| 	if (macroptr && !*macroptr) { | 	if (macroptr && !*macroptr) { | ||||||
| 		/* XXX bell? */ | 		/* XXX bell? */ | ||||||
| 		macroptr = (char *) 0; | 		macroptr = NULL; | ||||||
| 	} | 	} | ||||||
| 	return KSTD; | 	return KSTD; | ||||||
| } | } | ||||||
| @@ -1033,7 +1033,7 @@ x_redraw(int limit) | |||||||
| 	if (xbp == xbuf) | 	if (xbp == xbuf) | ||||||
| 	{ | 	{ | ||||||
| 	  pprompt(prompt + prompt_skip, 0); | 	  pprompt(prompt + prompt_skip, 0); | ||||||
| 	  x_col = promptlen(prompt, (const char **) 0); | 	  x_col = promptlen(prompt, NULL); | ||||||
| 	} | 	} | ||||||
| 	x_displen = xx_cols - 2 - x_col; | 	x_displen = xx_cols - 2 - x_col; | ||||||
| 	xlp_valid = FALSE; | 	xlp_valid = FALSE; | ||||||
| @@ -1732,7 +1732,7 @@ x_e_getc(void) | |||||||
| 		if (macroptr)  { | 		if (macroptr)  { | ||||||
| 			c = *macroptr++; | 			c = *macroptr++; | ||||||
| 			if (!*macroptr) | 			if (!*macroptr) | ||||||
| 				macroptr = (char *) 0; | 				macroptr = NULL; | ||||||
| 		} else | 		} else | ||||||
| 			c = x_getc(); | 			c = x_getc(); | ||||||
| 	} | 	} | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								eval.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								eval.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/eval.c,v 2.4 2004/12/14 15:54:23 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/eval.c,v 2.5 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: eval.c,v 1.18 2004/12/13 16:37:06 millert Exp $	*/ | /*	$OpenBSD: eval.c,v 1.18 2004/12/13 16:37:06 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "ksh_dir.h" | #include "ksh_dir.h" | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/eval.c,v 2.4 2004/12/14 15:54:23 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/eval.c,v 2.5 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * string expansion |  * string expansion | ||||||
| @@ -198,7 +198,7 @@ expand(char *cp, XPtrV *wp, int f) | |||||||
| 	doblank = 0; | 	doblank = 0; | ||||||
| 	make_magic = 0; | 	make_magic = 0; | ||||||
| 	word = (f&DOBLANK) ? IFS_WS : IFS_WORD; | 	word = (f&DOBLANK) ? IFS_WS : IFS_WORD; | ||||||
| 	st_head.next = (SubType *) 0; | 	st_head.next = NULL; | ||||||
| 	st = &st_head; | 	st = &st_head; | ||||||
|  |  | ||||||
| 	while (1) { | 	while (1) { | ||||||
| @@ -305,7 +305,7 @@ expand(char *cp, XPtrV *wp, int f) | |||||||
|  |  | ||||||
| 						newst = (SubType *) alloc( | 						newst = (SubType *) alloc( | ||||||
| 							sizeof(SubType), ATEMP); | 							sizeof(SubType), ATEMP); | ||||||
| 						newst->next = (SubType *) 0; | 						newst->next = NULL; | ||||||
| 						newst->prev = st; | 						newst->prev = st; | ||||||
| 						st->next = newst; | 						st->next = newst; | ||||||
| 					} | 					} | ||||||
| @@ -713,7 +713,7 @@ varsub(Expand *xp, char *sp, char *word, int *stypep, int *slenp) | |||||||
| 	if (sp[0] == '\0')	/* Bad variable name */ | 	if (sp[0] == '\0')	/* Bad variable name */ | ||||||
| 		return -1; | 		return -1; | ||||||
|  |  | ||||||
| 	xp->var = (struct tbl *) 0; | 	xp->var = NULL; | ||||||
|  |  | ||||||
| 	/* ${#var}, string length or array size */ | 	/* ${#var}, string length or array size */ | ||||||
| 	if (sp[0] == '#' && (c = sp[1]) != '\0') { | 	if (sp[0] == '#' && (c = sp[1]) != '\0') { | ||||||
| @@ -871,7 +871,7 @@ comsub(Expand *xp, char *cp) | |||||||
|  |  | ||||||
| 		if ((io->flag&IOTYPE) != IOREAD) | 		if ((io->flag&IOTYPE) != IOREAD) | ||||||
| 			errorf("funny $() command: %s", | 			errorf("funny $() command: %s", | ||||||
| 				snptreef((char *) 0, 32, "%R", io)); | 				snptreef(NULL, 32, "%R", io)); | ||||||
| 		shf = shf_open(name = evalstr(io->name, DOTILDE), O_RDONLY, 0, | 		shf = shf_open(name = evalstr(io->name, DOTILDE), O_RDONLY, 0, | ||||||
| 			SHF_MAPHI|SHF_CLEXEC); | 			SHF_MAPHI|SHF_CLEXEC); | ||||||
| 		if (shf == NULL) | 		if (shf == NULL) | ||||||
| @@ -880,7 +880,7 @@ comsub(Expand *xp, char *cp) | |||||||
| 	} else { | 	} else { | ||||||
| 		int ofd1, pv[2]; | 		int ofd1, pv[2]; | ||||||
| 		openpipe(pv); | 		openpipe(pv); | ||||||
| 		shf = shf_fdopen(pv[0], SHF_RD, (struct shf *) 0); | 		shf = shf_fdopen(pv[0], SHF_RD, NULL); | ||||||
| 		ofd1 = savefd(1, 0);	/* fd 1 may be closed... */ | 		ofd1 = savefd(1, 0);	/* fd 1 may be closed... */ | ||||||
| 		if (pv[1] != 1) { | 		if (pv[1] != 1) { | ||||||
| 			ksh_dup2(pv[1], 1, FALSE); | 			ksh_dup2(pv[1], 1, FALSE); | ||||||
| @@ -1171,7 +1171,7 @@ maybe_expand_tilde(char *p, XString *dsp, char **dpp, int isassign) | |||||||
| 		p += 2; | 		p += 2; | ||||||
| 	} | 	} | ||||||
| 	*tp = '\0'; | 	*tp = '\0'; | ||||||
| 	r = (p[0] == EOS || p[0] == CHAR || p[0] == CSUBST) ? tilde(Xstring(ts, tp)) : (char *) 0; | 	r = (p[0] == EOS || p[0] == CHAR || p[0] == CSUBST) ? tilde(Xstring(ts, tp)) : NULL; | ||||||
| 	Xfree(ts, tp); | 	Xfree(ts, tp); | ||||||
| 	if (r) { | 	if (r) { | ||||||
| 		while (*r) { | 		while (*r) { | ||||||
| @@ -1207,7 +1207,7 @@ tilde(char *cp) | |||||||
| 		dp = homedir(cp); | 		dp = homedir(cp); | ||||||
| 	/* If HOME, PWD or OLDPWD are not set, don't expand ~ */ | 	/* If HOME, PWD or OLDPWD are not set, don't expand ~ */ | ||||||
| 	if (dp == null) | 	if (dp == null) | ||||||
| 		dp = (char *) 0; | 		dp = NULL; | ||||||
| 	return dp; | 	return dp; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1252,7 +1252,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo) | |||||||
|  |  | ||||||
| 	/* find matching close brace, if any */ | 	/* find matching close brace, if any */ | ||||||
| 	if (p) { | 	if (p) { | ||||||
| 		comma = (char *) 0; | 		comma = NULL; | ||||||
| 		count = 1; | 		count = 1; | ||||||
| 		for (p += 2; *p && count; p++) { | 		for (p += 2; *p && count; p++) { | ||||||
| 			if (ISMAGIC(*p)) { | 			if (ISMAGIC(*p)) { | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								exec.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								exec.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/exec.c,v 2.5 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/exec.c,v 2.6 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: exec.c,v 1.31 2003/12/15 05:25:52 otto Exp $	*/ | /*	$OpenBSD: exec.c,v 1.31 2003/12/15 05:25:52 otto Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/exec.c,v 2.5 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/exec.c,v 2.6 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| static int	comexec(struct op *t, struct tbl *volatile tp, char **ap, | static int	comexec(struct op *t, struct tbl *volatile tp, char **ap, | ||||||
| 			      int volatile flags); | 			      int volatile flags); | ||||||
| @@ -199,7 +199,7 @@ execute(struct op *volatile t, volatile int flags) | |||||||
| 		e->type = E_ERRH; | 		e->type = E_ERRH; | ||||||
| 		i = ksh_sigsetjmp(e->jbuf, 0); | 		i = ksh_sigsetjmp(e->jbuf, 0); | ||||||
| 		if (i) { | 		if (i) { | ||||||
| 			sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 			sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 			quitenv(NULL); | 			quitenv(NULL); | ||||||
| 			unwind(i); | 			unwind(i); | ||||||
| 			/*NOTREACHED*/ | 			/*NOTREACHED*/ | ||||||
| @@ -222,7 +222,7 @@ execute(struct op *volatile t, volatile int flags) | |||||||
| 			close(pv[0]); | 			close(pv[0]); | ||||||
| 		} | 		} | ||||||
| 		coproc.write = pv[1]; | 		coproc.write = pv[1]; | ||||||
| 		coproc.job = (void *) 0; | 		coproc.job = NULL; | ||||||
|  |  | ||||||
| 		if (coproc.readw >= 0) | 		if (coproc.readw >= 0) | ||||||
| 			ksh_dup2(coproc.readw, 1, FALSE); | 			ksh_dup2(coproc.readw, 1, FALSE); | ||||||
| @@ -236,7 +236,7 @@ execute(struct op *volatile t, volatile int flags) | |||||||
| 			++coproc.id; | 			++coproc.id; | ||||||
| 		} | 		} | ||||||
| # ifdef JOB_SIGS | # ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 		e->type = E_EXEC; /* no more need for error handler */ | 		e->type = E_EXEC; /* no more need for error handler */ | ||||||
| # endif /* JOB_SIGS */ | # endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| @@ -584,7 +584,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags) | |||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 			if (include(tp->u.fpath, 0, (char **) 0, 0) < 0) { | 			if (include(tp->u.fpath, 0, NULL, 0) < 0) { | ||||||
| 				warningf(TRUE, | 				warningf(TRUE, | ||||||
| 			    "%s: can't open function definition file %s - %s", | 			    "%s: can't open function definition file %s - %s", | ||||||
| 					cp, tp->u.fpath, strerror(errno)); | 					cp, tp->u.fpath, strerror(errno)); | ||||||
| @@ -727,7 +727,7 @@ scriptexec(struct op *tp, char **ap) | |||||||
|  |  | ||||||
| 	shell = str_val(global(EXECSHELL_STR)); | 	shell = str_val(global(EXECSHELL_STR)); | ||||||
| 	if (shell && *shell) | 	if (shell && *shell) | ||||||
| 		shell = search(shell, path, X_OK, (int *) 0); | 		shell = search(shell, path, X_OK, NULL); | ||||||
| 	if (!shell || !*shell) | 	if (!shell || !*shell) | ||||||
| 		shell = EXECSHELL; | 		shell = EXECSHELL; | ||||||
|  |  | ||||||
| @@ -749,7 +749,7 @@ scriptexec(struct op *tp, char **ap) | |||||||
| 			while (*cp && (*cp == ' ' || *cp == '\t')) | 			while (*cp && (*cp == ' ' || *cp == '\t')) | ||||||
| 				cp++; | 				cp++; | ||||||
| 			if (*cp && *cp != '\n') { | 			if (*cp && *cp != '\n') { | ||||||
| 				char *a0 = cp, *a1 = (char *) 0; | 				char *a0 = cp, *a1 = NULL; | ||||||
|  |  | ||||||
| 				while (*cp && *cp != '\n' && *cp != ' ' | 				while (*cp && *cp != '\n' && *cp != ' ' | ||||||
| 				    && *cp != '\t') | 				    && *cp != '\t') | ||||||
| @@ -803,7 +803,7 @@ struct tbl * | |||||||
| findfunc(const char *name, unsigned int h, int create) | findfunc(const char *name, unsigned int h, int create) | ||||||
| { | { | ||||||
| 	struct block *l; | 	struct block *l; | ||||||
| 	struct tbl *tp = (struct tbl *) 0; | 	struct tbl *tp = NULL; | ||||||
|  |  | ||||||
| 	for (l = e->loc; l; l = l->next) { | 	for (l = e->loc; l; l = l->next) { | ||||||
| 		tp = tsearch(&l->funs, name, h); | 		tp = tsearch(&l->funs, name, h); | ||||||
| @@ -813,7 +813,7 @@ findfunc(const char *name, unsigned int h, int create) | |||||||
| 			tp = tenter(&l->funs, name, h); | 			tp = tenter(&l->funs, name, h); | ||||||
| 			tp->flag = DEFINED; | 			tp->flag = DEFINED; | ||||||
| 			tp->type = CFUNC; | 			tp->type = CFUNC; | ||||||
| 			tp->val.t = (struct op *) 0; | 			tp->val.t = NULL; | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -923,7 +923,7 @@ findcom(const char *name, int flags) | |||||||
| 		tp = findfunc(name, h, FALSE); | 		tp = findfunc(name, h, FALSE); | ||||||
| 		if (tp && !(tp->flag & ISSET)) { | 		if (tp && !(tp->flag & ISSET)) { | ||||||
| 			if ((fpath = str_val(global("FPATH"))) == null) { | 			if ((fpath = str_val(global("FPATH"))) == null) { | ||||||
| 				tp->u.fpath = (char *) 0; | 				tp->u.fpath = NULL; | ||||||
| 				tp->u2.errno_ = 0; | 				tp->u2.errno_ = 0; | ||||||
| 			} else | 			} else | ||||||
| 				tp->u.fpath = search(name, fpath, R_OK, | 				tp->u.fpath = search(name, fpath, R_OK, | ||||||
| @@ -975,7 +975,7 @@ findcom(const char *name, int flags) | |||||||
| 		} else if ((flags & FC_FUNC) | 		} else if ((flags & FC_FUNC) | ||||||
| 			   && (fpath = str_val(global("FPATH"))) != null | 			   && (fpath = str_val(global("FPATH"))) != null | ||||||
| 			   && (npath = search(name, fpath, R_OK, | 			   && (npath = search(name, fpath, R_OK, | ||||||
| 					      &tp->u2.errno_)) != (char *) 0) | 					      &tp->u2.errno_)) != NULL) | ||||||
| 		{ | 		{ | ||||||
| 			/* An undocumented feature of at&t ksh is that it | 			/* An undocumented feature of at&t ksh is that it | ||||||
| 			 * searches FPATH if a command is not found, even | 			 * searches FPATH if a command is not found, even | ||||||
| @@ -1102,7 +1102,7 @@ call_builtin(struct tbl *tp, char **wp) | |||||||
| 	shf_flush(shl_stdout); | 	shf_flush(shl_stdout); | ||||||
| 	shl_stdout_ok = 0; | 	shl_stdout_ok = 0; | ||||||
| 	builtin_flag = 0; | 	builtin_flag = 0; | ||||||
| 	builtin_argv0 = (char *) 0; | 	builtin_argv0 = NULL; | ||||||
| 	return rv; | 	return rv; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1124,13 +1124,13 @@ iosetup(struct ioword *iop, struct tbl *tp) | |||||||
|  |  | ||||||
| 	/* Used for tracing and error messages to print expanded cp */ | 	/* Used for tracing and error messages to print expanded cp */ | ||||||
| 	iotmp = *iop; | 	iotmp = *iop; | ||||||
| 	iotmp.name = (iotype == IOHERE) ? (char *) 0 : cp; | 	iotmp.name = (iotype == IOHERE) ? NULL : cp; | ||||||
| 	iotmp.flag |= IONAMEXP; | 	iotmp.flag |= IONAMEXP; | ||||||
|  |  | ||||||
| 	if (Flag(FXTRACE)) | 	if (Flag(FXTRACE)) | ||||||
| 		shellf("%s%s\n", | 		shellf("%s%s\n", | ||||||
| 			substitute(str_val(global("PS4")), 0), | 			substitute(str_val(global("PS4")), 0), | ||||||
| 			snptreef((char *) 0, 32, "%R", &iotmp)); | 			snptreef(NULL, 32, "%R", &iotmp)); | ||||||
|  |  | ||||||
| 	switch (iotype) { | 	switch (iotype) { | ||||||
| 	  case IOREAD: | 	  case IOREAD: | ||||||
| @@ -1175,7 +1175,7 @@ iosetup(struct ioword *iop, struct tbl *tp) | |||||||
| 				&emsg)) < 0) | 				&emsg)) < 0) | ||||||
| 		{ | 		{ | ||||||
| 			warningf(TRUE, "%s: %s", | 			warningf(TRUE, "%s: %s", | ||||||
| 				snptreef((char *) 0, 32, "%R", &iotmp), emsg); | 				snptreef(NULL, 32, "%R", &iotmp), emsg); | ||||||
| 			return -1; | 			return -1; | ||||||
| 		} | 		} | ||||||
| 		if (u == iop->unit) | 		if (u == iop->unit) | ||||||
| @@ -1220,7 +1220,7 @@ iosetup(struct ioword *iop, struct tbl *tp) | |||||||
| 		if (ksh_dup2(u, iop->unit, TRUE) < 0) { | 		if (ksh_dup2(u, iop->unit, TRUE) < 0) { | ||||||
| 			warningf(TRUE, | 			warningf(TRUE, | ||||||
| 				"could not finish (dup) redirection %s: %s", | 				"could not finish (dup) redirection %s: %s", | ||||||
| 				snptreef((char *) 0, 32, "%R", &iotmp), | 				snptreef(NULL, 32, "%R", &iotmp), | ||||||
| 				strerror(errno)); | 				strerror(errno)); | ||||||
| 			if (iotype != IODUP) | 			if (iotype != IODUP) | ||||||
| 				close(u); | 				close(u); | ||||||
| @@ -1257,7 +1257,7 @@ herein(const char *content, int sub) | |||||||
| 	int i; | 	int i; | ||||||
|  |  | ||||||
| 	/* ksh -c 'cat << EOF' can cause this... */ | 	/* ksh -c 'cat << EOF' can cause this... */ | ||||||
| 	if (content == (char *) 0) { | 	if (content == NULL) { | ||||||
| 		warningf(TRUE, "here document missing"); | 		warningf(TRUE, "here document missing"); | ||||||
| 		return -2; /* special to iosetup(): don't print error */ | 		return -2; /* special to iosetup(): don't print error */ | ||||||
| 	} | 	} | ||||||
| @@ -1332,7 +1332,7 @@ do_selectargs(char **ap, bool_t print_menu) | |||||||
| 			pr_menu(ap); | 			pr_menu(ap); | ||||||
| 		shellf("%s", str_val(global("PS3"))); | 		shellf("%s", str_val(global("PS3"))); | ||||||
| 		if (call_builtin(findcom("read", FC_BI), (char **) read_args)) | 		if (call_builtin(findcom("read", FC_BI), (char **) read_args)) | ||||||
| 			return (char *) 0; | 			return NULL; | ||||||
| 		s = str_val(global("REPLY")); | 		s = str_val(global("REPLY")); | ||||||
| 		if (*s) { | 		if (*s) { | ||||||
| 			i = atoi(s); | 			i = atoi(s); | ||||||
| @@ -1486,7 +1486,7 @@ dbteste_getopnd(Test_env *te, Test_op op, int do_eval) | |||||||
| 	char *s = *te->pos.wp; | 	char *s = *te->pos.wp; | ||||||
|  |  | ||||||
| 	if (!s) | 	if (!s) | ||||||
| 		return (char *) 0; | 		return NULL; | ||||||
|  |  | ||||||
| 	te->pos.wp++; | 	te->pos.wp++; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								expr.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								expr.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/expr.c,v 2.3 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/expr.c,v 2.4 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $	*/ | /*	$OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "sh.h" | #include "sh.h" | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/expr.c,v 2.3 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/expr.c,v 2.4 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| /* The order of these enums is constrained by the order of opinfo[] */ | /* The order of these enums is constrained by the order of opinfo[] */ | ||||||
| enum token { | enum token { | ||||||
| @@ -168,7 +168,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok) | |||||||
| 	/* save state to allow recursive calls */ | 	/* save state to allow recursive calls */ | ||||||
| 	curstate.expression = curstate.tokp = expr; | 	curstate.expression = curstate.tokp = expr; | ||||||
| 	curstate.noassign = 0; | 	curstate.noassign = 0; | ||||||
| 	curstate.evaling = (struct tbl *) 0; | 	curstate.evaling = NULL; | ||||||
|  |  | ||||||
| 	newenv(E_ERRH); | 	newenv(E_ERRH); | ||||||
| 	i = ksh_sigsetjmp(e->jbuf, 0); | 	i = ksh_sigsetjmp(e->jbuf, 0); | ||||||
| @@ -194,7 +194,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok) | |||||||
| 	v = intvar(es, evalexpr(es, MAX_PREC)); | 	v = intvar(es, evalexpr(es, MAX_PREC)); | ||||||
|  |  | ||||||
| 	if (es->tok != END) | 	if (es->tok != END) | ||||||
| 		evalerr(es, ET_UNEXPECTED, (char *) 0); | 		evalerr(es, ET_UNEXPECTED, NULL); | ||||||
|  |  | ||||||
| 	if (vp->flag & INTEGER) | 	if (vp->flag & INTEGER) | ||||||
| 		setint_v(vp, v); | 		setint_v(vp, v); | ||||||
| @@ -298,7 +298,7 @@ evalexpr(Expr_state *es, enum prec prec) | |||||||
| 			vl = es->val; | 			vl = es->val; | ||||||
| 			token(es); | 			token(es); | ||||||
| 		} else { | 		} else { | ||||||
| 			evalerr(es, ET_UNEXPECTED, (char *) 0); | 			evalerr(es, ET_UNEXPECTED, NULL); | ||||||
| 			/*NOTREACHED*/ | 			/*NOTREACHED*/ | ||||||
| 		} | 		} | ||||||
| 		if (es->tok == O_PLUSPLUS || es->tok == O_MINUSMINUS) { | 		if (es->tok == O_PLUSPLUS || es->tok == O_MINUSMINUS) { | ||||||
| @@ -574,7 +574,7 @@ intvar(Expr_state *es, struct tbl *vp) | |||||||
| 		vp->flag |= EXPRINEVAL; | 		vp->flag |= EXPRINEVAL; | ||||||
| 		v_evaluate(vq, str_val(vp), KSH_UNWIND_ERROR); | 		v_evaluate(vq, str_val(vp), KSH_UNWIND_ERROR); | ||||||
| 		vp->flag &= ~EXPRINEVAL; | 		vp->flag &= ~EXPRINEVAL; | ||||||
| 		es->evaling = (struct tbl *) 0; | 		es->evaling = NULL; | ||||||
| 	} | 	} | ||||||
| 	return vq; | 	return vq; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								history.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								history.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/history.c,v 2.5 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/history.c,v 2.6 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: history.c,v 1.24 2004/08/03 12:44:59 danh Exp $	*/ | /*	$OpenBSD: history.c,v 1.24 2004/08/03 12:44:59 danh Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -21,7 +21,7 @@ | |||||||
| #include "sh.h" | #include "sh.h" | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/history.c,v 2.5 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/history.c,v 2.6 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| #ifndef EASY_HISTORY | #ifndef EASY_HISTORY | ||||||
| /*	Defines and includes for the complicated case */ | /*	Defines and includes for the complicated case */ | ||||||
| @@ -71,10 +71,10 @@ c_fc(char **wp) | |||||||
| { | { | ||||||
| 	struct shf *shf; | 	struct shf *shf; | ||||||
| 	struct temp UNINITIALIZED(*tf); | 	struct temp UNINITIALIZED(*tf); | ||||||
| 	char *p, *editor = (char *) 0; | 	char *p, *editor = NULL; | ||||||
| 	int gflag = 0, lflag = 0, nflag = 0, sflag = 0, rflag = 0; | 	int gflag = 0, lflag = 0, nflag = 0, sflag = 0, rflag = 0; | ||||||
| 	int optc; | 	int optc; | ||||||
| 	char *first = (char *) 0, *last = (char *) 0; | 	char *first = NULL, *last = NULL; | ||||||
| 	char **hfirst, **hlast, **hp; | 	char **hfirst, **hlast, **hp; | ||||||
|  |  | ||||||
| 	if (!Flag(FTALKING_I)) { | 	if (!Flag(FTALKING_I)) { | ||||||
| @@ -130,7 +130,7 @@ c_fc(char **wp) | |||||||
|  |  | ||||||
| 	/* Substitute and execute command */ | 	/* Substitute and execute command */ | ||||||
| 	if (sflag) { | 	if (sflag) { | ||||||
| 		char *pat = (char *) 0, *rep = (char *) 0; | 		char *pat = NULL, *rep = NULL; | ||||||
|  |  | ||||||
| 		if (editor || lflag || nflag || rflag) { | 		if (editor || lflag || nflag || rflag) { | ||||||
| 			bi_errorf("can't use -e, -l, -n, -r with -s (-e -)"); | 			bi_errorf("can't use -e, -l, -n, -r with -s (-e -)"); | ||||||
| @@ -296,7 +296,7 @@ hist_execute(char *cmd) | |||||||
| 		if ((q = strchr(p, '\n'))) { | 		if ((q = strchr(p, '\n'))) { | ||||||
| 			*q++ = '\0'; /* kill the newline */ | 			*q++ = '\0'; /* kill the newline */ | ||||||
| 			if (!*q) /* ignore trailing newline */ | 			if (!*q) /* ignore trailing newline */ | ||||||
| 				q = (char *) 0; | 				q = NULL; | ||||||
| 		} | 		} | ||||||
| #ifdef EASY_HISTORY | #ifdef EASY_HISTORY | ||||||
| 		if (p != cmd) | 		if (p != cmd) | ||||||
| @@ -371,7 +371,7 @@ hist_replace(char **hp, const char *pat, const char *rep, int global) | |||||||
| static char ** | static char ** | ||||||
| hist_get(const char *str, int approx, int allow_cur) | hist_get(const char *str, int approx, int allow_cur) | ||||||
| { | { | ||||||
| 	char **hp = (char **) 0; | 	char **hp = NULL; | ||||||
| 	int n; | 	int n; | ||||||
|  |  | ||||||
| 	if (getn(str, &n)) { | 	if (getn(str, &n)) { | ||||||
| @@ -381,18 +381,18 @@ hist_get(const char *str, int approx, int allow_cur) | |||||||
| 				hp = hist_get_oldest(); | 				hp = hist_get_oldest(); | ||||||
| 			else { | 			else { | ||||||
| 				bi_errorf("%s: not in history", str); | 				bi_errorf("%s: not in history", str); | ||||||
| 				hp = (char **) 0; | 				hp = NULL; | ||||||
| 			} | 			} | ||||||
| 		} else if (hp > histptr) { | 		} else if (hp > histptr) { | ||||||
| 			if (approx) | 			if (approx) | ||||||
| 				hp = hist_get_newest(allow_cur); | 				hp = hist_get_newest(allow_cur); | ||||||
| 			else { | 			else { | ||||||
| 				bi_errorf("%s: not in history", str); | 				bi_errorf("%s: not in history", str); | ||||||
| 				hp = (char **) 0; | 				hp = NULL; | ||||||
| 			} | 			} | ||||||
| 		} else if (!allow_cur && hp == histptr) { | 		} else if (!allow_cur && hp == histptr) { | ||||||
| 			bi_errorf("%s: invalid range", str); | 			bi_errorf("%s: invalid range", str); | ||||||
| 			hp = (char **) 0; | 			hp = NULL; | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		int anchored = *str == '?' ? (++str, 0) : 1; | 		int anchored = *str == '?' ? (++str, 0) : 1; | ||||||
| @@ -401,7 +401,7 @@ hist_get(const char *str, int approx, int allow_cur) | |||||||
| 		n = findhist(histptr - history - 1, 0, str, anchored); | 		n = findhist(histptr - history - 1, 0, str, anchored); | ||||||
| 		if (n < 0) { | 		if (n < 0) { | ||||||
| 			bi_errorf("%s: not in history", str); | 			bi_errorf("%s: not in history", str); | ||||||
| 			hp = (char **) 0; | 			hp = NULL; | ||||||
| 		} else | 		} else | ||||||
| 			hp = &history[n]; | 			hp = &history[n]; | ||||||
| 	} | 	} | ||||||
| @@ -414,7 +414,7 @@ hist_get_newest(int allow_cur) | |||||||
| { | { | ||||||
| 	if (histptr < history || (!allow_cur && histptr == history)) { | 	if (histptr < history || (!allow_cur && histptr == history)) { | ||||||
| 		bi_errorf("no history (yet)"); | 		bi_errorf("no history (yet)"); | ||||||
| 		return (char **) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	if (allow_cur) | 	if (allow_cur) | ||||||
| 		return histptr; | 		return histptr; | ||||||
| @@ -427,7 +427,7 @@ hist_get_oldest(void) | |||||||
| { | { | ||||||
| 	if (histptr <= history) { | 	if (histptr <= history) { | ||||||
| 		bi_errorf("no history (yet)"); | 		bi_errorf("no history (yet)"); | ||||||
| 		return (char **) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	return history; | 	return history; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								io.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								io.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/io.c,v 2.3 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/io.c,v 2.4 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $	*/ | /*	$OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -77,7 +77,7 @@ bi_errorf(const char *fmt, ...) | |||||||
| 	if ((builtin_flag & SPEC_BI) | 	if ((builtin_flag & SPEC_BI) | ||||||
| 	    || (Flag(FPOSIX) && (builtin_flag & KEEPASN))) | 	    || (Flag(FPOSIX) && (builtin_flag & KEEPASN))) | ||||||
| 	{ | 	{ | ||||||
| 		builtin_argv0 = (char *) 0; | 		builtin_argv0 = NULL; | ||||||
| 		unwind(LERROR); | 		unwind(LERROR); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @@ -433,13 +433,13 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist) | |||||||
| 	len = strlen(dir) + 3 + 20 + 20 + 1; | 	len = strlen(dir) + 3 + 20 + 20 + 1; | ||||||
| 	tp = (struct temp *) alloc(sizeof(struct temp) + len, ap); | 	tp = (struct temp *) alloc(sizeof(struct temp) + len, ap); | ||||||
| 	tp->name = path = (char *) &tp[1]; | 	tp->name = path = (char *) &tp[1]; | ||||||
| 	tp->shf = (struct shf *) 0; | 	tp->shf = NULL; | ||||||
| 	tp->type = type; | 	tp->type = type; | ||||||
| #ifdef	HAVE_MKSTEMP | #ifdef	HAVE_MKSTEMP | ||||||
| 	shf_snprintf(path, len, "%s/shXXXXXXXX", dir); | 	shf_snprintf(path, len, "%s/shXXXXXXXX", dir); | ||||||
| 	fd = mkstemp(path); | 	fd = mkstemp(path); | ||||||
| 	if (fd >= 0) | 	if (fd >= 0) | ||||||
| 		tp->shf = shf_fdopen(fd, SHF_WR, (struct shf *) 0); | 		tp->shf = shf_fdopen(fd, SHF_WR, NULL); | ||||||
| #else | #else | ||||||
| 	while (1) { | 	while (1) { | ||||||
| 		/* Note that temp files need to fit 8.3 DOS limits */ | 		/* Note that temp files need to fit 8.3 DOS limits */ | ||||||
| @@ -450,7 +450,7 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist) | |||||||
| 		 */ | 		 */ | ||||||
| 		fd = open(path, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600); | 		fd = open(path, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600); | ||||||
| 		if (fd >= 0) { | 		if (fd >= 0) { | ||||||
| 			tp->shf = shf_fdopen(fd, SHF_WR, (struct shf *) 0); | 			tp->shf = shf_fdopen(fd, SHF_WR, NULL); | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		if (errno != EINTR | 		if (errno != EINTR | ||||||
|   | |||||||
							
								
								
									
										132
									
								
								jobs.c
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								jobs.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/jobs.c,v 2.3 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/jobs.c,v 2.4 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $	*/ | /*	$OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -31,7 +31,7 @@ | |||||||
| #include "ksh_times.h" | #include "ksh_times.h" | ||||||
| #include "tty.h" | #include "tty.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/jobs.c,v 2.3 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/jobs.c,v 2.4 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| /* Start of system configuration stuff */ | /* Start of system configuration stuff */ | ||||||
|  |  | ||||||
| @@ -165,7 +165,7 @@ static const char	*const lookup_msgs[] = { | |||||||
| 				"no such job", | 				"no such job", | ||||||
| 				"ambiguous", | 				"ambiguous", | ||||||
| 				"argument must be %job or process id", | 				"argument must be %job or process id", | ||||||
| 				(char *) 0 | 				NULL | ||||||
| 			    }; | 			    }; | ||||||
| clock_t	j_systime, j_usrtime;	/* user and system time of last j_waitjed job */ | clock_t	j_systime, j_usrtime;	/* user and system time of last j_waitjed job */ | ||||||
|  |  | ||||||
| @@ -229,7 +229,7 @@ j_init(int mflagset) | |||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigemptyset(&sm_default); | 	sigemptyset(&sm_default); | ||||||
| 	sigprocmask(SIG_SETMASK, &sm_default, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &sm_default, NULL); | ||||||
|  |  | ||||||
| 	sigemptyset(&sm_sigchld); | 	sigemptyset(&sm_sigchld); | ||||||
| 	sigaddset(&sm_sigchld, SIGCHLD); | 	sigaddset(&sm_sigchld, SIGCHLD); | ||||||
| @@ -248,7 +248,7 @@ j_init(int mflagset) | |||||||
| 	/* shl_j is used to do asynchronous notification (used in | 	/* shl_j is used to do asynchronous notification (used in | ||||||
| 	 * an interrupt handler, so need a distinct shf) | 	 * an interrupt handler, so need a distinct shf) | ||||||
| 	 */ | 	 */ | ||||||
| 	shl_j = shf_fdopen(2, SHF_WR, (struct shf *) 0); | 	shl_j = shf_fdopen(2, SHF_WR, NULL); | ||||||
|  |  | ||||||
| # ifdef TTY_PGRP | # ifdef TTY_PGRP | ||||||
| 	if (Flag(FMONITOR) || Flag(FTALKING)) { | 	if (Flag(FMONITOR) || Flag(FTALKING)) { | ||||||
| @@ -283,7 +283,7 @@ j_exit(void) | |||||||
| 	Job	*j; | 	Job	*j; | ||||||
| 	int	killed = 0; | 	int	killed = 0; | ||||||
|  |  | ||||||
| 	for (j = job_list; j != (Job *) 0; j = j->next) { | 	for (j = job_list; j != NULL; j = j->next) { | ||||||
| 		if (j->ppid == procpid | 		if (j->ppid == procpid | ||||||
| 		    && (j->state == PSTOPPED | 		    && (j->state == PSTOPPED | ||||||
| 			|| (j->state == PRUNNING | 			|| (j->state == PRUNNING | ||||||
| @@ -458,7 +458,7 @@ exchild(struct op *t, int flags, int close_fd) | |||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	p = new_proc(); | 	p = new_proc(); | ||||||
| 	p->next = (Proc *) 0; | 	p->next = NULL; | ||||||
| 	p->state = PRUNNING; | 	p->state = PRUNNING; | ||||||
| 	WSTATUS(p->status) = 0; | 	WSTATUS(p->status) = 0; | ||||||
| 	p->pid = 0; | 	p->pid = 0; | ||||||
| @@ -520,7 +520,7 @@ exchild(struct op *t, int flags, int close_fd) | |||||||
| 		} | 		} | ||||||
| #endif /* NEED_PGRP_SYNC */ | #endif /* NEED_PGRP_SYNC */ | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 		errorf("cannot fork - try again"); | 		errorf("cannot fork - try again"); | ||||||
| 	} | 	} | ||||||
| @@ -597,7 +597,7 @@ exchild(struct op *t, int flags, int close_fd) | |||||||
| 		if (flags & XCOPROC) | 		if (flags & XCOPROC) | ||||||
| 			coproc_cleanup(FALSE); | 			coproc_cleanup(FALSE); | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 		cleanup_parents_env(); | 		cleanup_parents_env(); | ||||||
| #ifdef TTY_PGRP | #ifdef TTY_PGRP | ||||||
| @@ -673,7 +673,7 @@ exchild(struct op *t, int flags, int close_fd) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	return rv; | 	return rv; | ||||||
| @@ -695,7 +695,7 @@ startlast(void) | |||||||
| 		j_startjob(last_job); | 		j_startjob(last_job); | ||||||
| 	} | 	} | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -718,7 +718,7 @@ waitlast(void) | |||||||
| 		else | 		else | ||||||
| 			internal_errorf(0, "waitlast: not started"); | 			internal_errorf(0, "waitlast: not started"); | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 		return 125; /* not so arbitrary, non-zero value */ | 		return 125; /* not so arbitrary, non-zero value */ | ||||||
| 	} | 	} | ||||||
| @@ -726,7 +726,7 @@ waitlast(void) | |||||||
| 	rv = j_waitj(j, JW_NONE, "jw:waitlast"); | 	rv = j_waitj(j, JW_NONE, "jw:waitlast"); | ||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	return rv; | 	return rv; | ||||||
| @@ -748,7 +748,7 @@ waitfor(const char *cp, int *sigp) | |||||||
|  |  | ||||||
| 	*sigp = 0; | 	*sigp = 0; | ||||||
|  |  | ||||||
| 	if (cp == (char *) 0) { | 	if (cp == NULL) { | ||||||
| 		/* wait for an unspecified job - always returns 0, so | 		/* wait for an unspecified job - always returns 0, so | ||||||
| 		 * don't have to worry about exited/signaled jobs | 		 * don't have to worry about exited/signaled jobs | ||||||
| 		 */ | 		 */ | ||||||
| @@ -758,7 +758,7 @@ waitfor(const char *cp, int *sigp) | |||||||
| 				break; | 				break; | ||||||
| 		if (!j) { | 		if (!j) { | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 			sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 			sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 			return -1; | 			return -1; | ||||||
| 		} | 		} | ||||||
| @@ -767,13 +767,13 @@ waitfor(const char *cp, int *sigp) | |||||||
| 		flags &= ~JW_ASYNCNOTIFY; | 		flags &= ~JW_ASYNCNOTIFY; | ||||||
| 		if (j->ppid != procpid) { | 		if (j->ppid != procpid) { | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 			sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 			sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 			return -1; | 			return -1; | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 		if (ecode != JL_NOSUCH) | 		if (ecode != JL_NOSUCH) | ||||||
| 			bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | 			bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | ||||||
| @@ -784,7 +784,7 @@ waitfor(const char *cp, int *sigp) | |||||||
| 	rv = j_waitj(j, flags, "jw:waitfor"); | 	rv = j_waitj(j, flags, "jw:waitfor"); | ||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	if (rv < 0) /* we were interrupted */ | 	if (rv < 0) /* we were interrupted */ | ||||||
| @@ -806,9 +806,9 @@ j_kill(const char *cp, int sig) | |||||||
| 	sigprocmask(SIG_BLOCK, &sm_sigchld, &omask); | 	sigprocmask(SIG_BLOCK, &sm_sigchld, &omask); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	if ((j = j_lookup(cp, &ecode)) == (Job *) 0) { | 	if ((j = j_lookup(cp, &ecode)) == NULL) { | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 		bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | 		bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | ||||||
| 		return 1; | 		return 1; | ||||||
| @@ -831,7 +831,7 @@ j_kill(const char *cp, int sig) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	return rv; | 	return rv; | ||||||
| @@ -851,14 +851,14 @@ j_resume(const char *cp, int bg) | |||||||
|  |  | ||||||
| 	sigprocmask(SIG_BLOCK, &sm_sigchld, &omask); | 	sigprocmask(SIG_BLOCK, &sm_sigchld, &omask); | ||||||
|  |  | ||||||
| 	if ((j = j_lookup(cp, &ecode)) == (Job *) 0) { | 	if ((j = j_lookup(cp, &ecode)) == NULL) { | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 		bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | 		bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (j->pgrp == 0) { | 	if (j->pgrp == 0) { | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 		bi_errorf("job not job-controlled"); | 		bi_errorf("job not job-controlled"); | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
| @@ -867,7 +867,7 @@ j_resume(const char *cp, int bg) | |||||||
| 		shprintf("[%d] ", j->job); | 		shprintf("[%d] ", j->job); | ||||||
|  |  | ||||||
| 	running = 0; | 	running = 0; | ||||||
| 	for (p = j->proc_list; p != (Proc *) 0; p = p->next) { | 	for (p = j->proc_list; p != NULL; p = p->next) { | ||||||
| 		if (p->state == PSTOPPED) { | 		if (p->state == PSTOPPED) { | ||||||
| 			p->state = PRUNNING; | 			p->state = PRUNNING; | ||||||
| 			WSTATUS(p->status) = 0; | 			WSTATUS(p->status) = 0; | ||||||
| @@ -896,7 +896,7 @@ j_resume(const char *cp, int bg) | |||||||
| 					set_tty(tty_fd, &tty_state, TF_NONE); | 					set_tty(tty_fd, &tty_state, TF_NONE); | ||||||
| 				} | 				} | ||||||
| 				sigprocmask(SIG_SETMASK, &omask, | 				sigprocmask(SIG_SETMASK, &omask, | ||||||
| 					(sigset_t *) 0); | 					NULL); | ||||||
| 				bi_errorf("1st tcsetpgrp(%d, %d) failed: %s", | 				bi_errorf("1st tcsetpgrp(%d, %d) failed: %s", | ||||||
| 					tty_fd, (int) ((j->flags & JF_SAVEDTTYPGRP) ? j->saved_ttypgrp : j->pgrp), strerror(errno)); | 					tty_fd, (int) ((j->flags & JF_SAVEDTTYPGRP) ? j->saved_ttypgrp : j->pgrp), strerror(errno)); | ||||||
| 				return 1; | 				return 1; | ||||||
| @@ -906,7 +906,7 @@ j_resume(const char *cp, int bg) | |||||||
| 		j->flags |= JF_FG; | 		j->flags |= JF_FG; | ||||||
| 		j->flags &= ~JF_KNOWN; | 		j->flags &= ~JF_KNOWN; | ||||||
| 		if (j == async_job) | 		if (j == async_job) | ||||||
| 			async_job = (Job *) 0; | 			async_job = NULL; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (j->state == PRUNNING && killpg(j->pgrp, SIGCONT) < 0) { | 	if (j->state == PRUNNING && killpg(j->pgrp, SIGCONT) < 0) { | ||||||
| @@ -926,7 +926,7 @@ j_resume(const char *cp, int bg) | |||||||
| 			} | 			} | ||||||
| # endif /* TTY_PGRP */ | # endif /* TTY_PGRP */ | ||||||
| 		} | 		} | ||||||
| 		sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 		sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 		bi_errorf("cannot continue job %s: %s", | 		bi_errorf("cannot continue job %s: %s", | ||||||
| 			cp, strerror(err)); | 			cp, strerror(err)); | ||||||
| 		return 1; | 		return 1; | ||||||
| @@ -939,7 +939,7 @@ j_resume(const char *cp, int bg) | |||||||
| # endif /* TTY_PGRP */ | # endif /* TTY_PGRP */ | ||||||
| 		rv = j_waitj(j, JW_NONE, "jw:resume"); | 		rv = j_waitj(j, JW_NONE, "jw:resume"); | ||||||
| 	} | 	} | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| 	return rv; | 	return rv; | ||||||
| } | } | ||||||
| #endif /* JOBS */ | #endif /* JOBS */ | ||||||
| @@ -951,7 +951,7 @@ j_stopped_running(void) | |||||||
| 	Job	*j; | 	Job	*j; | ||||||
| 	int	which = 0; | 	int	which = 0; | ||||||
|  |  | ||||||
| 	for (j = job_list; j != (Job *) 0; j = j->next) { | 	for (j = job_list; j != NULL; j = j->next) { | ||||||
| #ifdef JOBS | #ifdef JOBS | ||||||
| 		if (j->ppid == procpid && j->state == PSTOPPED) | 		if (j->ppid == procpid && j->state == PSTOPPED) | ||||||
| 			which |= 1; | 			which |= 1; | ||||||
| @@ -994,9 +994,9 @@ j_jobs(const char *cp, int slp, int nflag) | |||||||
| 	if (cp) { | 	if (cp) { | ||||||
| 		int	ecode; | 		int	ecode; | ||||||
|  |  | ||||||
| 		if ((j = j_lookup(cp, &ecode)) == (Job *) 0) { | 		if ((j = j_lookup(cp, &ecode)) == NULL) { | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 			sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 			sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 			bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | 			bi_errorf("%s: %s", cp, lookup_msgs[ecode]); | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -1022,7 +1022,7 @@ j_jobs(const char *cp, int slp, int nflag) | |||||||
| 			remove_job(j, "jobs"); | 			remove_job(j, "jobs"); | ||||||
| 	} | 	} | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -1055,7 +1055,7 @@ j_notify(void) | |||||||
| 	} | 	} | ||||||
| 	shf_flush(shl_out); | 	shf_flush(shl_out); | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1073,7 +1073,7 @@ j_async(void) | |||||||
| 		async_job->flags |= JF_KNOWN; | 		async_job->flags |= JF_KNOWN; | ||||||
|  |  | ||||||
| #ifdef JOB_SIGS | #ifdef JOB_SIGS | ||||||
| 	sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); | 	sigprocmask(SIG_SETMASK, &omask, NULL); | ||||||
| #endif /* JOB_SIGS */ | #endif /* JOB_SIGS */ | ||||||
|  |  | ||||||
| 	return async_pid; | 	return async_pid; | ||||||
| @@ -1097,7 +1097,7 @@ j_set_async(Job *j) | |||||||
| 	async_job = j; | 	async_job = j; | ||||||
| 	async_pid = j->last_proc->pid; | 	async_pid = j->last_proc->pid; | ||||||
| 	while (nzombie > child_max) { | 	while (nzombie > child_max) { | ||||||
| 		oldest = (Job *) 0; | 		oldest = NULL; | ||||||
| 		for (jl = job_list; jl; jl = jl->next) | 		for (jl = job_list; jl; jl = jl->next) | ||||||
| 			if (jl != async_job && (jl->flags & JF_ZOMBIE) | 			if (jl != async_job && (jl->flags & JF_ZOMBIE) | ||||||
| 			    && (!oldest || jl->age < oldest->age)) | 			    && (!oldest || jl->age < oldest->age)) | ||||||
| @@ -1323,12 +1323,12 @@ j_sigchld(int sig GCC_FUNC_ATTR(unused)) | |||||||
| 		ksh_times(&t1); | 		ksh_times(&t1); | ||||||
|  |  | ||||||
| 		/* find job and process structures for this pid */ | 		/* find job and process structures for this pid */ | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			for (p = j->proc_list; p != (Proc *) 0; p = p->next) | 			for (p = j->proc_list; p != NULL; p = p->next) | ||||||
| 				if (p->pid == pid) | 				if (p->pid == pid) | ||||||
| 					goto found; | 					goto found; | ||||||
| found: | found: | ||||||
| 		if (j == (Job *) 0) { | 		if (j == NULL) { | ||||||
| 			/* Can occur if process has kids, then execs shell | 			/* Can occur if process has kids, then execs shell | ||||||
| 			warningf(TRUE, "bad process waited for (pid = %d)", | 			warningf(TRUE, "bad process waited for (pid = %d)", | ||||||
| 				pid); | 				pid); | ||||||
| @@ -1386,7 +1386,7 @@ check_job(Job *j) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	jstate = PRUNNING; | 	jstate = PRUNNING; | ||||||
| 	for (p=j->proc_list; p != (Proc *) 0; p = p->next) { | 	for (p=j->proc_list; p != NULL; p = p->next) { | ||||||
| 		if (p->state == PRUNNING) | 		if (p->state == PRUNNING) | ||||||
| 			return;	/* some processes still running */ | 			return;	/* some processes still running */ | ||||||
| 		if (p->state > jstate) | 		if (p->state > jstate) | ||||||
| @@ -1415,7 +1415,7 @@ check_job(Job *j) | |||||||
| 		 * (at least, this is what ksh93d thinks) | 		 * (at least, this is what ksh93d thinks) | ||||||
| 		 */ | 		 */ | ||||||
| 		if (coproc.job == j) { | 		if (coproc.job == j) { | ||||||
| 			coproc.job = (void *) 0; | 			coproc.job = NULL; | ||||||
| 			/* XXX would be nice to get the closes out of here | 			/* XXX would be nice to get the closes out of here | ||||||
| 			 * so they aren't done in the signal handler. | 			 * so they aren't done in the signal handler. | ||||||
| 			 * Would mean a check in coproc_getfd() to | 			 * Would mean a check in coproc_getfd() to | ||||||
| @@ -1506,7 +1506,7 @@ j_print(Job *j, int how, struct shf *shf) | |||||||
| 	else if (j == job_list->next) | 	else if (j == job_list->next) | ||||||
| 		jobchar = '-'; | 		jobchar = '-'; | ||||||
|  |  | ||||||
| 	for (p = j->proc_list; p != (Proc *) 0;) { | 	for (p = j->proc_list; p != NULL;) { | ||||||
| 		coredumped = 0; | 		coredumped = 0; | ||||||
| 		switch (p->state) { | 		switch (p->state) { | ||||||
| 		case PRUNNING: | 		case PRUNNING: | ||||||
| @@ -1597,54 +1597,54 @@ j_lookup(const char *cp, int *ecodep) | |||||||
| 	if (digit(*cp)) { | 	if (digit(*cp)) { | ||||||
| 		job = atoi(cp); | 		job = atoi(cp); | ||||||
| 		/* Look for last_proc->pid (what $! returns) first... */ | 		/* Look for last_proc->pid (what $! returns) first... */ | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			if (j->last_proc && j->last_proc->pid == job) | 			if (j->last_proc && j->last_proc->pid == job) | ||||||
| 				return j; | 				return j; | ||||||
| 		/* ...then look for process group (this is non-POSIX), | 		/* ...then look for process group (this is non-POSIX), | ||||||
| 		 * but should not break anything (so FPOSIX isn't used). | 		 * but should not break anything (so FPOSIX isn't used). | ||||||
| 		 */ | 		 */ | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			if (j->pgrp && j->pgrp == job) | 			if (j->pgrp && j->pgrp == job) | ||||||
| 				return j; | 				return j; | ||||||
| 		if (ecodep) | 		if (ecodep) | ||||||
| 			*ecodep = JL_NOSUCH; | 			*ecodep = JL_NOSUCH; | ||||||
| 		return (Job *) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	if (*cp != '%') { | 	if (*cp != '%') { | ||||||
| 		if (ecodep) | 		if (ecodep) | ||||||
| 			*ecodep = JL_INVALID; | 			*ecodep = JL_INVALID; | ||||||
| 		return (Job *) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	switch (*++cp) { | 	switch (*++cp) { | ||||||
| 	case '\0': /* non-standard */ | 	case '\0': /* non-standard */ | ||||||
| 	case '+': | 	case '+': | ||||||
| 	case '%': | 	case '%': | ||||||
| 		if (job_list != (Job *) 0) | 		if (job_list != NULL) | ||||||
| 			return job_list; | 			return job_list; | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case '-': | 	case '-': | ||||||
| 		if (job_list != (Job *) 0 && job_list->next) | 		if (job_list != NULL && job_list->next) | ||||||
| 			return job_list->next; | 			return job_list->next; | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case '0': case '1': case '2': case '3': case '4': | 	case '0': case '1': case '2': case '3': case '4': | ||||||
| 	case '5': case '6': case '7': case '8': case '9': | 	case '5': case '6': case '7': case '8': case '9': | ||||||
| 		job = atoi(cp); | 		job = atoi(cp); | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			if (j->job == job) | 			if (j->job == job) | ||||||
| 				return j; | 				return j; | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case '?':		/* %?string */ | 	case '?':		/* %?string */ | ||||||
| 		last_match = (Job *) 0; | 		last_match = NULL; | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			for (p = j->proc_list; p != (Proc *) 0; p = p->next) | 			for (p = j->proc_list; p != NULL; p = p->next) | ||||||
| 				if (strstr(p->command, cp+1) != (char *) 0) { | 				if (strstr(p->command, cp+1) != NULL) { | ||||||
| 					if (last_match) { | 					if (last_match) { | ||||||
| 						if (ecodep) | 						if (ecodep) | ||||||
| 							*ecodep = JL_AMBIG; | 							*ecodep = JL_AMBIG; | ||||||
| 						return (Job *) 0; | 						return NULL; | ||||||
| 					} | 					} | ||||||
| 					last_match = j; | 					last_match = j; | ||||||
| 				} | 				} | ||||||
| @@ -1654,13 +1654,13 @@ j_lookup(const char *cp, int *ecodep) | |||||||
|  |  | ||||||
| 	default:		/* %string */ | 	default:		/* %string */ | ||||||
| 		len = strlen(cp); | 		len = strlen(cp); | ||||||
| 		last_match = (Job *) 0; | 		last_match = NULL; | ||||||
| 		for (j = job_list; j != (Job *) 0; j = j->next) | 		for (j = job_list; j != NULL; j = j->next) | ||||||
| 			if (strncmp(cp, j->proc_list->command, len) == 0) { | 			if (strncmp(cp, j->proc_list->command, len) == 0) { | ||||||
| 				if (last_match) { | 				if (last_match) { | ||||||
| 					if (ecodep) | 					if (ecodep) | ||||||
| 						*ecodep = JL_AMBIG; | 						*ecodep = JL_AMBIG; | ||||||
| 					return (Job *) 0; | 					return NULL; | ||||||
| 				} | 				} | ||||||
| 				last_match = j; | 				last_match = j; | ||||||
| 			} | 			} | ||||||
| @@ -1670,7 +1670,7 @@ j_lookup(const char *cp, int *ecodep) | |||||||
| 	} | 	} | ||||||
| 	if (ecodep) | 	if (ecodep) | ||||||
| 		*ecodep = JL_NOSUCH; | 		*ecodep = JL_NOSUCH; | ||||||
| 	return (Job *) 0; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| static Job	*free_jobs; | static Job	*free_jobs; | ||||||
| @@ -1686,7 +1686,7 @@ new_job(void) | |||||||
| 	int	i; | 	int	i; | ||||||
| 	Job	*newj, *j; | 	Job	*newj, *j; | ||||||
|  |  | ||||||
| 	if (free_jobs != (Job *) 0) { | 	if (free_jobs != NULL) { | ||||||
| 		newj = free_jobs; | 		newj = free_jobs; | ||||||
| 		free_jobs = free_jobs->next; | 		free_jobs = free_jobs->next; | ||||||
| 	} else | 	} else | ||||||
| @@ -1696,7 +1696,7 @@ new_job(void) | |||||||
| 	for (i = 1; ; i++) { | 	for (i = 1; ; i++) { | ||||||
| 		for (j = job_list; j && j->job != i; j = j->next) | 		for (j = job_list; j && j->job != i; j = j->next) | ||||||
| 			; | 			; | ||||||
| 		if (j == (Job *) 0) | 		if (j == NULL) | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	newj->job = i; | 	newj->job = i; | ||||||
| @@ -1713,7 +1713,7 @@ new_proc(void) | |||||||
| { | { | ||||||
| 	Proc	*p; | 	Proc	*p; | ||||||
|  |  | ||||||
| 	if (free_procs != (Proc *) 0) { | 	if (free_procs != NULL) { | ||||||
| 		p = free_procs; | 		p = free_procs; | ||||||
| 		free_procs = free_procs->next; | 		free_procs = free_procs->next; | ||||||
| 	} else | 	} else | ||||||
| @@ -1735,7 +1735,7 @@ remove_job(Job *j, const char *where) | |||||||
|  |  | ||||||
| 	prev = &job_list; | 	prev = &job_list; | ||||||
| 	curr = *prev; | 	curr = *prev; | ||||||
| 	for (; curr != (Job *) 0 && curr != j; prev = &curr->next, curr = *prev) | 	for (; curr != NULL && curr != j; prev = &curr->next, curr = *prev) | ||||||
| 		; | 		; | ||||||
| 	if (curr != j) { | 	if (curr != j) { | ||||||
| 		internal_errorf(0, "remove_job: job not found (%s)", where); | 		internal_errorf(0, "remove_job: job not found (%s)", where); | ||||||
| @@ -1744,7 +1744,7 @@ remove_job(Job *j, const char *where) | |||||||
| 	*prev = curr->next; | 	*prev = curr->next; | ||||||
|  |  | ||||||
| 	/* free up proc structures */ | 	/* free up proc structures */ | ||||||
| 	for (p = j->proc_list; p != (Proc *) 0; ) { | 	for (p = j->proc_list; p != NULL; ) { | ||||||
| 		tmp = p; | 		tmp = p; | ||||||
| 		p = p->next; | 		p = p->next; | ||||||
| 		tmp->next = free_procs; | 		tmp->next = free_procs; | ||||||
| @@ -1757,9 +1757,9 @@ remove_job(Job *j, const char *where) | |||||||
| 	free_jobs = j; | 	free_jobs = j; | ||||||
|  |  | ||||||
| 	if (j == last_job) | 	if (j == last_job) | ||||||
| 		last_job = (Job *) 0; | 		last_job = NULL; | ||||||
| 	if (j == async_job) | 	if (j == async_job) | ||||||
| 		async_job = (Job *) 0; | 		async_job = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* put j in a particular location (taking it out job_list if it is there | /* put j in a particular location (taking it out job_list if it is there | ||||||
| @@ -1808,7 +1808,7 @@ kill_job(Job *j, int sig) | |||||||
| 	Proc	*p; | 	Proc	*p; | ||||||
| 	int	rval = 0; | 	int	rval = 0; | ||||||
|  |  | ||||||
| 	for (p = j->proc_list; p != (Proc *) 0; p = p->next) | 	for (p = j->proc_list; p != NULL; p = p->next) | ||||||
| 		if (p->pid != 0) | 		if (p->pid != 0) | ||||||
| 			if (kill(p->pid, sig) < 0) | 			if (kill(p->pid, sig) < 0) | ||||||
| 				rval = -1; | 				rval = -1; | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/ksh_wait.h,v 2.1 2004/12/10 18:09:41 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/ksh_wait.h,v 2.2 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: ksh_wait.h,v 1.3 1997/06/19 13:58:43 kstailey Exp $	*/ | /*	$OpenBSD: ksh_wait.h,v 1.3 1997/06/19 13:58:43 kstailey Exp $	*/ | ||||||
|  |  | ||||||
| #ifndef KSH_WAIT_H | #ifndef KSH_WAIT_H | ||||||
| @@ -49,7 +49,7 @@ typedef int WAIT_T; | |||||||
|  |  | ||||||
| #if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3) | #if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3) | ||||||
|   /* always used with p == -1 */ |   /* always used with p == -1 */ | ||||||
| # define ksh_waitpid(p, s, o)	wait3((s), (o), (struct rusage *) 0) | # define ksh_waitpid(p, s, o)	wait3((s), (o), NULL) | ||||||
| #else /* !HAVE_WAITPID && HAVE_WAIT3 */ | #else /* !HAVE_WAITPID && HAVE_WAIT3 */ | ||||||
| # define ksh_waitpid(p, s, o)	waitpid((p), (s), (o)) | # define ksh_waitpid(p, s, o)	waitpid((p), (s), (o)) | ||||||
| #endif /* !HAVE_WAITPID && HAVE_WAIT3 */ | #endif /* !HAVE_WAITPID && HAVE_WAIT3 */ | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								lex.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								lex.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/lex.c,v 2.5 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/lex.c,v 2.6 2004/12/18 19:22:29 tg Exp $ */ | ||||||
| /*	$OpenBSD: lex.c,v 1.18 2003/08/06 21:08:05 millert Exp $	*/ | /*	$OpenBSD: lex.c,v 1.18 2003/08/06 21:08:05 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "sh.h" | #include "sh.h" | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/lex.c,v 2.5 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/lex.c,v 2.6 2004/12/18 19:22:29 tg Exp $"); | ||||||
|  |  | ||||||
| /* Structure to keep track of the lexing state and the various pieces of info | /* Structure to keep track of the lexing state and the various pieces of info | ||||||
|  * needed for each particular state. |  * needed for each particular state. | ||||||
| @@ -112,7 +112,7 @@ yylex(int cf) | |||||||
|  |  | ||||||
|   Again: |   Again: | ||||||
| 	states[0].ls_state = -1; | 	states[0].ls_state = -1; | ||||||
| 	states[0].ls_info.base = (Lex_state *) 0; | 	states[0].ls_info.base = NULL; | ||||||
| 	statep = &states[1]; | 	statep = &states[1]; | ||||||
| 	state_info.base = states; | 	state_info.base = states; | ||||||
| 	state_info.end = &states[STATE_BSIZE]; | 	state_info.end = &states[STATE_BSIZE]; | ||||||
| @@ -651,9 +651,9 @@ Done: | |||||||
| 				ungetsc(c2); | 				ungetsc(c2); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		iop->name = (char *) 0; | 		iop->name = NULL; | ||||||
| 		iop->delim = (char *) 0; | 		iop->delim = NULL; | ||||||
| 		iop->heredoc = (char *) 0; | 		iop->heredoc = NULL; | ||||||
| 		Xfree(ws, wp);	/* free word */ | 		Xfree(ws, wp);	/* free word */ | ||||||
| 		yylval.iop = iop; | 		yylval.iop = iop; | ||||||
| 		return REDIR; | 		return REDIR; | ||||||
| @@ -1057,7 +1057,7 @@ getsc_line(Source *s) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if (interactive) | 	if (interactive) | ||||||
| 		set_prompt(PS2, (Source *) 0); | 		set_prompt(PS2, NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| @@ -1078,8 +1078,8 @@ set_prompt(int to, Source *s) | |||||||
| 			Area *saved_atemp; | 			Area *saved_atemp; | ||||||
|  |  | ||||||
| 			ps1 = str_val(global("PS1")); | 			ps1 = str_val(global("PS1")); | ||||||
| 			shf = shf_sopen((char *) 0, strlen(ps1) * 2, | 			shf = shf_sopen(NULL, strlen(ps1) * 2, | ||||||
| 				SHF_WR | SHF_DYNAMIC, (struct shf *) 0); | 				SHF_WR | SHF_DYNAMIC, NULL); | ||||||
| 			while (*ps1) { | 			while (*ps1) { | ||||||
| 				if (*ps1 != '!' || *++ps1 == '!') | 				if (*ps1 != '!' || *++ps1 == '!') | ||||||
| 					shf_putchar(*ps1++, shf); | 					shf_putchar(*ps1++, shf); | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								main.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/main.c,v 2.9 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/main.c,v 2.10 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $	*/ | /*	$OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * shell version |  * shell version | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/main.c,v 2.9 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/main.c,v 2.10 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| const char ksh_version[] = | const char ksh_version[] = | ||||||
| 	"@(#)PD KSH v5.2.14 MirOS R20 in " | 	"@(#)PD KSH v5.2.14 MirOS R20 in " | ||||||
| @@ -151,7 +151,7 @@ main(int argc, char *argv[]) | |||||||
| 	def_path = DEFAULT__PATH; | 	def_path = DEFAULT__PATH; | ||||||
| #if defined(HAVE_CONFSTR) && defined(_CS_PATH) | #if defined(HAVE_CONFSTR) && defined(_CS_PATH) | ||||||
| 	{ | 	{ | ||||||
| 		size_t len = confstr(_CS_PATH, (char *) 0, 0); | 		size_t len = confstr(_CS_PATH, NULL, 0); | ||||||
| 		char *new; | 		char *new; | ||||||
|  |  | ||||||
| 		if (len > 0) { | 		if (len > 0) { | ||||||
| @@ -221,7 +221,7 @@ main(int argc, char *argv[]) | |||||||
| 		    || stat(pwd, &s_pwd) < 0 || stat(".", &s_dot) < 0 | 		    || stat(pwd, &s_pwd) < 0 || stat(".", &s_dot) < 0 | ||||||
| 		    || s_pwd.st_dev != s_dot.st_dev | 		    || s_pwd.st_dev != s_dot.st_dev | ||||||
| 		    || s_pwd.st_ino != s_dot.st_ino) | 		    || s_pwd.st_ino != s_dot.st_ino) | ||||||
| 			pwdx = (char *) 0; | 			pwdx = NULL; | ||||||
| 		set_current_wd(pwdx); | 		set_current_wd(pwdx); | ||||||
| 		if (current_wd[0]) | 		if (current_wd[0]) | ||||||
| 			simplify_path(current_wd); | 			simplify_path(current_wd); | ||||||
| @@ -267,7 +267,7 @@ main(int argc, char *argv[]) | |||||||
|  |  | ||||||
| 	/* this to note if monitor is set on command line (see below) */ | 	/* this to note if monitor is set on command line (see below) */ | ||||||
| 	Flag(FMONITOR) = 127; | 	Flag(FMONITOR) = 127; | ||||||
| 	argi = parse_args(argv, OF_CMDLINE, (int *) 0); | 	argi = parse_args(argv, OF_CMDLINE, NULL); | ||||||
| 	if (argi < 0) | 	if (argi < 0) | ||||||
| 		exit(1); | 		exit(1); | ||||||
|  |  | ||||||
| @@ -291,13 +291,13 @@ main(int argc, char *argv[]) | |||||||
| 		s = pushs(SSTDIN, ATEMP); | 		s = pushs(SSTDIN, ATEMP); | ||||||
| 		s->file = "<stdin>"; | 		s->file = "<stdin>"; | ||||||
| 		s->u.shf = shf_fdopen(0, SHF_RD | can_seek(0), | 		s->u.shf = shf_fdopen(0, SHF_RD | can_seek(0), | ||||||
| 				      (struct shf *) 0); | 				      NULL); | ||||||
| 		if (isatty(0) && isatty(2)) { | 		if (isatty(0) && isatty(2)) { | ||||||
| 			Flag(FTALKING) = Flag(FTALKING_I) = 1; | 			Flag(FTALKING) = Flag(FTALKING_I) = 1; | ||||||
| 			/* The following only if isatty(0) */ | 			/* The following only if isatty(0) */ | ||||||
| 			s->flags |= SF_TTY; | 			s->flags |= SF_TTY; | ||||||
| 			s->u.shf->flags |= SHF_INTERRUPT; | 			s->u.shf->flags |= SHF_INTERRUPT; | ||||||
| 			s->file = (char *) 0; | 			s->file = NULL; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -337,14 +337,14 @@ main(int argc, char *argv[]) | |||||||
| 		warningf(FALSE, "Cannot determine current working directory"); | 		warningf(FALSE, "Cannot determine current working directory"); | ||||||
|  |  | ||||||
| 	if (Flag(FLOGIN)) { | 	if (Flag(FLOGIN)) { | ||||||
| 		include(KSH_SYSTEM_PROFILE, 0, (char **) 0, 1); | 		include(KSH_SYSTEM_PROFILE, 0, NULL, 1); | ||||||
| 		if (!Flag(FPRIVILEGED)) | 		if (!Flag(FPRIVILEGED)) | ||||||
| 			include(substitute("$HOME/.profile", 0), 0, | 			include(substitute("$HOME/.profile", 0), 0, | ||||||
| 				(char **) 0, 1); | 				NULL, 1); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (Flag(FPRIVILEGED)) | 	if (Flag(FPRIVILEGED)) | ||||||
| 		include("/etc/suid_profile", 0, (char **) 0, 1); | 		include("/etc/suid_profile", 0, NULL, 1); | ||||||
| 	else { | 	else { | ||||||
| 		char *env_file; | 		char *env_file; | ||||||
|  |  | ||||||
| @@ -358,7 +358,7 @@ main(int argc, char *argv[]) | |||||||
| #endif /* DEFAULT_ENV */ | #endif /* DEFAULT_ENV */ | ||||||
| 		env_file = substitute(env_file, DOTILDE); | 		env_file = substitute(env_file, DOTILDE); | ||||||
| 		if (*env_file != '\0') | 		if (*env_file != '\0') | ||||||
| 			include(env_file, 0, (char **) 0, 1); | 			include(env_file, 0, NULL, 1); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (is_restricted(argv[0]) || is_restricted(str_val(global("SHELL")))) | 	if (is_restricted(argv[0]) || is_restricted(str_val(global("SHELL")))) | ||||||
| @@ -367,7 +367,7 @@ main(int argc, char *argv[]) | |||||||
| 		static const char *const restr_com[] = { | 		static const char *const restr_com[] = { | ||||||
| 						"typeset", "-r", "PATH", | 						"typeset", "-r", "PATH", | ||||||
| 						    "ENV", "SHELL", | 						    "ENV", "SHELL", | ||||||
| 						(char *) 0 | 						NULL | ||||||
| 					    }; | 					    }; | ||||||
| 		shcomexec((char **) restr_com); | 		shcomexec((char **) restr_com); | ||||||
| 		/* After typeset command... */ | 		/* After typeset command... */ | ||||||
| @@ -403,7 +403,7 @@ include(const char *name, int argc, char **argv, int intr_ok) | |||||||
| 		old_argv = e->loc->argv; | 		old_argv = e->loc->argv; | ||||||
| 		old_argc = e->loc->argc; | 		old_argc = e->loc->argc; | ||||||
| 	} else { | 	} else { | ||||||
| 		old_argv = (char **) 0; | 		old_argv = NULL; | ||||||
| 		old_argc = 0; | 		old_argc = 0; | ||||||
| 	} | 	} | ||||||
| 	newenv(E_INCL); | 	newenv(E_INCL); | ||||||
| @@ -698,10 +698,10 @@ cleanup_parents_env(void) | |||||||
| 				if (ep->savefd[fd] > 0) | 				if (ep->savefd[fd] > 0) | ||||||
| 					close(ep->savefd[fd]); | 					close(ep->savefd[fd]); | ||||||
| 			afree(ep->savefd, &ep->area); | 			afree(ep->savefd, &ep->area); | ||||||
| 			ep->savefd = (short *) 0; | 			ep->savefd = NULL; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	e->oenv = (struct env *) 0; | 	e->oenv = NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Called just before an execve cleanup stuff temporary files */ | /* Called just before an execve cleanup stuff temporary files */ | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								misc.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								misc.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/misc.c,v 2.5 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/misc.c,v 2.6 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $	*/ | /*	$OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -13,7 +13,7 @@ | |||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/misc.c,v 2.5 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/misc.c,v 2.6 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| #ifndef UCHAR_MAX | #ifndef UCHAR_MAX | ||||||
| # define UCHAR_MAX	0xFF | # define UCHAR_MAX	0xFF | ||||||
| @@ -132,7 +132,7 @@ const struct option options[] = { | |||||||
| 	{ "braceexpand",  0,		OF_ANY }, /* non-standard */ | 	{ "braceexpand",  0,		OF_ANY }, /* non-standard */ | ||||||
| #endif | #endif | ||||||
| 	{ "bgnice",	  0,		OF_ANY }, | 	{ "bgnice",	  0,		OF_ANY }, | ||||||
| 	{ (char *) 0, 	'c',	    OF_CMDLINE }, | 	{ NULL, 	'c',	    OF_CMDLINE }, | ||||||
| 	{ "emacs",	  0,		OF_ANY }, | 	{ "emacs",	  0,		OF_ANY }, | ||||||
| 	{ "emacs-usemeta",  0,		OF_ANY }, /* non-standard */ | 	{ "emacs-usemeta",  0,		OF_ANY }, /* non-standard */ | ||||||
| 	{ "errexit",	'e',		OF_ANY }, | 	{ "errexit",	'e',		OF_ANY }, | ||||||
| @@ -145,7 +145,7 @@ const struct option options[] = { | |||||||
| #ifdef JOBS | #ifdef JOBS | ||||||
| 	{ "monitor",	'm',		OF_ANY }, | 	{ "monitor",	'm',		OF_ANY }, | ||||||
| #else /* JOBS */ | #else /* JOBS */ | ||||||
| 	{ (char *) 0,	'm',		     0 }, /* so FMONITOR not ifdef'd */ | 	{ NULL,	'm',		     0 }, /* so FMONITOR not ifdef'd */ | ||||||
| #endif /* JOBS */ | #endif /* JOBS */ | ||||||
| 	{ "noclobber",	'C',		OF_ANY }, | 	{ "noclobber",	'C',		OF_ANY }, | ||||||
| 	{ "noexec",	'n',		OF_ANY }, | 	{ "noexec",	'n',		OF_ANY }, | ||||||
| @@ -173,7 +173,7 @@ const struct option options[] = { | |||||||
| 	/* Anonymous flags: used internally by shell only | 	/* Anonymous flags: used internally by shell only | ||||||
| 	 * (not visible to user) | 	 * (not visible to user) | ||||||
| 	 */ | 	 */ | ||||||
| 	{ (char *) 0,	0,		OF_INTERNAL }, /* FTALKING_I */ | 	{ NULL,	0,		OF_INTERNAL }, /* FTALKING_I */ | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -316,7 +316,7 @@ parse_args(char **argv, int what, int *setargsp) | |||||||
| 	static char cmd_opts[NELEM(options) + 5]; /* o:T:\0 */ | 	static char cmd_opts[NELEM(options) + 5]; /* o:T:\0 */ | ||||||
| 	static char set_opts[NELEM(options) + 5]; /* Ao;s\0 */ | 	static char set_opts[NELEM(options) + 5]; /* Ao;s\0 */ | ||||||
| 	char *opts; | 	char *opts; | ||||||
| 	char *array = (char *) 0; | 	char *array = NULL; | ||||||
| 	Getopt go; | 	Getopt go; | ||||||
| 	int i, optc, set, sortargs = 0, arrayset = 0; | 	int i, optc, set, sortargs = 0, arrayset = 0; | ||||||
| 	unsigned u; | 	unsigned u; | ||||||
| @@ -378,7 +378,7 @@ parse_args(char **argv, int what, int *setargsp) | |||||||
| 		  case 'o': | 		  case 'o': | ||||||
| 			if (what == OF_FIRSTTIME) | 			if (what == OF_FIRSTTIME) | ||||||
| 				break; | 				break; | ||||||
| 			if (go.optarg == (char *) 0) { | 			if (go.optarg == NULL) { | ||||||
| 				/* lone -o: print options | 				/* lone -o: print options | ||||||
| 				 * | 				 * | ||||||
| 				 * Note that on the command line, -o requires | 				 * Note that on the command line, -o requires | ||||||
| @@ -785,7 +785,7 @@ pat_scan(const unsigned char *p, const unsigned char *pe, int match_sep) | |||||||
| 		if ((*p & 0x80) && strchr("*+?@! ", *p & 0x7f)) | 		if ((*p & 0x80) && strchr("*+?@! ", *p & 0x7f)) | ||||||
| 			nest++; | 			nest++; | ||||||
| 	} | 	} | ||||||
| 	return (const unsigned char *) 0; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -892,7 +892,7 @@ void | |||||||
| ksh_getopt_reset(Getopt *go, int flags) | ksh_getopt_reset(Getopt *go, int flags) | ||||||
| { | { | ||||||
| 	go->optind = 1; | 	go->optind = 1; | ||||||
| 	go->optarg = (char *) 0; | 	go->optarg = NULL; | ||||||
| 	go->p = 0; | 	go->p = 0; | ||||||
| 	go->flags = flags; | 	go->flags = flags; | ||||||
| 	go->info = 0; | 	go->info = 0; | ||||||
| @@ -940,7 +940,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options) | |||||||
| 			go->info |= GI_MINUSMINUS; | 			go->info |= GI_MINUSMINUS; | ||||||
| 			return EOF; | 			return EOF; | ||||||
| 		} | 		} | ||||||
| 		if (arg == (char *) 0 | 		if (arg == NULL | ||||||
| 		    || ((flag != '-' ) /* neither a - nor a + (if + allowed) */ | 		    || ((flag != '-' ) /* neither a - nor a + (if + allowed) */ | ||||||
| 			&& (!(go->flags & GF_PLUSOPT) || flag != '+')) | 			&& (!(go->flags & GF_PLUSOPT) || flag != '+')) | ||||||
| 		    || (c = arg[1]) == '\0') | 		    || (c = arg[1]) == '\0') | ||||||
| @@ -979,7 +979,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options) | |||||||
| 		else if (argv[go->optind]) | 		else if (argv[go->optind]) | ||||||
| 			go->optarg = argv[go->optind++]; | 			go->optarg = argv[go->optind++]; | ||||||
| 		else if (*o == ';') | 		else if (*o == ';') | ||||||
| 			go->optarg = (char *) 0; | 			go->optarg = NULL; | ||||||
| 		else { | 		else { | ||||||
| 			if (options[0] == ':') { | 			if (options[0] == ':') { | ||||||
| 				go->buf[0] = c; | 				go->buf[0] = c; | ||||||
| @@ -1008,13 +1008,13 @@ ksh_getopt(char **argv, Getopt *go, const char *options) | |||||||
| 				go->optarg = argv[go->optind - 1] + go->p; | 				go->optarg = argv[go->optind - 1] + go->p; | ||||||
| 				go->p = 0; | 				go->p = 0; | ||||||
| 			} else | 			} else | ||||||
| 				go->optarg = (char *) 0; | 				go->optarg = NULL; | ||||||
| 		} else { | 		} else { | ||||||
| 			if (argv[go->optind] && digit(argv[go->optind][0])) { | 			if (argv[go->optind] && digit(argv[go->optind][0])) { | ||||||
| 				go->optarg = argv[go->optind++]; | 				go->optarg = argv[go->optind++]; | ||||||
| 				go->p = 0; | 				go->p = 0; | ||||||
| 			} else | 			} else | ||||||
| 				go->optarg = (char *) 0; | 				go->optarg = NULL; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return c; | 	return c; | ||||||
| @@ -1225,7 +1225,7 @@ reset_nonblock(int fd) | |||||||
| 	{ \ | 	{ \ | ||||||
| 	    DIR *d = ksh_opendir("."); \ | 	    DIR *d = ksh_opendir("."); \ | ||||||
| 	    if (!d) \ | 	    if (!d) \ | ||||||
| 		return (char *) 0; \ | 		return NULL; \ | ||||||
| 	    closedir(d); \ | 	    closedir(d); \ | ||||||
| 	} | 	} | ||||||
| #else /* HPUX_GETWD_BUG */ | #else /* HPUX_GETWD_BUG */ | ||||||
| @@ -1276,7 +1276,7 @@ ksh_get_wd(char *buf, int bsize) | |||||||
| 		errno = EACCES; | 		errno = EACCES; | ||||||
| 		if (b != buf) | 		if (b != buf) | ||||||
| 			afree(b, ATEMP); | 			afree(b, ATEMP); | ||||||
| 		return (char *) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	len = strlen(b) + 1; | 	len = strlen(b) + 1; | ||||||
| 	if (!buf) | 	if (!buf) | ||||||
| @@ -1284,7 +1284,7 @@ ksh_get_wd(char *buf, int bsize) | |||||||
| 	else if (buf != b) { | 	else if (buf != b) { | ||||||
| 		if (len > bsize) { | 		if (len > bsize) { | ||||||
| 			errno = ERANGE; | 			errno = ERANGE; | ||||||
| 			return (char *) 0; | 			return NULL; | ||||||
| 		} | 		} | ||||||
| 		memcpy(buf, b, len); | 		memcpy(buf, b, len); | ||||||
| 		afree(b, ATEMP); | 		afree(b, ATEMP); | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								missing.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								missing.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/missing.c,v 2.3 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/missing.c,v 2.4 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: missing.c,v 1.5 2003/05/16 18:49:46 jsyn Exp $	*/ | /*	$OpenBSD: missing.c,v 1.5 2003/05/16 18:49:46 jsyn Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -9,7 +9,7 @@ | |||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
| #include "ksh_dir.h" | #include "ksh_dir.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/missing.c,v 2.3 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/missing.c,v 2.4 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| #ifndef HAVE_MEMSET | #ifndef HAVE_MEMSET | ||||||
| void * | void * | ||||||
| @@ -222,7 +222,7 @@ ksh_times(tms) | |||||||
| 		tms->tms_cstime = ru.ru_stime.tv_sec * CLK_TCK | 		tms->tms_cstime = ru.ru_stime.tv_sec * CLK_TCK | ||||||
| 			+ ru.ru_stime.tv_usec * CLK_TCK / 1000000; | 			+ ru.ru_stime.tv_usec * CLK_TCK / 1000000; | ||||||
|  |  | ||||||
| 		gettimeofday(&tv, (struct timezone *) 0); | 		gettimeofday(&tv, NULL); | ||||||
| 		if (base_sec == 0) | 		if (base_sec == 0) | ||||||
| 			base_sec = tv.tv_sec; | 			base_sec = tv.tv_sec; | ||||||
| 		rv = (tv.tv_sec - base_sec) * CLK_TCK; | 		rv = (tv.tv_sec - base_sec) * CLK_TCK; | ||||||
| @@ -259,10 +259,10 @@ ksh_opendir(d) | |||||||
| 	struct stat statb; | 	struct stat statb; | ||||||
|  |  | ||||||
| 	if (stat(d, &statb) != 0) | 	if (stat(d, &statb) != 0) | ||||||
| 		return (DIR *) 0; | 		return NULL; | ||||||
| 	if (!S_ISDIR(statb.st_mode)) { | 	if (!S_ISDIR(statb.st_mode)) { | ||||||
| 		errno = ENOTDIR; | 		errno = ENOTDIR; | ||||||
| 		return (DIR *) 0; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	return opendir(d); | 	return opendir(d); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								path.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								path.c
									
									
									
									
									
								
							| @@ -1,10 +1,10 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/path.c,v 2.2 2004/12/13 19:05:09 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/path.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: path.c,v 1.9 2003/10/22 07:40:38 jmc Exp $	*/ | /*	$OpenBSD: path.c,v 1.9 2003/10/22 07:40:38 jmc Exp $	*/ | ||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/path.c,v 2.2 2004/12/13 19:05:09 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/path.c,v 2.3 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  *	Contains a routine to search a : separated list of |  *	Contains a routine to search a : separated list of | ||||||
| @@ -74,7 +74,7 @@ make_path(const char *cwd, const char *file, char **cdpathp, XString *xsp, int * | |||||||
| 			for (pend = plist; *pend && *pend != PATHSEP; pend++) | 			for (pend = plist; *pend && *pend != PATHSEP; pend++) | ||||||
| 				; | 				; | ||||||
| 			plen = pend - plist; | 			plen = pend - plist; | ||||||
| 			*cdpathp = *pend ? ++pend : (char *) 0; | 			*cdpathp = *pend ? ++pend : NULL; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ((use_cdpath == 0 || !plen || ISRELPATH(plist)) | 		if ((use_cdpath == 0 || !plen || ISRELPATH(plist)) | ||||||
| @@ -103,7 +103,7 @@ make_path(const char *cwd, const char *file, char **cdpathp, XString *xsp, int * | |||||||
| 	memcpy(xp, file, len); | 	memcpy(xp, file, len); | ||||||
|  |  | ||||||
| 	if (!use_cdpath) | 	if (!use_cdpath) | ||||||
| 		*cdpathp = (char *) 0; | 		*cdpathp = NULL; | ||||||
|  |  | ||||||
| 	return rval; | 	return rval; | ||||||
| } | } | ||||||
| @@ -200,7 +200,7 @@ set_current_wd(char *path) | |||||||
| 	int len; | 	int len; | ||||||
| 	char *p = path; | 	char *p = path; | ||||||
|  |  | ||||||
| 	if (!p && !(p = ksh_get_wd((char *) 0, 0))) | 	if (!p && !(p = ksh_get_wd(NULL, 0))) | ||||||
| 		p = null; | 		p = null; | ||||||
|  |  | ||||||
| 	len = strlen(p) + 1; | 	len = strlen(p) + 1; | ||||||
| @@ -224,7 +224,7 @@ get_phys_path(const char *path) | |||||||
| 	xp = do_phys_path(&xs, xp, path); | 	xp = do_phys_path(&xs, xp, path); | ||||||
|  |  | ||||||
| 	if (!xp) | 	if (!xp) | ||||||
| 		return (char *) 0; | 		return NULL; | ||||||
|  |  | ||||||
| 	if (Xlength(xs, xp) == 0) | 	if (Xlength(xs, xp) == 0) | ||||||
| 		Xput(xs, xp, DIRSEP); | 		Xput(xs, xp, DIRSEP); | ||||||
| @@ -270,7 +270,7 @@ do_phys_path(XString *xsp, char *xp, const char *path) | |||||||
| 		if (llen < 0) { | 		if (llen < 0) { | ||||||
| 			/* EINVAL means it wasn't a symlink... */ | 			/* EINVAL means it wasn't a symlink... */ | ||||||
| 			if (errno != EINVAL) | 			if (errno != EINVAL) | ||||||
| 				return (char *) 0; | 				return NULL; | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		lbuf[llen] = '\0'; | 		lbuf[llen] = '\0'; | ||||||
| @@ -279,7 +279,7 @@ do_phys_path(XString *xsp, char *xp, const char *path) | |||||||
| 		xp = ISABSPATH(lbuf) ? Xstring(*xsp, xp) | 		xp = ISABSPATH(lbuf) ? Xstring(*xsp, xp) | ||||||
| 				     : Xrestpos(*xsp, xp, savepos); | 				     : Xrestpos(*xsp, xp, savepos); | ||||||
| 		if (!(xp = do_phys_path(xsp, xp, lbuf))) | 		if (!(xp = do_phys_path(xsp, xp, lbuf))) | ||||||
| 			return (char *) 0; | 			return NULL; | ||||||
| 	} | 	} | ||||||
| 	return xp; | 	return xp; | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								shf.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								shf.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/shf.c,v 2.2 2004/12/13 19:05:09 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/shf.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: shf.c,v 1.8 2003/02/28 09:45:09 jmc Exp $	*/ | /*	$OpenBSD: shf.c,v 1.8 2003/02/28 09:45:09 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -9,7 +9,7 @@ | |||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
| #include "ksh_limval.h" | #include "ksh_limval.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/shf.c,v 2.2 2004/12/13 19:05:09 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/shf.c,v 2.3 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| /* flags to shf_emptybuf() */ | /* flags to shf_emptybuf() */ | ||||||
| #define EB_READSW	0x01	/* about to switch to reading */ | #define EB_READSW	0x01	/* about to switch to reading */ | ||||||
| @@ -96,7 +96,7 @@ shf_fdopen(int fd, int sflags, struct shf *shf) | |||||||
| 			shf->buf = (unsigned char *) alloc(bsize, ATEMP); | 			shf->buf = (unsigned char *) alloc(bsize, ATEMP); | ||||||
| 			sflags |= SHF_ALLOCB; | 			sflags |= SHF_ALLOCB; | ||||||
| 		} else | 		} else | ||||||
| 			shf->buf = (unsigned char *) 0; | 			shf->buf = NULL; | ||||||
| 	} else { | 	} else { | ||||||
| 		shf = (struct shf *) alloc(sizeof(struct shf) + bsize, ATEMP); | 		shf = (struct shf *) alloc(sizeof(struct shf) + bsize, ATEMP); | ||||||
| 		shf->buf = (unsigned char *) &shf[1]; | 		shf->buf = (unsigned char *) &shf[1]; | ||||||
| @@ -520,7 +520,7 @@ shf_getse(char *buf, int bsize, struct shf *shf) | |||||||
| 		internal_errorf(1, "shf_getse: flags %x", shf->flags); | 		internal_errorf(1, "shf_getse: flags %x", shf->flags); | ||||||
|  |  | ||||||
| 	if (bsize <= 0) | 	if (bsize <= 0) | ||||||
| 		return (char *) 0; | 		return NULL; | ||||||
|  |  | ||||||
| 	--bsize;	/* save room for null */ | 	--bsize;	/* save room for null */ | ||||||
| 	do { | 	do { | ||||||
| @@ -749,7 +749,7 @@ shf_smprintf(const char *fmt, ...) | |||||||
| 	struct shf shf; | 	struct shf shf; | ||||||
| 	va_list args; | 	va_list args; | ||||||
|  |  | ||||||
| 	shf_sopen((char *) 0, 0, SHF_WR|SHF_DYNAMIC, &shf); | 	shf_sopen(NULL, 0, SHF_WR|SHF_DYNAMIC, &shf); | ||||||
| 	SH_VA_START(args, fmt); | 	SH_VA_START(args, fmt); | ||||||
| 	shf_vfprintf(&shf, fmt, args); | 	shf_vfprintf(&shf, fmt, args); | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| # $MirBSD: src/bin/ksh/siglist.sh,v 2.1 2004/12/10 18:09:42 tg Exp $ | # $MirBSD: src/bin/ksh/siglist.sh,v 2.2 2004/12/18 19:22:30 tg Exp $ | ||||||
| # $OpenBSD: siglist.sh,v 1.4 1997/06/19 13:58:47 kstailey Exp $ | # $OpenBSD: siglist.sh,v 1.4 1997/06/19 13:58:47 kstailey Exp $ | ||||||
| # | # | ||||||
| # Script to generate a sorted, complete list of signals, suitable | # Script to generate a sorted, complete list of signals, suitable | ||||||
| @@ -31,7 +31,7 @@ sed -n 's/{ QwErTy/{/p' < $out | awk '{print NR, $0}' | sort +2n +0n | | |||||||
| 		n = $2; | 		n = $2; | ||||||
| 		if (n > 0 && n != last) { | 		if (n > 0 && n != last) { | ||||||
| 		    while (++last < n) { | 		    while (++last < n) { | ||||||
| 			printf "\t{ %d , (char *) 0, `Signal %d` } ,\n", last, last; | 			printf "\t{ %d , NULL, `Signal %d` } ,\n", last, last; | ||||||
| 		    } | 		    } | ||||||
| 		    print; | 		    print; | ||||||
| 		} | 		} | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								syn.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								syn.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/syn.c,v 2.3 2004/12/18 18:58:30 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/syn.c,v 2.4 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $	*/ | /*	$OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "sh.h" | #include "sh.h" | ||||||
| #include "c_test.h" | #include "c_test.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/syn.c,v 2.3 2004/12/18 18:58:30 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/syn.c,v 2.4 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| struct nesting_state { | struct nesting_state { | ||||||
| 	int	start_token;	/* token than began nesting (eg, FOR) */ | 	int	start_token;	/* token than began nesting (eg, FOR) */ | ||||||
| @@ -72,7 +72,7 @@ yyparse(void) | |||||||
| 	if (c == 0 && !outtree) | 	if (c == 0 && !outtree) | ||||||
| 		outtree = newtp(TEOF); | 		outtree = newtp(TEOF); | ||||||
| 	else if (c != '\n' && c != 0) | 	else if (c != '\n' && c != 0) | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| static struct op * | static struct op * | ||||||
| @@ -84,7 +84,7 @@ pipeline(int cf) | |||||||
| 	if (t != NULL) { | 	if (t != NULL) { | ||||||
| 		while (token(0) == '|') { | 		while (token(0) == '|') { | ||||||
| 			if ((p = get_command(CONTIN)) == NULL) | 			if ((p = get_command(CONTIN)) == NULL) | ||||||
| 				syntaxerr((char *) 0); | 				syntaxerr(NULL); | ||||||
| 			if (tl == NULL) | 			if (tl == NULL) | ||||||
| 				t = tl = block(TPIPE, t, p, NOWORDS); | 				t = tl = block(TPIPE, t, p, NOWORDS); | ||||||
| 			else | 			else | ||||||
| @@ -105,7 +105,7 @@ andor(void) | |||||||
| 	if (t != NULL) { | 	if (t != NULL) { | ||||||
| 		while ((c = token(0)) == LOGAND || c == LOGOR) { | 		while ((c = token(0)) == LOGAND || c == LOGOR) { | ||||||
| 			if ((p = pipeline(CONTIN)) == NULL) | 			if ((p = pipeline(CONTIN)) == NULL) | ||||||
| 				syntaxerr((char *) 0); | 				syntaxerr(NULL); | ||||||
| 			t = block(c == LOGAND? TAND: TOR, t, p, NOWORDS); | 			t = block(c == LOGAND? TAND: TOR, t, p, NOWORDS); | ||||||
| 		} | 		} | ||||||
| 		REJECT; | 		REJECT; | ||||||
| @@ -178,7 +178,7 @@ static void | |||||||
| musthave(int c, int cf) | musthave(int c, int cf) | ||||||
| { | { | ||||||
| 	if ((token(cf)) != c) | 	if ((token(cf)) != c) | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| static struct op * | static struct op * | ||||||
| @@ -261,7 +261,7 @@ get_command(int cf) | |||||||
| 				/* Must be a function */ | 				/* Must be a function */ | ||||||
| 				if (iopn != 0 || XPsize(args) != 1 | 				if (iopn != 0 || XPsize(args) != 1 | ||||||
| 				    || XPsize(vars) != 0) | 				    || XPsize(vars) != 0) | ||||||
| 					syntaxerr((char *) 0); | 					syntaxerr(NULL); | ||||||
| 				ACCEPT; | 				ACCEPT; | ||||||
| 				/*(*/ | 				/*(*/ | ||||||
| 				musthave(')', 0); | 				musthave(')', 0); | ||||||
| @@ -360,8 +360,8 @@ get_command(int cf) | |||||||
| 	  case BANG: | 	  case BANG: | ||||||
| 		syniocf &= ~(KEYWORD|ALIAS); | 		syniocf &= ~(KEYWORD|ALIAS); | ||||||
| 		t = pipeline(0); | 		t = pipeline(0); | ||||||
| 		if (t == (struct op *) 0) | 		if (t == NULL) | ||||||
| 			syntaxerr((char *) 0); | 			syntaxerr(NULL); | ||||||
| 		t = block(TBANG, NOBLOCK, t, NOWORDS); | 		t = block(TBANG, NOBLOCK, t, NOWORDS); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| @@ -423,7 +423,7 @@ dogroup(void) | |||||||
| 	else if (c == '{') | 	else if (c == '{') | ||||||
| 		c = '}'; | 		c = '}'; | ||||||
| 	else | 	else | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| 	list = c_list(TRUE); | 	list = c_list(TRUE); | ||||||
| 	musthave(c, KEYWORD|ALIAS); | 	musthave(c, KEYWORD|ALIAS); | ||||||
| 	return list; | 	return list; | ||||||
| @@ -438,7 +438,7 @@ thenpart(void) | |||||||
| 	t = newtp(0); | 	t = newtp(0); | ||||||
| 	t->left = c_list(TRUE); | 	t->left = c_list(TRUE); | ||||||
| 	if (t->left == NULL) | 	if (t->left == NULL) | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| 	t->right = elsepart(); | 	t->right = elsepart(); | ||||||
| 	return (t); | 	return (t); | ||||||
| } | } | ||||||
| @@ -451,7 +451,7 @@ elsepart(void) | |||||||
| 	switch (token(KEYWORD|ALIAS|VARASN)) { | 	switch (token(KEYWORD|ALIAS|VARASN)) { | ||||||
| 	  case ELSE: | 	  case ELSE: | ||||||
| 		if ((t = c_list(TRUE)) == NULL) | 		if ((t = c_list(TRUE)) == NULL) | ||||||
| 			syntaxerr((char *) 0); | 			syntaxerr(NULL); | ||||||
| 		return (t); | 		return (t); | ||||||
|  |  | ||||||
| 	  case ELIF: | 	  case ELIF: | ||||||
| @@ -479,7 +479,7 @@ caselist(void) | |||||||
| 	else if (c == '{') | 	else if (c == '{') | ||||||
| 		c = '}'; | 		c = '}'; | ||||||
| 	else | 	else | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| 	t = tl = NULL; | 	t = tl = NULL; | ||||||
| 	while ((tpeek(CONTIN|KEYWORD|ESACONLY)) != c) { /* no ALIAS here */ | 	while ((tpeek(CONTIN|KEYWORD|ESACONLY)) != c) { /* no ALIAS here */ | ||||||
| 		struct op *tc = casepart(c); | 		struct op *tc = casepart(c); | ||||||
| @@ -557,7 +557,7 @@ function_body(char *name, int ksh_func) | |||||||
|  |  | ||||||
| 	old_func_parse = e->flags & EF_FUNC_PARSE; | 	old_func_parse = e->flags & EF_FUNC_PARSE; | ||||||
| 	e->flags |= EF_FUNC_PARSE; | 	e->flags |= EF_FUNC_PARSE; | ||||||
| 	if ((t->left = get_command(CONTIN)) == (struct op *) 0) { | 	if ((t->left = get_command(CONTIN)) == NULL) { | ||||||
| 		/* | 		/* | ||||||
| 		 * Probably something like foo() followed by eof or ;. | 		 * Probably something like foo() followed by eof or ;. | ||||||
| 		 * This is accepted by sh and ksh88. | 		 * This is accepted by sh and ksh88. | ||||||
| @@ -570,9 +570,9 @@ function_body(char *name, int ksh_func) | |||||||
| 		t->left->args[0][0] = CHAR; | 		t->left->args[0][0] = CHAR; | ||||||
| 		t->left->args[0][1] = ':'; | 		t->left->args[0][1] = ':'; | ||||||
| 		t->left->args[0][2] = EOS; | 		t->left->args[0][2] = EOS; | ||||||
| 		t->left->args[1] = (char *) 0; | 		t->left->args[1] = NULL; | ||||||
| 		t->left->vars = (char **) alloc(sizeof(char *), ATEMP); | 		t->left->vars = (char **) alloc(sizeof(char *), ATEMP); | ||||||
| 		t->left->vars[0] = (char *) 0; | 		t->left->vars[0] = NULL; | ||||||
| 		t->left->lineno = 1; | 		t->left->lineno = 1; | ||||||
| 	} | 	} | ||||||
| 	if (!old_func_parse) | 	if (!old_func_parse) | ||||||
| @@ -597,7 +597,7 @@ wordlist(void) | |||||||
| 	while ((c = token(0)) == LWORD) | 	while ((c = token(0)) == LWORD) | ||||||
| 		XPput(args, yylval.cp); | 		XPput(args, yylval.cp); | ||||||
| 	if (c != '\n' && c != ';') | 	if (c != '\n' && c != ';') | ||||||
| 		syntaxerr((char *) 0); | 		syntaxerr(NULL); | ||||||
| 	if (XPsize(args) == 0) { | 	if (XPsize(args) == 0) { | ||||||
| 		XPfree(args); | 		XPfree(args); | ||||||
| 		return NULL; | 		return NULL; | ||||||
| @@ -703,7 +703,7 @@ syntaxerr(const char *what) | |||||||
| 		/*NOTREACHED*/ | 		/*NOTREACHED*/ | ||||||
|  |  | ||||||
| 	case LWORD: | 	case LWORD: | ||||||
| 		s = snptreef((char *) 0, 32, "%S", yylval.cp); | 		s = snptreef(NULL, 32, "%S", yylval.cp); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case REDIR: | 	case REDIR: | ||||||
| @@ -830,7 +830,7 @@ dbtestp_isa(Test_env *te, Test_meta meta) | |||||||
| { | { | ||||||
| 	int c = tpeek(ARRAYVAR | (meta == TM_BINOP ? 0 : CONTIN)); | 	int c = tpeek(ARRAYVAR | (meta == TM_BINOP ? 0 : CONTIN)); | ||||||
| 	int uqword = 0; | 	int uqword = 0; | ||||||
| 	char *save = (char *) 0; | 	char *save = NULL; | ||||||
| 	int ret = 0; | 	int ret = 0; | ||||||
|  |  | ||||||
| 	/* unquoted word? */ | 	/* unquoted word? */ | ||||||
| @@ -876,7 +876,7 @@ dbtestp_getopnd(Test_env *te, Test_op op GCC_FUNC_ATTR(unused), | |||||||
| 	int c = tpeek(ARRAYVAR); | 	int c = tpeek(ARRAYVAR); | ||||||
|  |  | ||||||
| 	if (c != LWORD) | 	if (c != LWORD) | ||||||
| 		return (const char *) 0; | 		return NULL; | ||||||
|  |  | ||||||
| 	ACCEPT; | 	ACCEPT; | ||||||
| 	XPput(*te->pos.av, yylval.cp); | 	XPput(*te->pos.av, yylval.cp); | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								table.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								table.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/table.c,v 2.1 2004/12/10 18:09:42 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/table.c,v 2.2 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: table.c,v 1.5 1999/01/10 17:55:03 millert Exp $	*/ | /*	$OpenBSD: table.c,v 1.5 1999/01/10 17:55:03 millert Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/table.c,v 2.1 2004/12/10 18:09:42 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/table.c,v 2.2 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| #define	INIT_TBLS	8	/* initial table size (power of 2) */ | #define	INIT_TBLS	8	/* initial table size (power of 2) */ | ||||||
|  |  | ||||||
| @@ -124,7 +124,7 @@ tenter(struct table *tp, const char *n, unsigned int h) | |||||||
| 	p->type = 0; | 	p->type = 0; | ||||||
| 	p->areap = tp->areap; | 	p->areap = tp->areap; | ||||||
| 	p->u2.field = 0; | 	p->u2.field = 0; | ||||||
| 	p->u.array = (struct tbl *)0; | 	p->u.array = NULL; | ||||||
| 	memcpy(p->name, n, len); | 	memcpy(p->name, n, len); | ||||||
|  |  | ||||||
| 	/* enter in tp->tbls */ | 	/* enter in tp->tbls */ | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								trap.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								trap.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/trap.c,v 2.2 2004/12/18 18:58:31 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/trap.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: trap.c,v 1.13 2003/02/28 09:45:09 jmc Exp $	*/ | /*	$OpenBSD: trap.c,v 1.13 2003/02/28 09:45:09 jmc Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -9,7 +9,7 @@ | |||||||
| #define FROM_TRAP_C | #define FROM_TRAP_C | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/trap.c,v 2.2 2004/12/18 18:58:31 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/trap.c,v 2.3 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| /* Table is indexed by signal number | /* Table is indexed by signal number | ||||||
|  * |  * | ||||||
| @@ -137,7 +137,7 @@ trapsig(int i) | |||||||
| 		(*p->shtrap)(i); | 		(*p->shtrap)(i); | ||||||
| #ifdef V7_SIGNALS | #ifdef V7_SIGNALS | ||||||
| 	if (sigtraps[i].cursig == trapsig) /* this for SIGCHLD,SIGALRM */ | 	if (sigtraps[i].cursig == trapsig) /* this for SIGCHLD,SIGALRM */ | ||||||
| 		sigaction(i, &Sigact_trap, (struct sigaction *) 0); | 		sigaction(i, &Sigact_trap, NULL); | ||||||
| #endif /* V7_SIGNALS */ | #endif /* V7_SIGNALS */ | ||||||
| 	errno = errno_; | 	errno = errno_; | ||||||
| 	return RETSIGVAL; | 	return RETSIGVAL; | ||||||
| @@ -215,7 +215,7 @@ runtraps(int flag) | |||||||
| 		fatal_trap = 0; | 		fatal_trap = 0; | ||||||
| 	for (p = sigtraps, i = SIGNALS+1; --i >= 0; p++) | 	for (p = sigtraps, i = SIGNALS+1; --i >= 0; p++) | ||||||
| 		if (p->set && (!flag | 		if (p->set && (!flag | ||||||
| 			       || ((p->flags & flag) && p->trap == (char *) 0))) | 			       || ((p->flags & flag) && p->trap == NULL))) | ||||||
| 			runtrap(p); | 			runtrap(p); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -228,7 +228,7 @@ runtrap(Trap *p) | |||||||
| 	int	UNINITIALIZED(old_changed); | 	int	UNINITIALIZED(old_changed); | ||||||
|  |  | ||||||
| 	p->set = 0; | 	p->set = 0; | ||||||
| 	if (trapstr == (char *) 0) { /* SIG_DFL */ | 	if (trapstr == NULL) { /* SIG_DFL */ | ||||||
| 		if (p->flags & TF_FATAL) { | 		if (p->flags & TF_FATAL) { | ||||||
| 			/* eg, SIGHUP */ | 			/* eg, SIGHUP */ | ||||||
| 			exstat = 128 + i; | 			exstat = 128 + i; | ||||||
| @@ -246,7 +246,7 @@ runtrap(Trap *p) | |||||||
| 	if (i == SIGEXIT_ || i == SIGERR_) {	/* avoid recursion on these */ | 	if (i == SIGEXIT_ || i == SIGERR_) {	/* avoid recursion on these */ | ||||||
| 		old_changed = p->flags & TF_CHANGED; | 		old_changed = p->flags & TF_CHANGED; | ||||||
| 		p->flags &= ~TF_CHANGED; | 		p->flags &= ~TF_CHANGED; | ||||||
| 		p->trap = (char *) 0; | 		p->trap = NULL; | ||||||
| 	} | 	} | ||||||
| 	oexstat = exstat; | 	oexstat = exstat; | ||||||
| 	/* Note: trapstr is fully parsed before anything is executed, thus | 	/* Note: trapstr is fully parsed before anything is executed, thus | ||||||
| @@ -277,7 +277,7 @@ cleartraps(void) | |||||||
| 	for (i = SIGNALS+1, p = sigtraps; --i >= 0; p++) { | 	for (i = SIGNALS+1, p = sigtraps; --i >= 0; p++) { | ||||||
| 		p->set = 0; | 		p->set = 0; | ||||||
| 		if ((p->flags & TF_USER_SET) && (p->trap && p->trap[0])) | 		if ((p->flags & TF_USER_SET) && (p->trap && p->trap[0])) | ||||||
| 			settrap(p, (char *) 0); | 			settrap(p, NULL); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -403,7 +403,7 @@ setsig(Trap *p, handler_t f, int flags) | |||||||
| 		sigemptyset(&sigact.sa_mask); | 		sigemptyset(&sigact.sa_mask); | ||||||
| 		sigact.sa_flags = KSH_SA_FLAGS; | 		sigact.sa_flags = KSH_SA_FLAGS; | ||||||
| 		sigact.sa_handler = f; | 		sigact.sa_handler = f; | ||||||
| 		sigaction(p->signal, &sigact, (struct sigaction *) 0); | 		sigaction(p->signal, &sigact, NULL); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return 1; | 	return 1; | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								tree.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								tree.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/tree.c,v 2.2 2004/12/18 18:58:32 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/tree.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $	*/ | /*	$OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/tree.c,v 2.2 2004/12/18 18:58:32 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/tree.c,v 2.3 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| #define INDENT	4 | #define INDENT	4 | ||||||
|  |  | ||||||
| @@ -553,7 +553,7 @@ wdstrip(const char *wp) | |||||||
| 	struct shf shf; | 	struct shf shf; | ||||||
| 	int c; | 	int c; | ||||||
|  |  | ||||||
| 	shf_sopen((char *) 0, 32, SHF_WR | SHF_DYNAMIC, &shf); | 	shf_sopen(NULL, 32, SHF_WR | SHF_DYNAMIC, &shf); | ||||||
|  |  | ||||||
| 	/* problems: | 	/* problems: | ||||||
| 	 *	`...` -> $(...) | 	 *	`...` -> $(...) | ||||||
| @@ -629,11 +629,11 @@ iocopy(struct ioword **iow, Area *ap) | |||||||
| 		q = (struct ioword *) alloc(sizeof(*p), ap); | 		q = (struct ioword *) alloc(sizeof(*p), ap); | ||||||
| 		ior[i] = q; | 		ior[i] = q; | ||||||
| 		*q = *p; | 		*q = *p; | ||||||
| 		if (p->name != (char *) 0) | 		if (p->name != NULL) | ||||||
| 			q->name = wdcopy(p->name, ap); | 			q->name = wdcopy(p->name, ap); | ||||||
| 		if (p->delim != (char *) 0) | 		if (p->delim != NULL) | ||||||
| 			q->delim = wdcopy(p->delim, ap); | 			q->delim = wdcopy(p->delim, ap); | ||||||
| 		if (p->heredoc != (char *) 0) | 		if (p->heredoc != NULL) | ||||||
| 			q->heredoc = str_save(p->heredoc, ap); | 			q->heredoc = str_save(p->heredoc, ap); | ||||||
| 	} | 	} | ||||||
| 	ior[i] = NULL; | 	ior[i] = NULL; | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								var.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								var.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/var.c,v 2.4 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/var.c,v 2.5 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $	*/ | /*	$OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $	*/ | ||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
| @@ -7,7 +7,7 @@ | |||||||
| #include "ksh_stat.h" | #include "ksh_stat.h" | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/var.c,v 2.4 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/var.c,v 2.5 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Variables |  * Variables | ||||||
| @@ -102,7 +102,7 @@ initvar(void) | |||||||
| 			{ "SECONDS",		V_SECONDS }, | 			{ "SECONDS",		V_SECONDS }, | ||||||
| 			{ "TMOUT",		V_TMOUT }, | 			{ "TMOUT",		V_TMOUT }, | ||||||
| 			{ "LINENO",		V_LINENO }, | 			{ "LINENO",		V_LINENO }, | ||||||
| 			{ (char *) 0,	0 } | 			{ NULL,	0 } | ||||||
| 		}; | 		}; | ||||||
| 	int i; | 	int i; | ||||||
| 	struct tbl *tp; | 	struct tbl *tp; | ||||||
| @@ -255,7 +255,7 @@ local(const char *n, bool_t copy) | |||||||
| 	vp = tenter(&l->vars, n, h); | 	vp = tenter(&l->vars, n, h); | ||||||
| 	if (copy && !(vp->flag & DEFINED)) { | 	if (copy && !(vp->flag & DEFINED)) { | ||||||
| 		struct block *ll = l; | 		struct block *ll = l; | ||||||
| 		struct tbl *vq = (struct tbl *) 0; | 		struct tbl *vq = NULL; | ||||||
|  |  | ||||||
| 		while ((ll = ll->next) && !(vq = tsearch(&ll->vars, n, h))) | 		while ((ll = ll->next) && !(vq = tsearch(&ll->vars, n, h))) | ||||||
| 			; | 			; | ||||||
| @@ -645,11 +645,11 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base) | |||||||
| 			if (fake_assign) { | 			if (fake_assign) { | ||||||
| 				if (t->flag & INTEGER) { | 				if (t->flag & INTEGER) { | ||||||
| 					s = str_val(t); | 					s = str_val(t); | ||||||
| 					free_me = (char *) 0; | 					free_me = NULL; | ||||||
| 				} else { | 				} else { | ||||||
| 					s = t->val.s + t->type; | 					s = t->val.s + t->type; | ||||||
| 					free_me = (t->flag & ALLOC) ? t->val.s | 					free_me = (t->flag & ALLOC) ? t->val.s | ||||||
| 								  : (char *) 0; | 								  : NULL; | ||||||
| 				} | 				} | ||||||
| 				t->flag &= ~ALLOC; | 				t->flag &= ~ALLOC; | ||||||
| 			} | 			} | ||||||
| @@ -729,7 +729,7 @@ unset(struct tbl *vp, int array_ref) | |||||||
| 				afree((void *) tmp->val.s, tmp->areap); | 				afree((void *) tmp->val.s, tmp->areap); | ||||||
| 			afree(tmp, tmp->areap); | 			afree(tmp, tmp->areap); | ||||||
| 		} | 		} | ||||||
| 		vp->u.array = (struct tbl *) 0; | 		vp->u.array = NULL; | ||||||
| 	} | 	} | ||||||
| 	/* If foo[0] is being unset, the remainder of the array is kept... */ | 	/* If foo[0] is being unset, the remainder of the array is kept... */ | ||||||
| 	vp->flag &= SPECIAL | (array_ref ? ARRAY|DEFINED : 0); | 	vp->flag &= SPECIAL | (array_ref ? ARRAY|DEFINED : 0); | ||||||
| @@ -894,7 +894,7 @@ getspec(struct tbl *vp) | |||||||
| 		 * (see initcoms[] in main.c). | 		 * (see initcoms[] in main.c). | ||||||
| 		 */ | 		 */ | ||||||
| 		if (vp->flag & ISSET) | 		if (vp->flag & ISSET) | ||||||
| 			setint(vp, (long) (time((time_t *)0) - seconds)); | 			setint(vp, (long) (time(NULL) - seconds)); | ||||||
| 		vp->flag |= SPECIAL; | 		vp->flag |= SPECIAL; | ||||||
| 		break; | 		break; | ||||||
| 	  case V_RANDOM: | 	  case V_RANDOM: | ||||||
| @@ -947,7 +947,7 @@ setspec(struct tbl *vp) | |||||||
| 	  case V_TMPDIR: | 	  case V_TMPDIR: | ||||||
| 		if (tmpdir) { | 		if (tmpdir) { | ||||||
| 			afree(tmpdir, APERM); | 			afree(tmpdir, APERM); | ||||||
| 			tmpdir = (char *) 0; | 			tmpdir = NULL; | ||||||
| 		} | 		} | ||||||
| 		/* Use tmpdir iff it is an absolute path, is writable and | 		/* Use tmpdir iff it is an absolute path, is writable and | ||||||
| 		 * searchable and is a directory... | 		 * searchable and is a directory... | ||||||
| @@ -986,7 +986,7 @@ setspec(struct tbl *vp) | |||||||
| 		break; | 		break; | ||||||
| 	  case V_SECONDS: | 	  case V_SECONDS: | ||||||
| 		vp->flag &= ~SPECIAL; | 		vp->flag &= ~SPECIAL; | ||||||
| 		seconds = time((time_t*) 0) - intval(vp); | 		seconds = time(NULL) - intval(vp); | ||||||
| 		vp->flag |= SPECIAL; | 		vp->flag |= SPECIAL; | ||||||
| 		break; | 		break; | ||||||
| 	  case V_TMOUT: | 	  case V_TMOUT: | ||||||
| @@ -1021,7 +1021,7 @@ unsetspec(struct tbl *vp) | |||||||
| 		/* should not become unspecial */ | 		/* should not become unspecial */ | ||||||
| 		if (tmpdir) { | 		if (tmpdir) { | ||||||
| 			afree(tmpdir, APERM); | 			afree(tmpdir, APERM); | ||||||
| 			tmpdir = (char *) 0; | 			tmpdir = NULL; | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| 	  case V_LINENO: | 	  case V_LINENO: | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								vi.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								vi.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /**	$MirBSD: src/bin/ksh/vi.c,v 2.3 2004/12/18 19:17:10 tg Exp $ */ | /**	$MirBSD: src/bin/ksh/vi.c,v 2.4 2004/12/18 19:22:30 tg Exp $ */ | ||||||
| /*	$OpenBSD: vi.c,v 1.13 2004/05/10 16:28:47 pvalchev Exp $	*/ | /*	$OpenBSD: vi.c,v 1.13 2004/05/10 16:28:47 pvalchev Exp $	*/ | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -14,7 +14,7 @@ | |||||||
| #include "ksh_stat.h"		/* completion */ | #include "ksh_stat.h"		/* completion */ | ||||||
| #include "edit.h" | #include "edit.h" | ||||||
|  |  | ||||||
| __RCSID("$MirBSD: src/bin/ksh/vi.c,v 2.3 2004/12/18 19:17:10 tg Exp $"); | __RCSID("$MirBSD: src/bin/ksh/vi.c,v 2.4 2004/12/18 19:22:30 tg Exp $"); | ||||||
|  |  | ||||||
| #define Ctrl(c)		(c&0x1f) | #define Ctrl(c)		(c&0x1f) | ||||||
| #define	is_wordch(c)	(letnum(c)) | #define	is_wordch(c)	(letnum(c)) | ||||||
| @@ -1901,7 +1901,7 @@ expand_word(int command) | |||||||
|  |  | ||||||
| 	nwords = x_cf_glob(XCF_COMMAND_FILE|XCF_FULLPATH, | 	nwords = x_cf_glob(XCF_COMMAND_FILE|XCF_FULLPATH, | ||||||
| 		es->cbuf, es->linelen, es->cursor, | 		es->cbuf, es->linelen, es->cursor, | ||||||
| 		&start, &end, &words, (int *) 0); | 		&start, &end, &words, NULL); | ||||||
| 	if (nwords == 0) { | 	if (nwords == 0) { | ||||||
| 		vi_error(); | 		vi_error(); | ||||||
| 		return -1; | 		return -1; | ||||||
| @@ -1987,12 +1987,12 @@ complete_word(int command, int count) | |||||||
| 		 */ | 		 */ | ||||||
| 		if (is_command) { | 		if (is_command) { | ||||||
| 			match = words[count] | 			match = words[count] | ||||||
| 				+ x_basename(words[count], (char *) 0); | 				+ x_basename(words[count], NULL); | ||||||
| 			/* If more than one possible match, use full path */ | 			/* If more than one possible match, use full path */ | ||||||
| 			for (i = 0; i < nwords; i++) | 			for (i = 0; i < nwords; i++) | ||||||
| 				if (i != count && | 				if (i != count && | ||||||
| 				    FILECMP(words[i] | 				    FILECMP(words[i] | ||||||
| 					    + x_basename(words[i], (char *) 0), | 					    + x_basename(words[i], NULL), | ||||||
| 					    match) == 0) | 					    match) == 0) | ||||||
| 				{ | 				{ | ||||||
| 					match = words[count]; | 					match = words[count]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user