some int->bool, KNF, ...

This commit is contained in:
tg 2009-04-07 19:13:11 +00:00
parent 31d2796169
commit d2b5538f55
4 changed files with 17 additions and 18 deletions

8
exec.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.53 2009/03/22 18:28:34 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.54 2009/04/07 19:13:09 tg Exp $");
static int comexec(struct op *, struct tbl *volatile, const char **,
int volatile, volatile int *);
@ -811,13 +811,13 @@ int
define(const char *name, struct op *t)
{
struct tbl *tp;
int was_set = 0;
bool was_set = false;
while (1) {
tp = findfunc(name, hash(name), true);
if (tp->flag & ISSET)
was_set = 1;
was_set = true;
/* If this function is currently being executed, we zap this
* table entry so findfunc() won't see it
*/
@ -836,7 +836,7 @@ define(const char *name, struct op *t)
if (t == NULL) { /* undefine */
ktdelete(tp);
return was_set ? 0 : 1;
return (was_set ? 0 : 1);
}
tp->val.t = tcopy(t->left, tp->areap);

7
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.81 2009/04/07 19:06:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.82 2009/04/07 19:13:10 tg Exp $");
/*
* states while lexing word
@ -78,11 +78,10 @@ struct lex_state {
} ls_info;
};
typedef struct State_info State_info;
struct State_info {
typedef struct {
Lex_state *base;
Lex_state *end;
};
} State_info;
static void readhere(struct ioword *);
static int getsc__(void);

9
syn.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.33 2009/04/07 19:06:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.34 2009/04/07 19:13:11 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -107,8 +107,7 @@ static struct op *
c_list(int multi)
{
struct op *t = NULL, *p, *tl = NULL;
int c;
int have_sep;
int c, have_sep;
while (1) {
p = andor();
@ -145,7 +144,7 @@ synio(int cf)
{
struct ioword *iop;
static struct ioword *nextiop = NULL;
int ishere;
bool ishere;
if (nextiop != NULL) {
iop = nextiop;
@ -581,7 +580,7 @@ function_body(char *name,
{
char *sname, *p;
struct op *t;
int old_func_parse;
bool old_func_parse;
sname = wdstrip(name, false, false);
/* Check for valid characters in name. posix and ksh93 say only

11
tree.c
View File

@ -2,11 +2,11 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.24 2008/12/13 17:02:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.25 2009/04/07 19:13:11 tg Exp $");
#define INDENT 4
#define tputc(c, shf) shf_putchar(c, shf);
#define tputc(c, shf) shf_putchar(c, shf);
static void ptree(struct op *, int, struct shf *);
static void pioact(struct shf *, int, struct ioword *);
static void tputC(int, struct shf *);
@ -252,7 +252,8 @@ tputC(int c, struct shf *shf)
static void
tputS(char *wp, struct shf *shf)
{
int c, quoted=0;
int c;
bool quoted = false;
/* problems:
* `...` -> $(...)
@ -290,11 +291,11 @@ tputS(char *wp, struct shf *shf)
wp++;
break;
case OQUOTE:
quoted = 1;
quoted = true;
tputc('"', shf);
break;
case CQUOTE:
quoted = 0;
quoted = false;
tputc('"', shf);
break;
case OSUBST: