Use stdbool.h instead of rolling our own bools.

From: Todd C. Miller <millert@cvs.openbsd.org>

XXX #ifndef HAVE_STDBOOL_H ?
This commit is contained in:
tg
2004-12-28 22:32:09 +00:00
parent cddaa62a46
commit 0114af375d
22 changed files with 231 additions and 235 deletions

80
syn.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/syn.c,v 2.4 2004/12/18 19:22:30 tg Exp $ */
/** $MirBSD: src/bin/ksh/syn.c,v 2.5 2004/12/28 22:32:08 tg Exp $ */
/* $OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include "c_test.h"
__RCSID("$MirBSD: src/bin/ksh/syn.c,v 2.4 2004/12/18 19:22:30 tg Exp $");
__RCSID("$MirBSD: src/bin/ksh/syn.c,v 2.5 2004/12/28 22:32:08 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -188,7 +188,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));
@ -265,7 +265,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:
@ -320,7 +320,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);
@ -334,7 +334,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;
@ -351,7 +351,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);
@ -373,7 +373,7 @@ get_command(int cf)
case FUNCTION:
musthave(LWORD, 0);
t = function_body(yylval.cp, TRUE);
t = function_body(yylval.cp, true);
break;
}
@ -424,7 +424,7 @@ dogroup(void)
c = '}';
else
syntaxerr(NULL);
list = c_list(TRUE);
list = c_list(true);
musthave(c, KEYWORD|ALIAS);
return list;
}
@ -436,7 +436,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(NULL);
t->right = elsepart();
@ -450,13 +450,13 @@ elsepart(void)
switch (token(KEYWORD|ALIAS|VARASN)) {
case ELSE:
if ((t = c_list(TRUE)) == NULL)
if ((t = c_list(true)) == NULL)
syntaxerr(NULL);
return (t);
case ELIF:
t = newtp(TELIF);
t->left = c_list(TRUE);
t->left = c_list(true);
t->right = thenpart();
return (t);
@ -513,7 +513,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);
@ -629,35 +629,35 @@ 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 },
{ NULL, 0, FALSE }
{ "newline", '\n', false },
{ NULL, 0, false }
};
void