summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-12-22 17:14:35 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-12-22 17:14:35 +0000
commit876705771ce25a4fde66ddfeeaed78e36c2522fa (patch)
tree5302300c6a77585e42ee9c9473fe0405e5eb5896 /bin
parentd8ab4b6082e45f27eab20a66b1077ed25bcc3a30 (diff)
Use stdbool.h instead of rolling our own bools.
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/c_ksh.c10
-rw-r--r--bin/ksh/c_sh.c14
-rw-r--r--bin/ksh/c_test.c6
-rw-r--r--bin/ksh/edit.c24
-rw-r--r--bin/ksh/edit.h4
-rw-r--r--bin/ksh/emacs.c44
-rw-r--r--bin/ksh/eval.c14
-rw-r--r--bin/ksh/exec.c70
-rw-r--r--bin/ksh/expr.c22
-rw-r--r--bin/ksh/history.c22
-rw-r--r--bin/ksh/io.c10
-rw-r--r--bin/ksh/jobs.c28
-rw-r--r--bin/ksh/lex.c8
-rw-r--r--bin/ksh/mail.c4
-rw-r--r--bin/ksh/main.c10
-rw-r--r--bin/ksh/misc.c8
-rw-r--r--bin/ksh/proto.h4
-rw-r--r--bin/ksh/sh.h7
-rw-r--r--bin/ksh/syn.c76
-rw-r--r--bin/ksh/trap.c4
-rw-r--r--bin/ksh/tty.c10
-rw-r--r--bin/ksh/var.c28
-rw-r--r--bin/ksh/vi.c4
23 files changed, 214 insertions, 217 deletions
diff --git a/bin/ksh/c_ksh.c b/bin/ksh/c_ksh.c
index 4a5a41078dd..44458db0f57 100644
--- a/bin/ksh/c_ksh.c
+++ b/bin/ksh/c_ksh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_ksh.c,v 1.23 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: c_ksh.c,v 1.24 2004/12/22 17:14:34 millert Exp $ */
/*
* built-in Korn commands: c_*
@@ -678,7 +678,7 @@ c_typeset(char **wp)
for (i = builtin_opt.optind; wp[i]; i++) {
if (func) {
f = findfunc(wp[i], hash(wp[i]),
- (fset&UCASEV_AL) ? TRUE : FALSE);
+ (fset&UCASEV_AL) ? true : false);
if (!f) {
/* at&t ksh does ++rval: bogus */
rval = 1;
@@ -1120,7 +1120,7 @@ c_kill(char **wp)
/* assume old style options if -digits or -UPPERCASE */
if ((p = wp[1]) && *p == '-' && (digit(p[1]) || isupper(p[1]))) {
- if (!(t = gettrap(p + 1, TRUE))) {
+ if (!(t = gettrap(p + 1, true))) {
bi_errorf("bad signal `%s'", p + 1);
return 1;
}
@@ -1134,7 +1134,7 @@ c_kill(char **wp)
lflag = 1;
break;
case 's':
- if (!(t = gettrap(builtin_opt.optarg, TRUE))) {
+ if (!(t = gettrap(builtin_opt.optarg, true))) {
bi_errorf("bad signal `%s'",
builtin_opt.optarg);
return 1;
@@ -1255,7 +1255,7 @@ c_getopts(char **wp)
bi_errorf("missing name argument");
return 1;
}
- if (!*var || *skip_varname(var, TRUE)) {
+ if (!*var || *skip_varname(var, true)) {
bi_errorf("%s: is not an identifier", var);
return 1;
}
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c
index 252a83de13b..f31c2c0a013 100644
--- a/bin/ksh/c_sh.c
+++ b/bin/ksh/c_sh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_sh.c,v 1.23 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: c_sh.c,v 1.24 2004/12/22 17:14:34 millert Exp $ */
/*
* built-in Bourne commands
@@ -440,7 +440,7 @@ c_eval(char **wp)
exstat = subst_exstat;
}
- return shell(s, FALSE);
+ return shell(s, false);
}
int
@@ -486,13 +486,13 @@ c_trap(char **wp)
* command 'exit' isn't confused with the pseudo-signal
* 'EXIT'.
*/
- s = (gettrap(*wp, FALSE) == NULL) ? *wp++ : NULL; /* get command */
+ s = (gettrap(*wp, false) == NULL) ? *wp++ : NULL; /* get command */
if (s != NULL && s[0] == '-' && s[1] == '\0')
s = NULL;
/* set/clear traps */
while (*wp != NULL) {
- p = gettrap(*wp++, TRUE);
+ p = gettrap(*wp++, true);
if (p == NULL) {
bi_errorf("bad signal %s", wp[-1]);
return 1;
@@ -516,7 +516,7 @@ c_exitreturn(char **wp)
if (arg) {
if (!getn(arg, &n)) {
exstat = 1;
- warningf(TRUE, "%s: bad number", arg);
+ warningf(true, "%s: bad number", arg);
} else
exstat = n;
}
@@ -581,7 +581,7 @@ c_brkcont(char **wp)
* scripts, but don't generate an error (ie, keep going).
*/
if (n == quit) {
- warningf(TRUE, "%s: cannot %s", wp[0], wp[0]);
+ warningf(true, "%s: cannot %s", wp[0], wp[0]);
return 0;
}
/* POSIX says if n is too big, the last enclosing loop
@@ -589,7 +589,7 @@ c_brkcont(char **wp)
* do anyway 'cause the user messed up.
*/
last_ep->flags &= ~EF_BRKCONT_PASS;
- warningf(TRUE, "%s: can only %s %d level(s)",
+ warningf(true, "%s: can only %s %d level(s)",
wp[0], wp[0], n - quit);
}
diff --git a/bin/ksh/c_test.c b/bin/ksh/c_test.c
index cec44612c25..227dfa6d250 100644
--- a/bin/ksh/c_test.c
+++ b/bin/ksh/c_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_test.c,v 1.13 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: c_test.c,v 1.14 2004/12/22 17:14:34 millert Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@@ -289,11 +289,11 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2,
*/
case TO_STEQL: /* = */
if (te->flags & TEF_DBRACKET)
- return gmatch(opnd1, opnd2, FALSE);
+ return gmatch(opnd1, opnd2, false);
return strcmp(opnd1, opnd2) == 0;
case TO_STNEQ: /* != */
if (te->flags & TEF_DBRACKET)
- return !gmatch(opnd1, opnd2, FALSE);
+ return !gmatch(opnd1, opnd2, false);
return strcmp(opnd1, opnd2) != 0;
case TO_STLT: /* < */
return strcmp(opnd1, opnd2) < 0;
diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c
index c70c657e0fd..4cd5f7cacf6 100644
--- a/bin/ksh/edit.c
+++ b/bin/ksh/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.25 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: edit.c,v 1.26 2004/12/22 17:14:34 millert Exp $ */
/*
* Command line editing - common code
@@ -95,7 +95,7 @@ x_read(char *buf, size_t len)
if (got_sigwinch)
check_sigwinch();
- x_mode(TRUE);
+ x_mode(true);
#ifdef EMACS
if (Flag(FEMACS) || Flag(FGMACS))
i = x_emacs(buf, len);
@@ -107,7 +107,7 @@ x_read(char *buf, size_t len)
else
#endif
i = -1; /* internal error */
- x_mode(FALSE);
+ x_mode(false);
return i;
}
@@ -121,9 +121,9 @@ x_getc(void)
while ((n = blocking_read(0, &c, 1)) < 0 && errno == EINTR)
if (trap) {
- x_mode(FALSE);
+ x_mode(false);
runtraps(0);
- x_mode(TRUE);
+ x_mode(true);
}
if (n != 1)
return -1;
@@ -149,11 +149,11 @@ x_puts(const char *s)
shf_putc(*s++, shl_out);
}
-bool_t
-x_mode(bool_t onoff)
+bool
+x_mode(bool onoff)
{
- static bool_t x_cur_mode;
- bool_t prev;
+ static bool x_cur_mode;
+ bool prev;
if (x_cur_mode == onoff)
return x_cur_mode;
@@ -656,7 +656,7 @@ add_glob(const char *str, int slen)
{
char *toglob;
char *s;
- bool_t saw_slash = FALSE;
+ bool saw_slash = false;
if (slen < 0)
return (char *) 0;
@@ -677,7 +677,7 @@ add_glob(const char *str, int slen)
|| (s[1] == '(' /*)*/ && strchr("*+?@!", *s)))
break;
else if (*s == '/')
- saw_slash = TRUE;
+ saw_slash = true;
}
if (!*s && (*toglob != '~' || saw_slash)) {
toglob[slen] = '*';
@@ -765,7 +765,7 @@ glob_table(const char *pat, XPtrV *wp, struct table *tp)
struct tbl *te;
for (twalk(&ts, tp); (te = tnext(&ts)); ) {
- if (gmatch(te->name, pat, FALSE))
+ if (gmatch(te->name, pat, false))
XPput(*wp, str_save(te->name, ATEMP));
}
}
diff --git a/bin/ksh/edit.h b/bin/ksh/edit.h
index 82c0b8ed31b..35ac63f5ea0 100644
--- a/bin/ksh/edit.h
+++ b/bin/ksh/edit.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.h,v 1.6 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: edit.h,v 1.7 2004/12/22 17:14:34 millert Exp $ */
/* NAME:
* edit.h - globals for edit modes
@@ -48,7 +48,7 @@ int x_getc(void);
void x_flush(void);
void x_putc(int);
void x_puts(const char *);
-bool_t x_mode(bool_t);
+bool x_mode(bool);
int promptlen(const char *, const char **);
int x_do_comment(char *, int, int *);
void x_print_expansions(int, char *const *, int);
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c
index 27a0ea623c6..8ae612417c6 100644
--- a/bin/ksh/emacs.c
+++ b/bin/ksh/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.32 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: emacs.c,v 1.33 2004/12/22 17:14:34 millert Exp $ */
/*
* Emacs-like command line editing and history
@@ -317,7 +317,7 @@ x_emacs(char *buf, size_t len)
xbp = xbuf = buf; xend = buf + len;
xlp = xcp = xep = buf;
*xcp = 0;
- xlp_valid = TRUE;
+ xlp_valid = true;
xmp = NULL;
x_curprefix = 0;
macroptr = (char *) 0;
@@ -371,7 +371,7 @@ x_emacs(char *buf, size_t len)
return i;
case KINTR: /* special case for interrupt */
trapsig(SIGINT);
- x_mode(FALSE);
+ x_mode(false);
unwind(LSHELL);
}
}
@@ -440,7 +440,7 @@ x_ins(char *s)
* x_zots() may result in a call to x_adjust()
* we want xcp to reflect the new position.
*/
- xlp_valid = FALSE;
+ xlp_valid = false;
x_lastcp();
x_adj_ok = (xcp >= xlp);
x_zots(cp);
@@ -480,7 +480,7 @@ x_del_back(int c)
if (x_arg > col)
x_arg = col;
x_goto(xcp - x_arg);
- x_delete(x_arg, FALSE);
+ x_delete(x_arg, false);
return KSTD;
}
@@ -495,7 +495,7 @@ x_del_char(int c)
}
if (x_arg > nleft)
x_arg = nleft;
- x_delete(x_arg, FALSE);
+ x_delete(x_arg, false);
return KSTD;
}
@@ -548,7 +548,7 @@ x_delete(int nc, int push)
}
/*x_goto(xcp);*/
x_adj_ok = 1;
- xlp_valid = FALSE;
+ xlp_valid = false;
for (cp = x_lastcp(); cp > xcp; )
x_bs(*--cp);
@@ -558,7 +558,7 @@ x_delete(int nc, int push)
static int
x_del_bword(int c)
{
- x_delete(x_bword(), TRUE);
+ x_delete(x_bword(), true);
return KSTD;
}
@@ -579,7 +579,7 @@ x_mv_fword(int c)
static int
x_del_fword(int c)
{
- x_delete(x_fword(), TRUE);
+ x_delete(x_fword(), true);
return KSTD;
}
@@ -837,7 +837,7 @@ x_load_hist(char **hp)
strlcpy(xbuf, *hp, xend - xbuf);
xbp = xbuf;
xep = xcp = xbuf + strlen(xbuf);
- xlp_valid = FALSE;
+ xlp_valid = false;
if (xep > x_lastcp())
x_goto(xep);
else
@@ -967,7 +967,7 @@ x_del_line(int c)
xcp = xbuf;
x_push(i);
xlp = xbp = xep = xbuf;
- xlp_valid = TRUE;
+ xlp_valid = true;
*xcp = 0;
xmp = NULL;
x_redraw(j);
@@ -1018,7 +1018,7 @@ x_redraw(int limit)
x_col = promptlen(prompt, (const char **) 0);
}
x_displen = xx_cols - 2 - x_col;
- xlp_valid = FALSE;
+ xlp_valid = false;
cp = x_lastcp();
x_zots(xbp);
if (xbp != xbuf || xep > xlp)
@@ -1144,7 +1144,7 @@ x_kill(int c)
x_goto(xbuf + x_arg);
ndel = -ndel;
}
- x_delete(ndel, TRUE);
+ x_delete(ndel, true);
return KSTD;
}
@@ -1189,7 +1189,7 @@ x_meta_yank(int c)
}
len = strlen(killstack[killtp]);
x_goto(xcp - len);
- x_delete(len, FALSE);
+ x_delete(len, false);
do {
if (killtp == 0)
killtp = KILLSIZE - 1;
@@ -1205,7 +1205,7 @@ x_abort(int c)
{
/* x_zotc(c); */
xlp = xep = xcp = xbp = xbuf;
- xlp_valid = TRUE;
+ xlp_valid = true;
*xcp = 0;
return KINTR;
}
@@ -1226,7 +1226,7 @@ x_stuffreset(int c)
#else
x_zotc(c);
xlp = xcp = xep = xbp = xbuf;
- xlp_valid = TRUE;
+ xlp_valid = true;
*xcp = 0;
x_redraw(-1);
return KSTD;
@@ -1238,7 +1238,7 @@ x_stuff(int c)
{
#ifdef TIOCSTI
char ch = c;
- bool_t savmode = x_mode(FALSE);
+ bool savmode = x_mode(false);
(void)ioctl(TTY, TIOCSTI, &ch);
(void)x_mode(savmode);
@@ -1481,7 +1481,7 @@ x_kill_region(int c)
xr = xmp;
}
x_goto(xr);
- x_delete(rsize, TRUE);
+ x_delete(rsize, true);
xmp = xr;
return KSTD;
}
@@ -1654,7 +1654,7 @@ x_expand(int c)
}
x_goto(xbuf + start);
- x_delete(end - start, FALSE);
+ x_delete(end - start, false);
for (i = 0; i < nwords;) {
if (x_escape(words[i], strlen(words[i]), x_emacs_putbuf) < 0 ||
(++i < nwords && x_ins(space) < 0))
@@ -1699,7 +1699,7 @@ do_complete(int flags, /* XCF_{COMMAND,FILE,COMMAND_FILE} */
/* complete */
if (nwords == 1 || nlen > olen) {
x_goto(xbuf + start);
- x_delete(olen, FALSE);
+ x_delete(olen, false);
x_escape(words[0], nlen, x_emacs_putbuf);
x_adjust();
completed = 1;
@@ -1744,7 +1744,7 @@ x_adjust(void)
*/
if ((xbp = xcp - (x_displen / 2)) < xbuf)
xbp = xbuf;
- xlp_valid = FALSE;
+ xlp_valid = false;
x_redraw(xx_cols);
x_flush();
}
@@ -2059,7 +2059,7 @@ x_lastcp(void)
i += x_size(*rcp);
xlp = rcp;
}
- xlp_valid = TRUE;
+ xlp_valid = true;
return (xlp);
}
diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c
index c14f5daaf27..86a5422a669 100644
--- a/bin/ksh/eval.c
+++ b/bin/ksh/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.21 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: eval.c,v 1.22 2004/12/22 17:14:34 millert Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -867,7 +867,7 @@ comsub(Expand *xp, char *cp)
shf = shf_fdopen(pv[0], SHF_RD, (struct shf *) 0);
ofd1 = savefd(1, 0); /* fd 1 may be closed... */
if (pv[1] != 1) {
- ksh_dup2(pv[1], 1, FALSE);
+ ksh_dup2(pv[1], 1, false);
close(pv[1]);
}
execute(t, XFORK|XXCOM|XPIPEO);
@@ -894,7 +894,7 @@ trimsub(char *str, char *pat, int how)
case '#': /* shortest at beginning */
for (p = str; p <= end; p++) {
c = *p; *p = '\0';
- if (gmatch(str, pat, FALSE)) {
+ if (gmatch(str, pat, false)) {
*p = c;
return p;
}
@@ -904,7 +904,7 @@ trimsub(char *str, char *pat, int how)
case '#'|0x80: /* longest match at beginning */
for (p = end; p >= str; p--) {
c = *p; *p = '\0';
- if (gmatch(str, pat, FALSE)) {
+ if (gmatch(str, pat, false)) {
*p = c;
return p;
}
@@ -913,13 +913,13 @@ trimsub(char *str, char *pat, int how)
break;
case '%': /* shortest match at end */
for (p = end; p >= str; p--) {
- if (gmatch(p, pat, FALSE))
+ if (gmatch(p, pat, false))
return str_nsave(str, p - str, ATEMP);
}
break;
case '%'|0x80: /* longest match at end */
for (p = str; p <= end; p++) {
- if (gmatch(p, pat, FALSE))
+ if (gmatch(p, pat, false))
return str_nsave(str, p - str, ATEMP);
}
break;
@@ -1080,7 +1080,7 @@ globit(XString *xs, /* dest string */
(name[1] == 0 || (name[1] == '.' && name[2] == 0)))
continue; /* always ignore . and .. */
if ((*name == '.' && *sp != '.')
- || !gmatch(name, sp, TRUE))
+ || !gmatch(name, sp, true))
continue;
len = strlen(d->d_name) + 1;
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index 0364b7a610e..c09ccd7a3ec 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.37 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: exec.c,v 1.38 2004/12/22 17:14:34 millert Exp $ */
/*
* execute command tree
@@ -18,7 +18,7 @@ static void scriptexec(struct op *, char **);
static int call_builtin(struct tbl *, char **);
static int iosetup(struct ioword *, struct tbl *);
static int herein(const char *, int);
-static char *do_selectargs(char **, bool_t);
+static char *do_selectargs(char **, bool);
static int dbteste_isa(Test_env *, Test_meta);
static const char *dbteste_getopnd(Test_env *, Test_op, int);
static int dbteste_eval(Test_env *, Test_op, const char *, const char *,
@@ -46,9 +46,9 @@ execute(struct op *volatile t,
/* Is this the end of a pipeline? If so, we want to evaluate the
* command arguments
- bool_t eval_done = FALSE;
+ bool eval_done = false;
if ((flags&XFORK) && !(flags&XEXEC) && (flags&XPCLOSE)) {
- eval_done = TRUE;
+ eval_done = true;
tp = eval_execute_args(t, &ap);
}
*/
@@ -122,18 +122,18 @@ execute(struct op *volatile t,
flags |= XFORK;
flags &= ~XEXEC;
e->savefd[0] = savefd(0, 0);
- (void) ksh_dup2(e->savefd[0], 0, FALSE); /* stdin of first */
+ (void) ksh_dup2(e->savefd[0], 0, false); /* stdin of first */
e->savefd[1] = savefd(1, 0);
while (t->type == TPIPE) {
openpipe(pv);
- (void) ksh_dup2(pv[1], 1, FALSE); /* stdout of curr */
+ (void) ksh_dup2(pv[1], 1, false); /* stdout of curr */
/* Let exchild() close pv[0] in child
* (if this isn't done, commands like
* (: ; cat /etc/termcap) | sleep 1
* will hang forever).
*/
exchild(t->left, flags|XPIPEO|XCCLOSE, pv[0]);
- (void) ksh_dup2(pv[0], 0, FALSE); /* stdin of next */
+ (void) ksh_dup2(pv[0], 0, false); /* stdin of next */
closepipe(pv);
flags |= XPIPEI;
t = t->right;
@@ -175,7 +175,7 @@ execute(struct op *volatile t,
errorf("coprocess already exists");
/* Can we re-use the existing co-process pipe? */
- coproc_cleanup(TRUE);
+ coproc_cleanup(true);
/* do this before opening pipes, in case these fail */
e->savefd[0] = savefd(0, 0);
@@ -183,18 +183,18 @@ execute(struct op *volatile t,
openpipe(pv);
if (pv[0] != 0) {
- ksh_dup2(pv[0], 0, FALSE);
+ ksh_dup2(pv[0], 0, false);
close(pv[0]);
}
coproc.write = pv[1];
coproc.job = (void *) 0;
if (coproc.readw >= 0)
- ksh_dup2(coproc.readw, 1, FALSE);
+ ksh_dup2(coproc.readw, 1, false);
else {
openpipe(pv);
coproc.read = pv[0];
- ksh_dup2(pv[1], 1, FALSE);
+ ksh_dup2(pv[1], 1, false);
coproc.readw = pv[1]; /* closed before first read */
coproc.njobs = 0;
/* create new coprocess id */
@@ -252,7 +252,7 @@ execute(struct op *volatile t,
case TFOR:
case TSELECT:
{
- volatile bool_t is_first = TRUE;
+ volatile bool is_first = true;
ap = (t->vars != NULL) ?
eval(t->vars, DOBLANK|DOGLOB|DOTILDE)
: e->loc->argv + 1;
@@ -283,7 +283,7 @@ execute(struct op *volatile t,
rv = 1;
break;
}
- is_first = FALSE;
+ is_first = false;
setstr(global(t->str), cp, KSH_UNWIND_ERROR);
rv = execute(t->left, flags & XERROK);
}
@@ -327,7 +327,7 @@ execute(struct op *volatile t,
for (t = t->left; t != NULL && t->type == TPAT; t = t->right)
for (ap = t->vars; *ap; ap++)
if ((s = evalstr(*ap, DOTILDE|DOPAT))
- && gmatch(cp, s, FALSE))
+ && gmatch(cp, s, false))
goto Found;
break;
Found:
@@ -449,7 +449,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
fcflags = FC_BI|FC_PATH;
if (saw_p) {
if (Flag(FRESTRICTED)) {
- warningf(TRUE,
+ warningf(true,
"command -p: restricted");
rv = 1;
goto Leave;
@@ -506,7 +506,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
goto Leave;
} else if (!tp) {
if (Flag(FRESTRICTED) && strchr(cp, '/')) {
- warningf(TRUE, "%s: restricted", cp);
+ warningf(true, "%s: restricted", cp);
rv = 1;
goto Leave;
}
@@ -529,28 +529,28 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
if (!tp->u.fpath) {
if (tp->u2.errno_) {
- warningf(TRUE,
+ warningf(true,
"%s: can't find function definition file - %s",
cp, strerror(tp->u2.errno_));
rv = 126;
} else {
- warningf(TRUE,
+ warningf(true,
"%s: can't find function definition file", cp);
rv = 127;
}
break;
}
if (include(tp->u.fpath, 0, (char **) 0, 0) < 0) {
- warningf(TRUE,
+ warningf(true,
"%s: can't open function definition file %s - %s",
cp, tp->u.fpath, strerror(errno));
rv = 127;
break;
}
- if (!(ftp = findfunc(cp, hash(cp), FALSE))
+ if (!(ftp = findfunc(cp, hash(cp), false))
|| !(ftp->flag & ISSET))
{
- warningf(TRUE,
+ warningf(true,
"%s: function not defined by %s",
cp, tp->u.fpath);
rv = 127;
@@ -581,7 +581,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
}
old_xflag = Flag(FXTRACE);
- Flag(FXTRACE) = tp->flag & TRACE ? TRUE : FALSE;
+ Flag(FXTRACE) = tp->flag & TRACE ? true : false;
old_inuse = tp->flag & FINUSE;
tp->flag |= FINUSE;
@@ -635,11 +635,11 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
* useful error message and set the exit status to 126.
*/
if (tp->u2.errno_) {
- warningf(TRUE, "%s: cannot execute - %s", cp,
+ warningf(true, "%s: cannot execute - %s", cp,
strerror(tp->u2.errno_));
rv = 126; /* POSIX */
} else {
- warningf(TRUE, "%s: not found", cp);
+ warningf(true, "%s: not found", cp);
rv = 127;
}
break;
@@ -743,7 +743,7 @@ define(const char *name, struct op *t)
int was_set = 0;
while (1) {
- tp = findfunc(name, hash(name), TRUE);
+ tp = findfunc(name, hash(name), true);
if (tp->flag & ISSET)
was_set = 1;
@@ -832,7 +832,7 @@ findcom(const char *name, int flags)
if ((flags & FC_SPECBI) && tbi && (tbi->flag & SPEC_BI))
tp = tbi;
if (!tp && (flags & FC_FUNC)) {
- tp = findfunc(name, h, FALSE);
+ tp = findfunc(name, h, false);
if (tp && !(tp->flag & ISSET)) {
if ((fpath = str_val(global("FPATH"))) == null) {
tp->u.fpath = (char *) 0;
@@ -1082,7 +1082,7 @@ iosetup(struct ioword *iop, struct tbl *tp)
X_OK | ((iop->flag & IORDUP) ? R_OK : W_OK),
&emsg)) < 0)
{
- warningf(TRUE, "%s: %s",
+ warningf(true, "%s: %s",
snptreef((char *) 0, 32, "%R", &iotmp), emsg);
return -1;
}
@@ -1093,7 +1093,7 @@ iosetup(struct ioword *iop, struct tbl *tp)
}
if (do_open) {
if (Flag(FRESTRICTED) && (flags & O_CREAT)) {
- warningf(TRUE, "%s: restricted", cp);
+ warningf(true, "%s: restricted", cp);
return -1;
}
u = open(cp, flags, 0666);
@@ -1101,7 +1101,7 @@ iosetup(struct ioword *iop, struct tbl *tp)
if (u < 0) {
/* herein() may already have printed message */
if (u == -1)
- warningf(TRUE, "cannot %s %s: %s",
+ warningf(true, "cannot %s %s: %s",
iotype == IODUP ? "dup"
: (iotype == IOREAD || iotype == IOHERE) ?
"open" : "create", cp, strerror(errno));
@@ -1125,8 +1125,8 @@ iosetup(struct ioword *iop, struct tbl *tp)
if (do_close)
close(iop->unit);
else if (u != iop->unit) {
- if (ksh_dup2(u, iop->unit, TRUE) < 0) {
- warningf(TRUE,
+ if (ksh_dup2(u, iop->unit, true) < 0) {
+ warningf(true,
"could not finish (dup) redirection %s: %s",
snptreef((char *) 0, 32, "%R", &iotmp),
strerror(errno));
@@ -1166,7 +1166,7 @@ herein(const char *content, int sub)
/* ksh -c 'cat << EOF' can cause this... */
if (content == (char *) 0) {
- warningf(TRUE, "here document missing");
+ warningf(true, "here document missing");
return -2; /* special to iosetup(): don't print error */
}
@@ -1175,7 +1175,7 @@ herein(const char *content, int sub)
*/
h = maketemp(ATEMP, TT_HEREDOC_EXP, &e->temps);
if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY, 0)) < 0) {
- warningf(TRUE, "can't %s temporary file %s: %s",
+ warningf(true, "can't %s temporary file %s: %s",
!shf ? "create" : "open",
h->name, strerror(errno));
if (shf)
@@ -1209,7 +1209,7 @@ herein(const char *content, int sub)
if (shf_close(shf) == EOF) {
close(fd);
- warningf(TRUE, "error writing %s: %s", h->name,
+ warningf(true, "error writing %s: %s", h->name,
strerror(errno));
return -2; /* special to iosetup(): don't print error */
}
@@ -1223,7 +1223,7 @@ herein(const char *content, int sub)
* print the args in column form - assuming that we can
*/
static char *
-do_selectargs(char **ap, bool_t print_menu)
+do_selectargs(char **ap, bool print_menu)
{
static const char *const read_args[] = {
"read", "-r", "REPLY", (char *) 0
diff --git a/bin/ksh/expr.c b/bin/ksh/expr.c
index 22ce0351d0f..dc96d981974 100644
--- a/bin/ksh/expr.c
+++ b/bin/ksh/expr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expr.c,v 1.14 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: expr.c,v 1.15 2004/12/22 17:14:34 millert Exp $ */
/*
* Korn expression evaluation
@@ -132,7 +132,7 @@ static void evalerr(Expr_state *, enum error_type, const char *)
__attribute__((__noreturn__));
static struct tbl *evalexpr(Expr_state *, enum prec);
static void token(Expr_state *);
-static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool_t);
+static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool);
static void assign_check(Expr_state *, enum token, struct tbl *);
static struct tbl *tempvar(void);
static struct tbl *intvar(Expr_state *, struct tbl *);
@@ -234,31 +234,31 @@ evalerr(Expr_state *es, enum error_type type, const char *str)
default:
s = opinfo[(int)es->tok].name;
}
- warningf(TRUE, "%s: unexpected `%s'", es->expression, s);
+ warningf(true, "%s: unexpected `%s'", es->expression, s);
break;
case ET_BADLIT:
- warningf(TRUE, "%s: bad number `%s'", es->expression, str);
+ warningf(true, "%s: bad number `%s'", es->expression, str);
break;
case ET_RECURSIVE:
- warningf(TRUE, "%s: expression recurses on parameter `%s'",
+ warningf(true, "%s: expression recurses on parameter `%s'",
es->expression, str);
break;
case ET_LVALUE:
- warningf(TRUE, "%s: %s requires lvalue",
+ warningf(true, "%s: %s requires lvalue",
es->expression, str);
break;
case ET_RDONLY:
- warningf(TRUE, "%s: %s applied to read only variable",
+ warningf(true, "%s: %s applied to read only variable",
es->expression, str);
break;
default: /* keep gcc happy */
case ET_STR:
- warningf(TRUE, "%s: %s", es->expression, str);
+ warningf(true, "%s: %s", es->expression, str);
break;
}
unwind(LAEXPR);
@@ -293,7 +293,7 @@ evalexpr(Expr_state *es, enum prec prec)
token(es);
} else if (op == O_PLUSPLUS || op == O_MINUSMINUS) {
token(es);
- vl = do_ppmm(es, op, es->val, TRUE);
+ vl = do_ppmm(es, op, es->val, true);
token(es);
} else if (op == VAR || op == LIT) {
vl = es->val;
@@ -303,7 +303,7 @@ evalexpr(Expr_state *es, enum prec prec)
/*NOTREACHED*/
}
if (es->tok == O_PLUSPLUS || es->tok == O_MINUSMINUS) {
- vl = do_ppmm(es, es->tok, vl, FALSE);
+ vl = do_ppmm(es, es->tok, vl, false);
token(es);
}
return vl;
@@ -514,7 +514,7 @@ token(Expr_state *es)
/* Do a ++ or -- operation */
static struct tbl *
-do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool_t is_prefix)
+do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool is_prefix)
{
struct tbl *vl;
int oval;
diff --git a/bin/ksh/history.c b/bin/ksh/history.c
index 9ff359bdc21..21eaff60dd5 100644
--- a/bin/ksh/history.c
+++ b/bin/ksh/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.28 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: history.c,v 1.29 2004/12/22 17:14:34 millert Exp $ */
/*
* command history
@@ -136,8 +136,8 @@ c_fc(char **wp)
return 1;
}
- hp = first ? hist_get(first, FALSE, FALSE)
- : hist_get_newest(FALSE);
+ hp = first ? hist_get(first, false, false)
+ : hist_get_newest(false);
if (!hp)
return 1;
return hist_replace(hp, pat, rep, gflag);
@@ -157,23 +157,23 @@ c_fc(char **wp)
return 1;
}
if (!first) {
- hfirst = lflag ? hist_get("-16", TRUE, TRUE)
- : hist_get_newest(FALSE);
+ hfirst = lflag ? hist_get("-16", true, true)
+ : hist_get_newest(false);
if (!hfirst)
return 1;
/* can't fail if hfirst didn't fail */
- hlast = hist_get_newest(FALSE);
+ hlast = hist_get_newest(false);
} else {
/* POSIX says not an error if first/last out of bounds
* when range is specified; at&t ksh and pdksh allow out of
* bounds for -l as well.
*/
- hfirst = hist_get(first, (lflag || last) ? TRUE : FALSE,
- lflag ? TRUE : FALSE);
+ hfirst = hist_get(first, (lflag || last) ? true : false,
+ lflag ? true : false);
if (!hfirst)
return 1;
- hlast = last ? hist_get(last, TRUE, lflag ? TRUE : FALSE)
- : (lflag ? hist_get_newest(FALSE) : hfirst);
+ hlast = last ? hist_get(last, true, lflag ? true : false)
+ : (lflag ? hist_get_newest(false) : hfirst);
if (!hlast)
return 1;
}
@@ -220,7 +220,7 @@ c_fc(char **wp)
}
/* Ignore setstr errors here (arbitrary) */
- setstr(local("_", FALSE), tf->name, KSH_RETURN_ERROR);
+ setstr(local("_", false), tf->name, KSH_RETURN_ERROR);
/* XXX: source should not get trashed by this.. */
{
diff --git a/bin/ksh/io.c b/bin/ksh/io.c
index 12e9c120935..baf7c79197a 100644
--- a/bin/ksh/io.c
+++ b/bin/ksh/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.18 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: io.c,v 1.19 2004/12/22 17:14:34 millert Exp $ */
/*
* shell buffered IO and formatted output
@@ -24,7 +24,7 @@ errorf(const char *fmt, ...)
shl_stdout_ok = 0; /* debugging: note that stdout not valid */
exstat = 1;
if (*fmt) {
- error_prefix(TRUE);
+ error_prefix(true);
va_start(va, fmt);
shf_vfprintf(shl_out, fmt, va);
va_end(va);
@@ -59,7 +59,7 @@ bi_errorf(const char *fmt, ...)
shl_stdout_ok = 0; /* debugging: note that stdout not valid */
exstat = 1;
if (*fmt) {
- error_prefix(TRUE);
+ error_prefix(true);
/* not set when main() calls parse_args() */
if (builtin_argv0)
shf_fprintf(shl_out, "%s: ", builtin_argv0);
@@ -87,7 +87,7 @@ internal_errorf(int jump, const char *fmt, ...)
{
va_list va;
- error_prefix(TRUE);
+ error_prefix(true);
shf_fprintf(shl_out, "internal error: ");
va_start(va, fmt);
shf_vfprintf(shl_out, fmt, va);
@@ -261,7 +261,7 @@ restfd(int fd, int ofd)
if (ofd < 0) /* original fd closed */
close(fd);
else if (fd != ofd) {
- ksh_dup2(ofd, fd, TRUE); /* XXX: what to do if this fails? */
+ ksh_dup2(ofd, fd, true); /* XXX: what to do if this fails? */
close(ofd);
}
}
diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index 52cf287bde8..ecd04520a06 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jobs.c,v 1.28 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: jobs.c,v 1.29 2004/12/22 17:14:34 millert Exp $ */
/*
* Process and job control
@@ -181,7 +181,7 @@ j_init(int mflagset)
else
#endif /* JOBS */
if (Flag(FTALKING))
- tty_init(TRUE);
+ tty_init(true);
}
/* job cleanup before shell exit */
@@ -247,13 +247,13 @@ j_change(void)
if (Flag(FMONITOR)) {
/* Don't call tcgetattr() 'til we own the tty process group */
- tty_init(FALSE);
+ tty_init(false);
/* no controlling tty, no SIGT* */
ttypgrp_ok = tty_fd >= 0 && tty_devtty;
if (ttypgrp_ok && (our_pgrp = getpgrp()) < 0) {
- warningf(FALSE, "j_init: getpgrp() failed: %s",
+ warningf(false, "j_init: getpgrp() failed: %s",
strerror(errno));
ttypgrp_ok = 0;
}
@@ -265,7 +265,7 @@ j_change(void)
pid_t ttypgrp;
if ((ttypgrp = tcgetpgrp(tty_fd)) < 0) {
- warningf(FALSE,
+ warningf(false,
"j_init: tcgetpgrp() failed: %s",
strerror(errno));
ttypgrp_ok = 0;
@@ -281,13 +281,13 @@ j_change(void)
SS_RESTORE_DFL|SS_FORCE);
if (ttypgrp_ok && our_pgrp != kshpid) {
if (setpgid(0, kshpid) < 0) {
- warningf(FALSE,
+ warningf(false,
"j_init: setpgid() failed: %s",
strerror(errno));
ttypgrp_ok = 0;
} else {
if (tcsetpgrp(tty_fd, kshpid) < 0) {
- warningf(FALSE,
+ warningf(false,
"j_init: tcsetpgrp() failed: %s",
strerror(errno));
ttypgrp_ok = 0;
@@ -297,7 +297,7 @@ j_change(void)
}
}
if (!ttypgrp_ok)
- warningf(FALSE, "warning: won't have full job control");
+ warningf(false, "warning: won't have full job control");
if (tty_fd >= 0)
tcgetattr(tty_fd, &tty_state);
} else {
@@ -428,7 +428,7 @@ exchild(struct op *t, int flags,
if (ischild) { /* child */
/* Do this before restoring signal */
if (flags & XCOPROC)
- coproc_cleanup(FALSE);
+ coproc_cleanup(false);
sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0);
cleanup_parents_env();
#ifdef JOBS
@@ -452,7 +452,7 @@ exchild(struct op *t, int flags,
if (!(flags & (XPIPEI | XCOPROC))) {
int fd = open("/dev/null", 0);
if (fd != 0) {
- (void) ksh_dup2(fd, 0, TRUE);
+ (void) ksh_dup2(fd, 0, true);
close(fd);
}
}
@@ -535,7 +535,7 @@ waitlast(void)
j = last_job;
if (!j || !(j->flags & JF_STARTED)) {
if (!j)
- warningf(TRUE, "waitlast: no last job");
+ warningf(true, "waitlast: no last job");
else
internal_errorf(0, "waitlast: not started");
sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0);
@@ -718,7 +718,7 @@ j_resume(const char *cp, int bg)
if (ttypgrp_ok && (j->flags & JF_SAVEDTTY))
tcsetattr(tty_fd, TCSADRAIN, &tty_state);
if (ttypgrp_ok && tcsetpgrp(tty_fd, our_pgrp) < 0) {
- warningf(TRUE,
+ warningf(true,
"fg: 2nd tcsetpgrp(%d, %d) failed: %s",
tty_fd, (int) our_pgrp,
strerror(errno));
@@ -996,7 +996,7 @@ j_waitj(Job *j,
&& (j->saved_ttypgrp = tcgetpgrp(tty_fd)) >= 0)
j->flags |= JF_SAVEDTTYPGRP;
if (tcsetpgrp(tty_fd, our_pgrp) < 0) {
- warningf(TRUE,
+ warningf(true,
"j_waitj: tcsetpgrp(%d, %d) failed: %s",
tty_fd, (int) our_pgrp,
strerror(errno));
@@ -1110,7 +1110,7 @@ j_sigchld(int sig)
found:
if (j == (Job *) 0) {
/* 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);
*/
t0 = t1;
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index 0799df78b08..7623122a389 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.28 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: lex.c,v 1.29 2004/12/22 17:14:34 millert Exp $ */
/*
* lexical analysis and source input
@@ -193,7 +193,7 @@ yylex(int cf)
if (h >= 0)
replace = &history[h];
} else {
- int h = findhist(-1, 0, match, TRUE);
+ int h = findhist(-1, 0, match, true);
if (h >= 0)
replace = &history[h];
}
@@ -222,7 +222,7 @@ yylex(int cf)
}
if (c == '[' && (cf & (VARASN|ARRAYVAR))) {
*wp = EOS; /* temporary */
- if (is_wdvarname(Xstring(ws, wp), FALSE))
+ if (is_wdvarname(Xstring(ws, wp), false))
{
char *p, *tmp;
@@ -889,7 +889,7 @@ yyerror(const char *fmt, ...)
source = source->next;
source->str = null; /* zap pending input */
- error_prefix(TRUE);
+ error_prefix(true);
va_start(va, fmt);
shf_vfprintf(shl_out, fmt, va);
va_end(va);
diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c
index 22853ccb913..a65fe543238 100644
--- a/bin/ksh/mail.c
+++ b/bin/ksh/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.13 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: mail.c,v 1.14 2004/12/22 17:14:34 millert Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -188,7 +188,7 @@ mprintit(mbox_t *mbp)
if (!Flag(FSH))
#endif
/* Ignore setstr errors here (arbitrary) */
- setstr((vp = local("_", FALSE)), mbp->mb_path, KSH_RETURN_ERROR);
+ setstr((vp = local("_", false)), mbp->mb_path, KSH_RETURN_ERROR);
shellf("%s\n", substitute(mbp->mb_msg ? mbp->mb_msg : MBMESSAGE, 0));
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index eb9bbb8947f..2c63385602a 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.33 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: main.c,v 1.34 2004/12/22 17:14:34 millert Exp $ */
/*
* startup, main loop, environments and error handling
@@ -322,7 +322,7 @@ main(int argc, char *argv[])
* user will know why things broke.
*/
if (!current_wd[0] && Flag(FTALKING))
- warningf(FALSE, "Cannot determine current working directory");
+ warningf(false, "Cannot determine current working directory");
if (Flag(FLOGIN)) {
include(KSH_SYSTEM_PROFILE, 0, (char **) 0, 1);
@@ -370,7 +370,7 @@ main(int argc, char *argv[])
} else
Flag(FTRACKALL) = 1; /* set after ENV */
- shell(s, TRUE); /* doesn't return */
+ shell(s, true); /* doesn't return */
return 0;
}
@@ -432,7 +432,7 @@ include(const char *name, int argc, char **argv, int intr_ok)
s = pushs(SFILE, ATEMP);
s->u.shf = shf;
s->file = str_save(name, ATEMP);
- i = shell(s, FALSE);
+ i = shell(s, false);
shf_close(s->u.shf);
quitenv();
if (old_argv) {
@@ -449,7 +449,7 @@ command(const char *comm)
s = pushs(SSTRING, ATEMP);
s->start = s->str = comm;
- return shell(s, FALSE);
+ return shell(s, false);
}
/*
diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c
index ea7c8338521..03c03b053f1 100644
--- a/bin/ksh/misc.c
+++ b/bin/ksh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.24 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: misc.c,v 1.25 2004/12/22 17:14:34 millert Exp $ */
/*
* Miscellaneous functions
@@ -432,7 +432,7 @@ parse_args(char **argv,
*setargsp = !arrayset && ((go.info & GI_MINUSMINUS)
|| argv[go.optind]);
- if (arrayset && (!*array || *skip_varname(array, FALSE))) {
+ if (arrayset && (!*array || *skip_varname(array, false))) {
bi_errorf("%s: is not an identifier", array);
return -1;
}
@@ -944,7 +944,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options)
go->buf[0] = c;
go->optarg = go->buf;
} else {
- warningf(TRUE, "%s%s-%c: unknown option",
+ warningf(true, "%s%s-%c: unknown option",
(go->flags & GF_NONAME) ? "" : argv[0],
(go->flags & GF_NONAME) ? "" : ": ", c);
if (go->flags & GF_ERROR)
@@ -970,7 +970,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options)
go->optarg = go->buf;
return ':';
}
- warningf(TRUE, "%s%s-`%c' requires argument",
+ warningf(true, "%s%s-`%c' requires argument",
(go->flags & GF_NONAME) ? "" : argv[0],
(go->flags & GF_NONAME) ? "" : ": ", c);
if (go->flags & GF_ERROR)
diff --git a/bin/ksh/proto.h b/bin/ksh/proto.h
index 526f12d3bda..d481d58aeb7 100644
--- a/bin/ksh/proto.h
+++ b/bin/ksh/proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.h,v 1.20 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: proto.h,v 1.21 2004/12/22 17:14:34 millert Exp $ */
/*
* prototypes for PD-KSH
@@ -244,7 +244,7 @@ void newblock(void);
void popblock(void);
void initvar(void);
struct tbl * global(const char *);
-struct tbl * local(const char *, bool_t);
+struct tbl * local(const char *, bool);
char * str_val(struct tbl *);
long intval(struct tbl *);
int setstr(struct tbl *, const char *, int);
diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h
index 65b083cfbee..9b017c48d8c 100644
--- a/bin/ksh/sh.h
+++ b/bin/ksh/sh.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh.h,v 1.24 2004/12/18 22:43:58 millert Exp $ */
+/* $OpenBSD: sh.h,v 1.25 2004/12/22 17:14:34 millert Exp $ */
/*
* Public Domain Bourne/Korn shell
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <setjmp.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
@@ -47,10 +48,6 @@
#define EXECSHELL _PATH_BSHELL
#define EXECSHELL_STR "EXECSHELL"
-typedef int bool_t;
-#define FALSE 0
-#define TRUE 1
-
#define NELEM(a) (sizeof(a) / sizeof((a)[0]))
#define sizeofN(type, n) (sizeof(type) * (n))
#define BIT(i) (1<<(i)) /* define bit in flag */
diff --git a/bin/ksh/syn.c b/bin/ksh/syn.c
index d97fedadc54..a3723feb08f 100644
--- a/bin/ksh/syn.c
+++ b/bin/ksh/syn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syn.c,v 1.19 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: syn.c,v 1.20 2004/12/22 17:14:34 millert Exp $ */
/*
* shell parser (C version)
@@ -182,7 +182,7 @@ nested(int type, int smark, int emark)
struct nesting_state old_nesting;
nesting_push(&old_nesting, smark);
- t = c_list(TRUE);
+ t = c_list(true);
musthave(emark, KEYWORD|ALIAS);
nesting_pop(&old_nesting);
return (block(type, t, NOBLOCK, NOWORDS));
@@ -259,7 +259,7 @@ get_command(int cf)
ACCEPT;
/*(*/
musthave(')', 0);
- t = function_body(XPptrv(args)[0], FALSE);
+ t = function_body(XPptrv(args)[0], false);
goto Leave;
default:
@@ -314,7 +314,7 @@ get_command(int cf)
case SELECT:
t = newtp((c == FOR) ? TFOR : TSELECT);
musthave(LWORD, ARRAYVAR);
- if (!is_wdvarname(yylval.cp, TRUE))
+ if (!is_wdvarname(yylval.cp, true))
yyerror("%s: bad identifier\n",
c == FOR ? "for" : "select");
t->str = str_save(ident, ATEMP);
@@ -328,7 +328,7 @@ get_command(int cf)
case UNTIL:
nesting_push(&old_nesting, c);
t = newtp((c == WHILE) ? TWHILE : TUNTIL);
- t->left = c_list(TRUE);
+ t->left = c_list(true);
t->right = dogroup();
nesting_pop(&old_nesting);
break;
@@ -345,7 +345,7 @@ get_command(int cf)
case IF:
nesting_push(&old_nesting, c);
t = newtp(TIF);
- t->left = c_list(TRUE);
+ t->left = c_list(true);
t->right = thenpart();
musthave(FI, KEYWORD|ALIAS);
nesting_pop(&old_nesting);
@@ -367,7 +367,7 @@ get_command(int cf)
case FUNCTION:
musthave(LWORD, 0);
- t = function_body(yylval.cp, TRUE);
+ t = function_body(yylval.cp, true);
break;
}
@@ -418,7 +418,7 @@ dogroup(void)
c = '}';
else
syntaxerr((char *) 0);
- list = c_list(TRUE);
+ list = c_list(true);
musthave(c, KEYWORD|ALIAS);
return list;
}
@@ -430,7 +430,7 @@ thenpart(void)
musthave(THEN, KEYWORD|ALIAS);
t = newtp(0);
- t->left = c_list(TRUE);
+ t->left = c_list(true);
if (t->left == NULL)
syntaxerr((char *) 0);
t->right = elsepart();
@@ -444,13 +444,13 @@ elsepart(void)
switch (token(KEYWORD|ALIAS|VARASN)) {
case ELSE:
- if ((t = c_list(TRUE)) == NULL)
+ if ((t = c_list(true)) == NULL)
syntaxerr((char *) 0);
return (t);
case ELIF:
t = newtp(TELIF);
- t->left = c_list(TRUE);
+ t->left = c_list(true);
t->right = thenpart();
return (t);
@@ -507,7 +507,7 @@ casepart(int endtok)
t->vars = (char **) XPclose(ptns);
musthave(')', 0);
- t->left = c_list(TRUE);
+ t->left = c_list(true);
/* Note: Posix requires the ;; */
if ((tpeek(CONTIN|KEYWORD|ALIAS)) != endtok)
musthave(BREAK, CONTIN|KEYWORD|ALIAS);
@@ -622,34 +622,34 @@ const struct tokeninfo {
short reserved;
} tokentab[] = {
/* Reserved words */
- { "if", IF, TRUE },
- { "then", THEN, TRUE },
- { "else", ELSE, TRUE },
- { "elif", ELIF, TRUE },
- { "fi", FI, TRUE },
- { "case", CASE, TRUE },
- { "esac", ESAC, TRUE },
- { "for", FOR, TRUE },
- { "select", SELECT, TRUE },
- { "while", WHILE, TRUE },
- { "until", UNTIL, TRUE },
- { "do", DO, TRUE },
- { "done", DONE, TRUE },
- { "in", IN, TRUE },
- { "function", FUNCTION, TRUE },
- { "time", TIME, TRUE },
- { "{", '{', TRUE },
- { "}", '}', TRUE },
- { "!", BANG, TRUE },
- { "[[", DBRACKET, TRUE },
+ { "if", IF, true },
+ { "then", THEN, true },
+ { "else", ELSE, true },
+ { "elif", ELIF, true },
+ { "fi", FI, true },
+ { "case", CASE, true },
+ { "esac", ESAC, true },
+ { "for", FOR, true },
+ { "select", SELECT, true },
+ { "while", WHILE, true },
+ { "until", UNTIL, true },
+ { "do", DO, true },
+ { "done", DONE, true },
+ { "in", IN, true },
+ { "function", FUNCTION, true },
+ { "time", TIME, true },
+ { "{", '{', true },
+ { "}", '}', true },
+ { "!", BANG, true },
+ { "[[", DBRACKET, true },
/* Lexical tokens (0[EOF], LWORD and REDIR handled specially) */
- { "&&", LOGAND, FALSE },
- { "||", LOGOR, FALSE },
- { ";;", BREAK, FALSE },
- { "((", MDPAREN, FALSE },
- { "|&", COPROC, FALSE },
+ { "&&", LOGAND, false },
+ { "||", LOGOR, false },
+ { ";;", BREAK, false },
+ { "((", MDPAREN, false },
+ { "|&", COPROC, false },
/* and some special cases... */
- { "newline", '\n', FALSE },
+ { "newline", '\n', false },
{ 0 }
};
diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c
index 18fee382e88..57ecc3227c7 100644
--- a/bin/ksh/trap.c
+++ b/bin/ksh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.17 2004/12/18 21:58:39 millert Exp $ */
+/* $OpenBSD: trap.c,v 1.18 2004/12/22 17:14:34 millert Exp $ */
/*
* signal handling
@@ -189,7 +189,7 @@ runtraps(flag)
if (ksh_tmout_state == TMOUT_LEAVING) {
ksh_tmout_state = TMOUT_EXECUTING;
- warningf(FALSE, "timed out waiting for input");
+ warningf(false, "timed out waiting for input");
unwind(LEXIT);
} else
/* XXX: this means the alarm will have no effect if a trap
diff --git a/bin/ksh/tty.c b/bin/ksh/tty.c
index f5748d3aa96..20953494acb 100644
--- a/bin/ksh/tty.c
+++ b/bin/ksh/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.6 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: tty.c,v 1.7 2004/12/22 17:14:34 millert Exp $ */
#include "sh.h"
#include <sys/stat.h>
@@ -25,7 +25,7 @@ tty_init(int init_ttystate)
if (tfd < 0) {
tty_devtty = 0;
- warningf(FALSE,
+ warningf(false,
"No controlling tty (open /dev/tty: %s)",
strerror(errno));
}
@@ -38,15 +38,15 @@ tty_init(int init_ttystate)
else if (isatty(2))
tfd = 2;
else {
- warningf(FALSE, "Can't find tty file descriptor");
+ warningf(false, "Can't find tty file descriptor");
return;
}
}
if ((tty_fd = fcntl(tfd, F_DUPFD, FDBASE)) < 0) {
- warningf(FALSE, "j_ttyinit: dup of tty fd failed: %s",
+ warningf(false, "j_ttyinit: dup of tty fd failed: %s",
strerror(errno));
} else if (fcntl(tty_fd, F_SETFD, FD_CLOEXEC) < 0) {
- warningf(FALSE, "j_ttyinit: can't set close-on-exec flag: %s",
+ warningf(false, "j_ttyinit: can't set close-on-exec flag: %s",
strerror(errno));
close(tty_fd);
tty_fd = -1;
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index e43b98b3cf4..88c51a77613 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.21 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: var.c,v 1.22 2004/12/22 17:14:34 millert Exp $ */
#include "sh.h"
#include <time.h>
@@ -123,22 +123,22 @@ initvar(void)
* non-zero if this is an array, sets *valp to the array index, returns
* the basename of the array.
*/
-const char *array_index_calc(const char *n, bool_t *arrayp, int *valp);
+const char *array_index_calc(const char *n, bool *arrayp, int *valp);
const char *
-array_index_calc(const char *n, bool_t *arrayp, int *valp)
+array_index_calc(const char *n, bool *arrayp, int *valp)
{
const char *p;
int len;
- *arrayp = FALSE;
- p = skip_varname(n, FALSE);
+ *arrayp = false;
+ p = skip_varname(n, false);
if (p != n && *p == '[' && (len = array_ref_len(p))) {
char *sub, *tmp;
long rval;
/* Calculate the value of the subscript */
- *arrayp = TRUE;
+ *arrayp = true;
tmp = str_nsave(p+1, len-2, ATEMP);
sub = substitute(tmp, 0);
afree(tmp, ATEMP);
@@ -162,7 +162,7 @@ global(const char *n)
struct tbl *vp;
int c;
unsigned h;
- bool_t array;
+ bool array;
int val;
/* Check to see if this is an array */
@@ -238,12 +238,12 @@ global(const char *n)
* Search for local variable, if not found create locally.
*/
struct tbl *
-local(const char *n, bool_t copy)
+local(const char *n, bool copy)
{
struct block *l = e->loc;
struct tbl *vp;
unsigned h;
- bool_t array;
+ bool array;
int val;
/* Check to see if this is an array */
@@ -349,7 +349,7 @@ setstr(struct tbl *vq, const char *s, int error_ok)
int no_ro_check = error_ok & 0x4;
error_ok &= ~0x4;
if ((vq->flag & RDONLY) && !no_ro_check) {
- warningf(TRUE, "%s: is read only", vq->name);
+ warningf(true, "%s: is read only", vq->name);
if (!error_ok)
errorf(null);
return 0;
@@ -359,7 +359,7 @@ setstr(struct tbl *vq, const char *s, int error_ok)
/* debugging */
if (s >= vq->val.s
&& s <= vq->val.s + strlen(vq->val.s))
- internal_errorf(TRUE,
+ internal_errorf(true,
"setstr: %s=%s: assigning to self",
vq->name, s);
afree((void*)vq->val.s, vq->areap);
@@ -575,7 +575,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
const char *val;
/* check for valid variable name, search for value */
- val = skip_varname(var, FALSE);
+ val = skip_varname(var, false);
if (val == var)
return NULL;
if (*val == '[') {
@@ -614,7 +614,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
|| strcmp(tvar, "SHELL") == 0))
errorf("%s: restricted", tvar);
- vp = (set&LOCAL) ? local(tvar, (set & LOCAL_COPY) ? TRUE : FALSE)
+ vp = (set&LOCAL) ? local(tvar, (set & LOCAL_COPY) ? true : false)
: global(tvar);
set &= ~(LOCAL|LOCAL_COPY);
@@ -804,7 +804,7 @@ is_wdvarname(const char *s, int aok)
int
is_wdvarassign(const char *s)
{
- char *p = skip_wdvarname(s, TRUE);
+ char *p = skip_wdvarname(s, true);
return p != s && p[0] == CHAR && p[1] == '=';
}
diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
index d79f27eff66..05077d50bba 100644
--- a/bin/ksh/vi.c
+++ b/bin/ksh/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.17 2004/12/20 11:34:26 otto Exp $ */
+/* $OpenBSD: vi.c,v 1.18 2004/12/22 17:14:34 millert Exp $ */
/*
* vi command editing
@@ -218,7 +218,7 @@ x_vi(char *buf, size_t len)
x_vi_zotc(c);
x_flush();
trapsig(c == edchars.intr ? SIGINT : SIGQUIT);
- x_mode(FALSE);
+ x_mode(false);
unwind(LSHELL);
} else if (c == edchars.eof && state != VVERSION) {
if (es->linelen == 0) {