summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-09-15 18:15:06 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-09-15 18:15:06 +0000
commit0c5194784eee80ff5f499f992c5db00174a0bb1f (patch)
tree2dbc3d28e72c5852cb0e4eb007fe9ea4b3dd3ab3 /bin
parent9d03008fafc9d48a2f6dad2992efc40302e5f1ec (diff)
correct spelling of NULL from (char *)0. from Michael McConville.
ok md5
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/c_ksh.c28
-rw-r--r--bin/ksh/c_sh.c6
-rw-r--r--bin/ksh/c_test.c4
-rw-r--r--bin/ksh/c_ulimit.c4
-rw-r--r--bin/ksh/edit.c14
-rw-r--r--bin/ksh/eval.c10
-rw-r--r--bin/ksh/exec.c24
-rw-r--r--bin/ksh/expr.c6
-rw-r--r--bin/ksh/history.c10
-rw-r--r--bin/ksh/io.c4
-rw-r--r--bin/ksh/jobs.c8
-rw-r--r--bin/ksh/lex.c8
-rw-r--r--bin/ksh/main.c10
-rw-r--r--bin/ksh/misc.c22
-rw-r--r--bin/ksh/path.c14
-rw-r--r--bin/ksh/shf.c6
-rw-r--r--bin/ksh/syn.c32
-rw-r--r--bin/ksh/trap.c10
-rw-r--r--bin/ksh/tree.c10
-rw-r--r--bin/ksh/var.c16
-rw-r--r--bin/ksh/vi.c6
21 files changed, 126 insertions, 126 deletions
diff --git a/bin/ksh/c_ksh.c b/bin/ksh/c_ksh.c
index 9454153dec8..b7476abb4f8 100644
--- a/bin/ksh/c_ksh.c
+++ b/bin/ksh/c_ksh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_ksh.c,v 1.39 2015/09/15 18:07:22 tedu Exp $ */
+/* $OpenBSD: c_ksh.c,v 1.40 2015/09/15 18:15:05 tedu Exp $ */
/*
* built-in Korn commands: c_*
@@ -77,7 +77,7 @@ c_cd(char **wp)
* we could try to find another substitution. For now
* we don't
*/
- if ((cp = strstr(current_wd, wp[0])) == (char *) 0) {
+ if ((cp = strstr(current_wd, wp[0])) == NULL) {
bi_errorf("bad substitution");
return 1;
}
@@ -99,7 +99,7 @@ c_cd(char **wp)
/* xp will have a bogus value after make_path() - set it to 0
* so that if it's used, it will cause a dump
*/
- xp = (char *) 0;
+ xp = NULL;
cdpath = str_val(global("CDPATH"));
do {
@@ -110,7 +110,7 @@ c_cd(char **wp)
simplify_path(Xstring(xs, xp));
rval = chdir(try = Xstring(xs, xp));
}
- } while (rval < 0 && cdpath != (char *) 0);
+ } while (rval < 0 && cdpath != NULL);
if (rval < 0) {
if (cdnode)
@@ -133,7 +133,7 @@ c_cd(char **wp)
setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR);
if (Xstring(xs, xp)[0] != '/') {
- pwd = (char *) 0;
+ pwd = NULL;
} else
if (!physical || !(pwd = get_phys_path(Xstring(xs, xp))))
pwd = Xstring(xs, xp);
@@ -183,11 +183,11 @@ c_pwd(char **wp)
return 1;
}
p = current_wd[0] ? (physical ? get_phys_path(current_wd) : current_wd) :
- (char *) 0;
+ NULL;
if (p && access(p, R_OK) < 0)
- p = (char *) 0;
+ p = NULL;
if (!p) {
- freep = p = ksh_get_wd((char *) 0, 0);
+ freep = p = ksh_get_wd(NULL, 0);
if (!p) {
bi_errorf("can't get current directory - %s",
strerror(errno));
@@ -557,7 +557,7 @@ c_typeset(char **wp)
break;
}
- fieldstr = basestr = (char *) 0;
+ fieldstr = basestr = NULL;
builtin_opt.flags |= GF_PLUSOPT;
/* 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
@@ -1018,7 +1018,7 @@ c_let(char **wp)
int rv = 1;
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");
else
for (wp++; *wp; wp++)
@@ -1057,7 +1057,7 @@ c_jobs(char **wp)
}
wp += builtin_opt.optind;
if (!*wp) {
- if (j_jobs((char *) 0, flag, nflag))
+ if (j_jobs(NULL, flag, nflag))
rv = 1;
} else {
for (; *wp; wp++)
@@ -1275,7 +1275,7 @@ c_getopts(char **wp)
return 1;
}
/* Which arguments are we parsing... */
- if (*wp == (char *) 0)
+ if (*wp == NULL)
wp = e->loc->next->argv;
else
*--wp = e->loc->next->argv[0];
@@ -1290,7 +1290,7 @@ c_getopts(char **wp)
return 1;
}
- user_opt.optarg = (char *) 0;
+ user_opt.optarg = NULL;
optc = ksh_getopt(wp, &user_opt, options);
if (optc >= 0 && optc != '?' && (user_opt.info & GI_PLUS)) {
@@ -1318,7 +1318,7 @@ c_getopts(char **wp)
/* Paranoia: ensure no bizarre results. */
if (voptarg->flag & INTEGER)
typeset("OPTARG", 0, INTEGER, 0, 0);
- if (user_opt.optarg == (char *) 0)
+ if (user_opt.optarg == NULL)
unset(voptarg, 0);
else
/* This can't fail (have cleared readonly/integer) */
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c
index c6336452402..3d6cb9c1a6d 100644
--- a/bin/ksh/c_sh.c
+++ b/bin/ksh/c_sh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_sh.c,v 1.46 2015/07/20 20:46:24 guenther Exp $ */
+/* $OpenBSD: c_sh.c,v 1.47 2015/09/15 18:15:05 tedu Exp $ */
/*
* built-in Bourne commands
@@ -223,8 +223,8 @@ c_wait(char **wp)
if (ksh_getopt(wp, &builtin_opt, null) == '?')
return 1;
wp += builtin_opt.optind;
- if (*wp == (char *) 0) {
- while (waitfor((char *) 0, &sig) >= 0)
+ if (*wp == NULL) {
+ while (waitfor(NULL, &sig) >= 0)
;
rv = sig;
} else {
diff --git a/bin/ksh/c_test.c b/bin/ksh/c_test.c
index 33b2cf6a976..478e29d6266 100644
--- a/bin/ksh/c_test.c
+++ b/bin/ksh/c_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_test.c,v 1.18 2009/03/01 20:11:06 otto Exp $ */
+/* $OpenBSD: c_test.c,v 1.19 2015/09/15 18:15:05 tedu Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@@ -161,7 +161,7 @@ c_test(char **wp)
if (!Flag(FPOSIX) && strcmp(opnd1, "-t") == 0)
break;
res = (*te.eval)(&te, TO_STNZE, opnd1,
- (char *) 0, 1);
+ NULL, 1);
if (invert & 1)
res = !res;
return !res;
diff --git a/bin/ksh/c_ulimit.c b/bin/ksh/c_ulimit.c
index 11bc10adee9..7335efba2ab 100644
--- a/bin/ksh/c_ulimit.c
+++ b/bin/ksh/c_ulimit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_ulimit.c,v 1.19 2013/11/28 10:33:37 sobrado Exp $ */
+/* $OpenBSD: c_ulimit.c,v 1.20 2015/09/15 18:15:05 tedu Exp $ */
/*
ulimit -- handle "ulimit" builtin
@@ -51,7 +51,7 @@ c_ulimit(char **wp)
#ifdef RLIMIT_VMEM
{ "vmemory(kbytes)", RLIMIT_VMEM, 1024, 'v' },
#endif /* RLIMIT_VMEM */
- { (char *) 0 }
+ { NULL }
};
static char options[4 + NELEM(limits) * 2];
int how = SOFT | HARD;
diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c
index 3eed072deb1..ddc38800329 100644
--- a/bin/ksh/edit.c
+++ b/bin/ksh/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.41 2015/09/01 13:12:31 tedu Exp $ */
+/* $OpenBSD: edit.c,v 1.42 2015/09/15 18:15:05 tedu Exp $ */
/*
* Command line editing - common code
@@ -307,10 +307,10 @@ x_print_expansions(int nwords, char *const *words, int is_command)
/* Special case for 1 match (prefix is whole word) */
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? */
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)
break;
/* All in same directory? */
@@ -321,7 +321,7 @@ x_print_expansions(int nwords, char *const *words, int is_command)
XPinit(l, nwords + 1);
for (i = 0; i < nwords; i++)
XPput(l, words[i] + prefix_len);
- XPput(l, (char *) 0);
+ XPput(l, NULL);
}
}
@@ -477,7 +477,7 @@ x_command_glob(int flags, const char *str, int slen, char ***wordsp)
alloc(sizeof(struct path_order_info) * nwords, ATEMP);
for (i = 0; i < nwords; 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 ||
strncmp(words[i], last_info->word, info[i].base) != 0) {
last_info = &info[i];
@@ -616,7 +616,7 @@ add_glob(const char *str, int slen)
bool saw_slash = false;
if (slen < 0)
- return (char *) 0;
+ return NULL;
toglob = str_nsave(str, slen + 1, ATEMP); /* + 1 for "*" */
toglob[slen] = '\0';
@@ -695,7 +695,7 @@ x_basename(const char *s, const char *se)
{
const char *p;
- if (se == (char *) 0)
+ if (se == NULL)
se = s + strlen(s);
if (s == se)
return 0;
diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c
index 9ab6a85fccb..982db2098e2 100644
--- a/bin/ksh/eval.c
+++ b/bin/ksh/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.40 2013/09/14 20:09:30 millert Exp $ */
+/* $OpenBSD: eval.c,v 1.41 2015/09/15 18:15:05 tedu Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -861,7 +861,7 @@ comsub(Expand *xp, char *cp)
if ((io->flag&IOTYPE) != IOREAD)
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_MAPHI|SHF_CLEXEC);
if (shf == NULL)
@@ -1190,7 +1190,7 @@ maybe_expand_tilde(char *p, XString *dsp, char **dpp, int isassign)
}
*tp = '\0';
r = (p[0] == EOS || p[0] == CHAR || p[0] == CSUBST) ?
- tilde(Xstring(ts, tp)) : (char *) 0;
+ tilde(Xstring(ts, tp)) : NULL;
Xfree(ts, tp);
if (r) {
while (*r) {
@@ -1226,7 +1226,7 @@ tilde(char *cp)
dp = homedir(cp);
/* If HOME, PWD or OLDPWD are not set, don't expand ~ */
if (dp == null)
- dp = (char *) 0;
+ dp = NULL;
return dp;
}
@@ -1271,7 +1271,7 @@ alt_expand(XPtrV *wp, char *start, char *exp_start, char *end, int fdo)
/* find matching close brace, if any */
if (p) {
- comma = (char *) 0;
+ comma = NULL;
count = 1;
for (p += 2; *p && count; p++) {
if (ISMAGIC(*p)) {
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index e3ee83acb7f..fdaa89b3979 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.53 2015/09/14 16:08:50 nicm Exp $ */
+/* $OpenBSD: exec.c,v 1.54 2015/09/15 18:15:05 tedu Exp $ */
/*
* execute command tree
@@ -840,7 +840,7 @@ findcom(const char *name, int flags)
tp = findfunc(name, h, false);
if (tp && !(tp->flag & ISSET)) {
if ((fpath = str_val(global("FPATH"))) == null) {
- tp->u.fpath = (char *) 0;
+ tp->u.fpath = NULL;
tp->u2.errno_ = 0;
} else
tp->u.fpath = search(name, fpath, R_OK,
@@ -897,7 +897,7 @@ findcom(const char *name, int flags)
} else if ((flags & FC_FUNC) &&
(fpath = str_val(global("FPATH"))) != null &&
(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
* searches FPATH if a command is not found, even
* if the command hasn't been set up as an autoloaded
@@ -1016,7 +1016,7 @@ call_builtin(struct tbl *tp, char **wp)
shf_flush(shl_stdout);
shl_stdout_ok = 0;
builtin_flag = 0;
- builtin_argv0 = (char *) 0;
+ builtin_argv0 = NULL;
return rv;
}
@@ -1038,13 +1038,13 @@ iosetup(struct ioword *iop, struct tbl *tp)
/* Used for tracing and error messages to print expanded cp */
iotmp = *iop;
- iotmp.name = (iotype == IOHERE) ? (char *) 0 : cp;
+ iotmp.name = (iotype == IOHERE) ? NULL : cp;
iotmp.flag |= IONAMEXP;
if (Flag(FXTRACE))
shellf("%s%s\n",
PS4_SUBSTITUTE(str_val(global("PS4"))),
- snptreef((char *) 0, 32, "%R", &iotmp));
+ snptreef(NULL, 32, "%R", &iotmp));
switch (iotype) {
case IOREAD:
@@ -1088,7 +1088,7 @@ iosetup(struct ioword *iop, struct tbl *tp)
X_OK | ((iop->flag & IORDUP) ? R_OK : W_OK),
&emsg)) < 0) {
warningf(true, "%s: %s",
- snptreef((char *) 0, 32, "%R", &iotmp), emsg);
+ snptreef(NULL, 32, "%R", &iotmp), emsg);
return -1;
}
if (u == iop->unit)
@@ -1134,7 +1134,7 @@ iosetup(struct ioword *iop, struct tbl *tp)
if (ksh_dup2(u, iop->unit, true) < 0) {
warningf(true,
"could not finish (dup) redirection %s: %s",
- snptreef((char *) 0, 32, "%R", &iotmp),
+ snptreef(NULL, 32, "%R", &iotmp),
strerror(errno));
if (iotype != IODUP)
close(u);
@@ -1171,7 +1171,7 @@ herein(const char *content, int sub)
int i;
/* ksh -c 'cat << EOF' can cause this... */
- if (content == (char *) 0) {
+ if (content == NULL) {
warningf(true, "here document missing");
return -2; /* special to iosetup(): don't print error */
}
@@ -1231,7 +1231,7 @@ static char *
do_selectargs(char **ap, bool print_menu)
{
static const char *const read_args[] = {
- "read", "-r", "REPLY", (char *) 0
+ "read", "-r", "REPLY", NULL
};
const char *errstr;
char *s;
@@ -1249,7 +1249,7 @@ do_selectargs(char **ap, bool print_menu)
pr_menu(ap);
shellf("%s", str_val(global("PS3")));
if (call_builtin(findcom("read", FC_BI), (char **) read_args))
- return (char *) 0;
+ return NULL;
s = str_val(global("REPLY"));
if (*s) {
i = strtonum(s, 1, argct, &errstr);
@@ -1405,7 +1405,7 @@ dbteste_getopnd(Test_env *te, Test_op op, int do_eval)
char *s = *te->pos.wp;
if (!s)
- return (char *) 0;
+ return NULL;
te->pos.wp++;
diff --git a/bin/ksh/expr.c b/bin/ksh/expr.c
index 6030113e809..2e0acdae3df 100644
--- a/bin/ksh/expr.c
+++ b/bin/ksh/expr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expr.c,v 1.24 2014/12/08 14:26:31 otto Exp $ */
+/* $OpenBSD: expr.c,v 1.25 2015/09/15 18:15:05 tedu Exp $ */
/*
* Korn expression evaluation
@@ -203,7 +203,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok,
v = intvar(es, evalexpr(es, MAX_PREC));
if (es->tok != END)
- evalerr(es, ET_UNEXPECTED, (char *) 0);
+ evalerr(es, ET_UNEXPECTED, NULL);
if (vp->flag & INTEGER)
setint_v(vp, v, es->arith);
@@ -307,7 +307,7 @@ evalexpr(Expr_state *es, enum prec prec)
vl = es->val;
token(es);
} else {
- evalerr(es, ET_UNEXPECTED, (char *) 0);
+ evalerr(es, ET_UNEXPECTED, NULL);
/* NOTREACHED */
}
if (es->tok == O_PLUSPLUS || es->tok == O_MINUSMINUS) {
diff --git a/bin/ksh/history.c b/bin/ksh/history.c
index 25f7c56314f..d392301f050 100644
--- a/bin/ksh/history.c
+++ b/bin/ksh/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.41 2015/09/01 13:12:31 tedu Exp $ */
+/* $OpenBSD: history.c,v 1.42 2015/09/15 18:15:05 tedu Exp $ */
/*
* command history
@@ -52,10 +52,10 @@ c_fc(char **wp)
{
struct shf *shf;
struct temp *tf = NULL;
- char *p, *editor = (char *) 0;
+ char *p, *editor = NULL;
int gflag = 0, lflag = 0, nflag = 0, sflag = 0, rflag = 0;
int optc;
- char *first = (char *) 0, *last = (char *) 0;
+ char *first = NULL, *last = NULL;
char **hfirst, **hlast, **hp;
if (!Flag(FTALKING_I)) {
@@ -112,7 +112,7 @@ c_fc(char **wp)
/* Substitute and execute command */
if (sflag) {
- char *pat = (char *) 0, *rep = (char *) 0;
+ char *pat = NULL, *rep = NULL;
if (editor || lflag || nflag || rflag) {
bi_errorf("can't use -e, -l, -n, -r with -s (-e -)");
@@ -277,7 +277,7 @@ hist_execute(char *cmd)
if ((q = strchr(p, '\n'))) {
*q++ = '\0'; /* kill the newline */
if (!*q) /* ignore trailing newline */
- q = (char *) 0;
+ q = NULL;
}
histsave(++(hist_source->line), p, 1);
diff --git a/bin/ksh/io.c b/bin/ksh/io.c
index f98e136ca29..8d16b51edaa 100644
--- a/bin/ksh/io.c
+++ b/bin/ksh/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.26 2015/09/11 08:00:27 guenther Exp $ */
+/* $OpenBSD: io.c,v 1.27 2015/09/15 18:15:05 tedu Exp $ */
/*
* shell buffered IO and formatted output
@@ -75,7 +75,7 @@ bi_errorf(const char *fmt, ...)
*/
if ((builtin_flag & SPEC_BI) ||
(Flag(FPOSIX) && (builtin_flag & KEEPASN))) {
- builtin_argv0 = (char *) 0;
+ builtin_argv0 = NULL;
unwind(LERROR);
}
}
diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index 642e09632e9..b57ba18d43f 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jobs.c,v 1.44 2015/09/15 18:07:22 tedu Exp $ */
+/* $OpenBSD: jobs.c,v 1.45 2015/09/15 18:15:05 tedu Exp $ */
/*
* Process and job control
@@ -100,7 +100,7 @@ static const char *const lookup_msgs[] = {
"no such job",
"ambiguous",
"argument must be %job or process id",
- (char *) 0
+ NULL
};
struct timeval j_systime, j_usrtime; /* user and system time of last j_waitjed job */
@@ -628,7 +628,7 @@ waitfor(const char *cp, int *sigp)
*sigp = 0;
- if (cp == (char *) 0) {
+ if (cp == NULL) {
/* wait for an unspecified job - always returns 0, so
* don't have to worry about exited/signaled jobs
*/
@@ -1485,7 +1485,7 @@ j_lookup(const char *cp, int *ecodep)
last_match = (Job *) 0;
for (j = job_list; j != (Job *) 0; j = j->next)
for (p = j->proc_list; p != (Proc *) 0; p = p->next)
- if (strstr(p->command, cp+1) != (char *) 0) {
+ if (strstr(p->command, cp+1) != NULL) {
if (last_match) {
if (ecodep)
*ecodep = JL_AMBIG;
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index b4cdd181f59..cf52cd6f6b7 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.51 2015/09/10 22:48:58 nicm Exp $ */
+/* $OpenBSD: lex.c,v 1.52 2015/09/15 18:15:05 tedu Exp $ */
/*
* lexical analysis and source input
@@ -728,9 +728,9 @@ Done:
ungetsc(c2);
}
- iop->name = (char *) 0;
- iop->delim = (char *) 0;
- iop->heredoc = (char *) 0;
+ iop->name = NULL;
+ iop->delim = NULL;
+ iop->heredoc = NULL;
Xfree(ws, wp); /* free word */
yylval.iop = iop;
return REDIR;
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 1866407acc7..162ef7e136e 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.57 2015/09/10 22:48:58 nicm Exp $ */
+/* $OpenBSD: main.c,v 1.58 2015/09/15 18:15:05 tedu Exp $ */
/*
* startup, main loop, environments and error handling
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
def_path = _PATH_DEFPATH;
{
- size_t len = confstr(_CS_PATH, (char *) 0, 0);
+ size_t len = confstr(_CS_PATH, NULL, 0);
char *new;
if (len > 0) {
@@ -227,7 +227,7 @@ main(int argc, char *argv[])
stat(pwd, &s_pwd) < 0 || stat(".", &s_dot) < 0 ||
s_pwd.st_dev != s_dot.st_dev ||
s_pwd.st_ino != s_dot.st_ino)
- pwdx = (char *) 0;
+ pwdx = NULL;
set_current_wd(pwdx);
if (current_wd[0])
simplify_path(current_wd);
@@ -302,7 +302,7 @@ main(int argc, char *argv[])
/* The following only if isatty(0) */
s->flags |= SF_TTY;
s->u.shf->flags |= SHF_INTERRUPT;
- s->file = (char *) 0;
+ s->file = NULL;
}
}
@@ -373,7 +373,7 @@ main(int argc, char *argv[])
static const char *const restr_com[] = {
"typeset", "-r", "PATH",
"ENV", "SHELL",
- (char *) 0
+ NULL
};
shcomexec((char **) restr_com);
/* After typeset command... */
diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c
index ed2426e4f25..cf596221b38 100644
--- a/bin/ksh/misc.c
+++ b/bin/ksh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.42 2015/09/15 18:07:22 tedu Exp $ */
+/* $OpenBSD: misc.c,v 1.43 2015/09/15 18:15:05 tedu Exp $ */
/*
* Miscellaneous functions
@@ -119,7 +119,7 @@ const struct option options[] = {
{ "braceexpand", 0, OF_ANY }, /* non-standard */
#endif
{ "bgnice", 0, OF_ANY },
- { (char *) 0, 'c', OF_CMDLINE },
+ { NULL, 'c', OF_CMDLINE },
{ "csh-history", 0, OF_ANY }, /* non-standard */
#ifdef EMACS
{ "emacs", 0, OF_ANY },
@@ -137,7 +137,7 @@ const struct option options[] = {
#ifdef JOBS
{ "monitor", 'm', OF_ANY },
#else /* JOBS */
- { (char *) 0, 'm', 0 }, /* so FMONITOR not ifdef'd */
+ { NULL, 'm', 0 }, /* so FMONITOR not ifdef'd */
#endif /* JOBS */
{ "noclobber", 'C', OF_ANY },
{ "noexec", 'n', OF_ANY },
@@ -167,7 +167,7 @@ const struct option options[] = {
/* Anonymous flags: used internally by shell only
* (not visible to user)
*/
- { (char *) 0, 0, OF_INTERNAL }, /* FTALKING_I */
+ { NULL, 0, OF_INTERNAL }, /* FTALKING_I */
};
/*
@@ -322,7 +322,7 @@ parse_args(char **argv,
static char cmd_opts[NELEM(options) + 3]; /* o:\0 */
static char set_opts[NELEM(options) + 5]; /* Ao;s\0 */
char *opts;
- char *array = (char *) 0;
+ char *array = NULL;
Getopt go;
int i, optc, set, sortargs = 0, arrayset = 0;
@@ -368,7 +368,7 @@ parse_args(char **argv,
break;
case 'o':
- if (go.optarg == (char *) 0) {
+ if (go.optarg == NULL) {
/* lone -o: print options
*
* Note that on the command line, -o requires
@@ -832,7 +832,7 @@ void
ksh_getopt_reset(Getopt *go, int flags)
{
go->optind = 1;
- go->optarg = (char *) 0;
+ go->optarg = NULL;
go->p = 0;
go->flags = flags;
go->info = 0;
@@ -880,7 +880,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options)
go->info |= GI_MINUSMINUS;
return -1;
}
- if (arg == (char *) 0 ||
+ if (arg == NULL ||
((flag != '-' ) && /* neither a - nor a + (if + allowed) */
(!(go->flags & GF_PLUSOPT) || flag != '+')) ||
(c = arg[1]) == '\0') {
@@ -917,7 +917,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options)
else if (argv[go->optind])
go->optarg = argv[go->optind++];
else if (*o == ';')
- go->optarg = (char *) 0;
+ go->optarg = NULL;
else {
if (options[0] == ':') {
go->buf[0] = c;
@@ -947,14 +947,14 @@ ksh_getopt(char **argv, Getopt *go, const char *options)
go->optarg = argv[go->optind - 1] + go->p;
go->p = 0;
} else
- go->optarg = (char *) 0;
+ go->optarg = NULL;
} else {
if (argv[go->optind] && (digit(argv[go->optind][0]) ||
!strcmp(argv[go->optind], "unlimited"))) {
go->optarg = argv[go->optind++];
go->p = 0;
} else
- go->optarg = (char *) 0;
+ go->optarg = NULL;
}
}
return c;
diff --git a/bin/ksh/path.c b/bin/ksh/path.c
index a6973724bb2..4ea58d93997 100644
--- a/bin/ksh/path.c
+++ b/bin/ksh/path.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: path.c,v 1.13 2015/09/05 09:47:08 jsg Exp $ */
+/* $OpenBSD: path.c,v 1.14 2015/09/15 18:15:05 tedu Exp $ */
#include "sh.h"
#include <sys/stat.h>
@@ -67,7 +67,7 @@ make_path(const char *cwd, const char *file,
for (pend = plist; *pend && *pend != ':'; pend++)
;
plen = pend - plist;
- *cdpathp = *pend ? ++pend : (char *) 0;
+ *cdpathp = *pend ? ++pend : NULL;
}
if ((use_cdpath == 0 || !plen || plist[0] != '/') &&
@@ -95,7 +95,7 @@ make_path(const char *cwd, const char *file,
memcpy(xp, file, len);
if (!use_cdpath)
- *cdpathp = (char *) 0;
+ *cdpathp = NULL;
return rval;
}
@@ -177,7 +177,7 @@ set_current_wd(char *path)
int len;
char *p = path;
- if (!p && !(p = ksh_get_wd((char *) 0, 0)))
+ if (!p && !(p = ksh_get_wd(NULL, 0)))
p = null;
len = strlen(p) + 1;
@@ -200,7 +200,7 @@ get_phys_path(const char *path)
xp = do_phys_path(&xs, xp, path);
if (!xp)
- return (char *) 0;
+ return NULL;
if (Xlength(xs, xp) == 0)
Xput(xs, xp, '/');
@@ -246,7 +246,7 @@ do_phys_path(XString *xsp, char *xp, const char *path)
if (llen < 0) {
/* EINVAL means it wasn't a symlink... */
if (errno != EINVAL)
- return (char *) 0;
+ return NULL;
continue;
}
lbuf[llen] = '\0';
@@ -255,7 +255,7 @@ do_phys_path(XString *xsp, char *xp, const char *path)
xp = lbuf[0] == '/' ? Xstring(*xsp, xp) :
Xrestpos(*xsp, xp, savepos);
if (!(xp = do_phys_path(xsp, xp, lbuf)))
- return (char *) 0;
+ return NULL;
}
return xp;
}
diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c
index e2eff8a7d44..15699fd112b 100644
--- a/bin/ksh/shf.c
+++ b/bin/ksh/shf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shf.c,v 1.18 2015/09/14 09:42:33 nicm Exp $ */
+/* $OpenBSD: shf.c,v 1.19 2015/09/15 18:15:05 tedu Exp $ */
/*
* Shell file I/O routines
@@ -469,7 +469,7 @@ shf_getse(char *buf, int bsize, struct shf *shf)
internal_errorf(1, "shf_getse: flags %x", shf->flags);
if (bsize <= 0)
- return (char *) 0;
+ return NULL;
--bsize; /* save room for null */
do {
@@ -697,7 +697,7 @@ shf_smprintf(const char *fmt, ...)
struct shf shf;
va_list args;
- shf_sopen((char *) 0, 0, SHF_WR|SHF_DYNAMIC, &shf);
+ shf_sopen(NULL, 0, SHF_WR|SHF_DYNAMIC, &shf);
va_start(args, fmt);
shf_vfprintf(&shf, fmt, args);
va_end(args);
diff --git a/bin/ksh/syn.c b/bin/ksh/syn.c
index 6167ba92d2f..88fa2ce22b1 100644
--- a/bin/ksh/syn.c
+++ b/bin/ksh/syn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syn.c,v 1.30 2015/09/01 13:12:31 tedu Exp $ */
+/* $OpenBSD: syn.c,v 1.31 2015/09/15 18:15:05 tedu Exp $ */
/*
* shell parser (C version)
@@ -66,7 +66,7 @@ yyparse(void)
if (c == 0 && !outtree)
outtree = newtp(TEOF);
else if (c != '\n' && c != 0)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
}
static struct op *
@@ -78,7 +78,7 @@ pipeline(int cf)
if (t != NULL) {
while (token(0) == '|') {
if ((p = get_command(CONTIN)) == NULL)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
if (tl == NULL)
t = tl = block(TPIPE, t, p, NOWORDS);
else
@@ -99,7 +99,7 @@ andor(void)
if (t != NULL) {
while ((c = token(0)) == LOGAND || c == LOGOR) {
if ((p = pipeline(CONTIN)) == NULL)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
t = block(c == LOGAND? TAND: TOR, t, p, NOWORDS);
}
REJECT;
@@ -172,7 +172,7 @@ static void
musthave(int c, int cf)
{
if ((token(cf)) != c)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
}
static struct op *
@@ -255,7 +255,7 @@ get_command(int cf)
/* Must be a function */
if (iopn != 0 || XPsize(args) != 1 ||
XPsize(vars) != 0)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
ACCEPT;
/*(*/
musthave(')', 0);
@@ -357,7 +357,7 @@ get_command(int cf)
syniocf &= ~(KEYWORD|ALIAS);
t = pipeline(0);
if (t == (struct op *) 0)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
t = block(TBANG, NOBLOCK, t, NOWORDS);
break;
@@ -424,7 +424,7 @@ dogroup(void)
else if (c == '{')
c = '}';
else
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
list = c_list(true);
musthave(c, KEYWORD|ALIAS);
return list;
@@ -439,7 +439,7 @@ thenpart(void)
t = newtp(0);
t->left = c_list(true);
if (t->left == NULL)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
t->right = elsepart();
return (t);
}
@@ -452,7 +452,7 @@ elsepart(void)
switch (token(KEYWORD|ALIAS|VARASN)) {
case ELSE:
if ((t = c_list(true)) == NULL)
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
return (t);
case ELIF:
@@ -480,7 +480,7 @@ caselist(void)
else if (c == '{')
c = '}';
else
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
t = tl = NULL;
while ((tpeek(CONTIN|KEYWORD|ESACONLY)) != c) { /* no ALIAS here */
struct op *tc = casepart(c);
@@ -570,9 +570,9 @@ function_body(char *name,
t->left->args[0][0] = CHAR;
t->left->args[0][1] = ':';
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[0] = (char *) 0;
+ t->left->vars[0] = NULL;
t->left->lineno = 1;
}
if (!old_func_parse)
@@ -597,7 +597,7 @@ wordlist(void)
while ((c = token(0)) == LWORD)
XPput(args, yylval.cp);
if (c != '\n' && c != ';')
- syntaxerr((char *) 0);
+ syntaxerr(NULL);
XPput(args, NULL);
return (char **) XPclose(args);
}
@@ -698,7 +698,7 @@ syntaxerr(const char *what)
/* NOTREACHED */
case LWORD:
- s = snptreef((char *) 0, 32, "%S", yylval.cp);
+ s = snptreef(NULL, 32, "%S", yylval.cp);
break;
case REDIR:
@@ -823,7 +823,7 @@ dbtestp_isa(Test_env *te, Test_meta meta)
{
int c = tpeek(ARRAYVAR | (meta == TM_BINOP ? 0 : CONTIN));
int uqword = 0;
- char *save = (char *) 0;
+ char *save = NULL;
int ret = 0;
/* unquoted word? */
diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c
index 9b6ca16beed..f84aa712809 100644
--- a/bin/ksh/trap.c
+++ b/bin/ksh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.23 2010/05/19 17:36:08 jasper Exp $ */
+/* $OpenBSD: trap.c,v 1.24 2015/09/15 18:15:05 tedu Exp $ */
/*
* signal handling
@@ -198,7 +198,7 @@ runtraps(int flag)
fatal_trap = 0;
for (p = sigtraps, i = NSIG+1; --i >= 0; p++)
if (p->set && (!flag ||
- ((p->flags & flag) && p->trap == (char *) 0)))
+ ((p->flags & flag) && p->trap == NULL)))
runtrap(p);
}
@@ -211,7 +211,7 @@ runtrap(Trap *p)
int old_changed = 0;
p->set = 0;
- if (trapstr == (char *) 0) { /* SIG_DFL */
+ if (trapstr == NULL) { /* SIG_DFL */
if (p->flags & TF_FATAL) {
/* eg, SIGHUP */
exstat = 128 + i;
@@ -229,7 +229,7 @@ runtrap(Trap *p)
if (i == SIGEXIT_ || i == SIGERR_) { /* avoid recursion on these */
old_changed = p->flags & TF_CHANGED;
p->flags &= ~TF_CHANGED;
- p->trap = (char *) 0;
+ p->trap = NULL;
}
oexstat = exstat;
/* Note: trapstr is fully parsed before anything is executed, thus
@@ -260,7 +260,7 @@ cleartraps(void)
for (i = NSIG+1, p = sigtraps; --i >= 0; p++) {
p->set = 0;
if ((p->flags & TF_USER_SET) && (p->trap && p->trap[0]))
- settrap(p, (char *) 0);
+ settrap(p, NULL);
}
}
diff --git a/bin/ksh/tree.c b/bin/ksh/tree.c
index 500c1bbe1dc..4d6cedb1ab9 100644
--- a/bin/ksh/tree.c
+++ b/bin/ksh/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.21 2015/09/01 13:12:31 tedu Exp $ */
+/* $OpenBSD: tree.c,v 1.22 2015/09/15 18:15:05 tedu Exp $ */
/*
* command tree climbing
@@ -565,7 +565,7 @@ wdstrip(const char *wp)
struct shf shf;
int c;
- shf_sopen((char *) 0, 32, SHF_WR | SHF_DYNAMIC, &shf);
+ shf_sopen(NULL, 32, SHF_WR | SHF_DYNAMIC, &shf);
/* problems:
* `...` -> $(...)
@@ -641,11 +641,11 @@ iocopy(struct ioword **iow, Area *ap)
q = (struct ioword *) alloc(sizeof(*p), ap);
ior[i] = q;
*q = *p;
- if (p->name != (char *) 0)
+ if (p->name != NULL)
q->name = wdcopy(p->name, ap);
- if (p->delim != (char *) 0)
+ if (p->delim != NULL)
q->delim = wdcopy(p->delim, ap);
- if (p->heredoc != (char *) 0)
+ if (p->heredoc != NULL)
q->heredoc = str_save(p->heredoc, ap);
}
ior[i] = NULL;
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index bb9c8e366ad..4601feebbcf 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.46 2015/09/14 16:08:50 nicm Exp $ */
+/* $OpenBSD: var.c,v 1.47 2015/09/15 18:15:05 tedu Exp $ */
#include "sh.h"
#include <time.h>
@@ -105,7 +105,7 @@ initvar(void)
{ "SECONDS", V_SECONDS },
{ "TMOUT", V_TMOUT },
{ "LINENO", V_LINENO },
- { (char *) 0, 0 }
+ { NULL, 0 }
};
int i;
struct tbl *tp;
@@ -664,11 +664,11 @@ typeset(const char *var, int set, int clr, int field, int base)
if (fake_assign) {
if (t->flag & INTEGER) {
s = str_val(t);
- free_me = (char *) 0;
+ free_me = NULL;
} else {
s = t->val.s + t->type;
free_me = (t->flag & ALLOC) ? t->val.s :
- (char *) 0;
+ NULL;
}
t->flag &= ~ALLOC;
}
@@ -966,7 +966,7 @@ setspec(struct tbl *vp)
case V_TMPDIR:
if (tmpdir) {
afree(tmpdir, APERM);
- tmpdir = (char *) 0;
+ tmpdir = NULL;
}
/* Use tmpdir iff it is an absolute path, is writable and
* searchable and is a directory...
@@ -1065,14 +1065,14 @@ unsetspec(struct tbl *vp)
/* should not become unspecial */
if (tmpdir) {
afree(tmpdir, APERM);
- tmpdir = (char *) 0;
+ tmpdir = NULL;
}
break;
case V_MAIL:
- mbset((char *) 0);
+ mbset(NULL);
break;
case V_MAILPATH:
- mpset((char *) 0);
+ mpset(NULL);
break;
case V_LINENO:
case V_MAILCHECK: /* at&t ksh leaves previous value in place */
diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
index 89a12d1835a..21ca661c26c 100644
--- a/bin/ksh/vi.c
+++ b/bin/ksh/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.30 2015/09/10 22:48:58 nicm Exp $ */
+/* $OpenBSD: vi.c,v 1.31 2015/09/15 18:15:05 tedu Exp $ */
/*
* vi command editing
@@ -2001,12 +2001,12 @@ complete_word(int command, int count)
*/
if (is_command) {
match = words[count] +
- x_basename(words[count], (char *) 0);
+ x_basename(words[count], NULL);
/* If more than one possible match, use full path */
for (i = 0; i < nwords; i++)
if (i != count &&
strcmp(words[i] + x_basename(words[i],
- (char *) 0), match) == 0) {
+ NULL), match) == 0) {
match = words[count];
break;
}