some int->bool, KNF, ...
This commit is contained in:
parent
31d2796169
commit
d2b5538f55
8
exec.c
8
exec.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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 **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile, volatile int *);
|
int volatile, volatile int *);
|
||||||
@ -811,13 +811,13 @@ int
|
|||||||
define(const char *name, struct op *t)
|
define(const char *name, struct op *t)
|
||||||
{
|
{
|
||||||
struct tbl *tp;
|
struct tbl *tp;
|
||||||
int was_set = 0;
|
bool was_set = false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tp = findfunc(name, hash(name), true);
|
tp = findfunc(name, hash(name), true);
|
||||||
|
|
||||||
if (tp->flag & ISSET)
|
if (tp->flag & ISSET)
|
||||||
was_set = 1;
|
was_set = true;
|
||||||
/* If this function is currently being executed, we zap this
|
/* If this function is currently being executed, we zap this
|
||||||
* table entry so findfunc() won't see it
|
* table entry so findfunc() won't see it
|
||||||
*/
|
*/
|
||||||
@ -836,7 +836,7 @@ define(const char *name, struct op *t)
|
|||||||
|
|
||||||
if (t == NULL) { /* undefine */
|
if (t == NULL) { /* undefine */
|
||||||
ktdelete(tp);
|
ktdelete(tp);
|
||||||
return was_set ? 0 : 1;
|
return (was_set ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
tp->val.t = tcopy(t->left, tp->areap);
|
tp->val.t = tcopy(t->left, tp->areap);
|
||||||
|
7
lex.c
7
lex.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
* states while lexing word
|
||||||
@ -78,11 +78,10 @@ struct lex_state {
|
|||||||
} ls_info;
|
} ls_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct State_info State_info;
|
typedef struct {
|
||||||
struct State_info {
|
|
||||||
Lex_state *base;
|
Lex_state *base;
|
||||||
Lex_state *end;
|
Lex_state *end;
|
||||||
};
|
} State_info;
|
||||||
|
|
||||||
static void readhere(struct ioword *);
|
static void readhere(struct ioword *);
|
||||||
static int getsc__(void);
|
static int getsc__(void);
|
||||||
|
9
syn.c
9
syn.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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 {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -107,8 +107,7 @@ static struct op *
|
|||||||
c_list(int multi)
|
c_list(int multi)
|
||||||
{
|
{
|
||||||
struct op *t = NULL, *p, *tl = NULL;
|
struct op *t = NULL, *p, *tl = NULL;
|
||||||
int c;
|
int c, have_sep;
|
||||||
int have_sep;
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
p = andor();
|
p = andor();
|
||||||
@ -145,7 +144,7 @@ synio(int cf)
|
|||||||
{
|
{
|
||||||
struct ioword *iop;
|
struct ioword *iop;
|
||||||
static struct ioword *nextiop = NULL;
|
static struct ioword *nextiop = NULL;
|
||||||
int ishere;
|
bool ishere;
|
||||||
|
|
||||||
if (nextiop != NULL) {
|
if (nextiop != NULL) {
|
||||||
iop = nextiop;
|
iop = nextiop;
|
||||||
@ -581,7 +580,7 @@ function_body(char *name,
|
|||||||
{
|
{
|
||||||
char *sname, *p;
|
char *sname, *p;
|
||||||
struct op *t;
|
struct op *t;
|
||||||
int old_func_parse;
|
bool old_func_parse;
|
||||||
|
|
||||||
sname = wdstrip(name, false, false);
|
sname = wdstrip(name, false, false);
|
||||||
/* Check for valid characters in name. posix and ksh93 say only
|
/* Check for valid characters in name. posix and ksh93 say only
|
||||||
|
11
tree.c
11
tree.c
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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 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 ptree(struct op *, int, struct shf *);
|
||||||
static void pioact(struct shf *, int, struct ioword *);
|
static void pioact(struct shf *, int, struct ioword *);
|
||||||
static void tputC(int, struct shf *);
|
static void tputC(int, struct shf *);
|
||||||
@ -252,7 +252,8 @@ tputC(int c, struct shf *shf)
|
|||||||
static void
|
static void
|
||||||
tputS(char *wp, struct shf *shf)
|
tputS(char *wp, struct shf *shf)
|
||||||
{
|
{
|
||||||
int c, quoted=0;
|
int c;
|
||||||
|
bool quoted = false;
|
||||||
|
|
||||||
/* problems:
|
/* problems:
|
||||||
* `...` -> $(...)
|
* `...` -> $(...)
|
||||||
@ -290,11 +291,11 @@ tputS(char *wp, struct shf *shf)
|
|||||||
wp++;
|
wp++;
|
||||||
break;
|
break;
|
||||||
case OQUOTE:
|
case OQUOTE:
|
||||||
quoted = 1;
|
quoted = true;
|
||||||
tputc('"', shf);
|
tputc('"', shf);
|
||||||
break;
|
break;
|
||||||
case CQUOTE:
|
case CQUOTE:
|
||||||
quoted = 0;
|
quoted = false;
|
||||||
tputc('"', shf);
|
tputc('"', shf);
|
||||||
break;
|
break;
|
||||||
case OSUBST:
|
case OSUBST:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user