diff --git a/eval.c b/eval.c index dfbb764..ccc98a4 100644 --- a/eval.c +++ b/eval.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.35 2007/09/09 18:06:39 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.36 2007/10/25 15:34:29 tg Exp $"); #ifdef MKSH_SMALL #define MKSH_NOPWNAM @@ -1243,9 +1243,7 @@ tilde(char *cp) dp = homedir(cp); #endif /* If HOME, PWD or OLDPWD are not set, don't expand ~ */ - if (dp == null) - dp = NULL; - return dp; + return (dp == null ? NULL : dp); } #ifndef MKSH_NOPWNAM diff --git a/histrap.c b/histrap.c index c83e6dc..2735953 100644 --- a/histrap.c +++ b/histrap.c @@ -3,7 +3,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.56 2007/09/09 19:12:09 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.57 2007/10/25 15:34:30 tg Exp $"); Trap sigtraps[NSIG + 1]; static struct sigaction Sigact_ign; @@ -377,9 +377,7 @@ hist_get_newest(int allow_cur) bi_errorf("no history (yet)"); return NULL; } - if (allow_cur) - return histptr; - return histptr - 1; + return (allow_cur ? histptr : histptr - 1); } /* Return a pointer to the newest command in the history */ @@ -421,7 +419,7 @@ histpos(void) int histnum(int n) { - int last = histptr - history; + int last = histptr - history; if (n < 0 || n >= last) { current = histptr; diff --git a/syn.c b/syn.c index debc16b..5d3a31b 100644 --- a/syn.c +++ b/syn.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.17 2007/08/19 23:12:23 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.18 2007/10/25 15:34:30 tg Exp $"); struct nesting_state { int start_token; /* token than began nesting (eg, FOR) */ @@ -14,7 +14,6 @@ static struct op *pipeline(int); static struct op *andor(void); static struct op *c_list(int); static struct ioword *synio(int); -static void musthave(int, int); static struct op *nested(int, int, int); static struct op *get_command(int); static struct op *dogroup(void); @@ -49,6 +48,7 @@ static int symbol; /* yylex value */ #define ACCEPT (reject = 0) #define token(cf) ((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf))) #define tpeek(cf) ((reject) ? (symbol) : (REJECT, symbol = yylex(cf))) +#define musthave(c,cf) do { if (token(cf) != (c)) syntaxerr(NULL); } while (0) static void yyparse(void) @@ -164,13 +164,6 @@ synio(int cf) return iop; } -static void -musthave(int c, int cf) -{ - if ((token(cf)) != c) - syntaxerr(NULL); -} - static struct op * nested(int type, int smark, int emark) {