diff --git a/check.t b/check.t index 4dc0015..111cac8 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.229 2008/10/10 21:30:41 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.230 2008/10/13 23:06:01 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R35 2008/10/10 + @(#)MIRBSD KSH R35 2008/10/13 description: Check version of shell. stdin: diff --git a/edit.c b/edit.c index c3c1cdb..e8008d6 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.137 2008/10/05 16:06:43 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.138 2008/10/13 23:06:02 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -1517,7 +1517,7 @@ x_emacs(char *buf, size_t len) } i = c | (x_curprefix << 8); x_curprefix = 0; - switch (i = (*x_ftab[f].xf_func)(i)) { + switch ((*x_ftab[f].xf_func)(i)) { case KSTD: if (!(x_ftab[f].xf_flags & XF_PREFIX)) x_last_command = f; @@ -1727,7 +1727,6 @@ x_delete(int nc, int push) x_push(nb); xep -= nb; - cp = xcp; memmove(xcp, xcp + nb, xep - xcp + 1); /* Copies the NUL */ x_adj_ok = 0; /* don't redraw */ xlp_valid = false; @@ -2332,7 +2331,7 @@ x_redraw(int limit) x_displen = xx_cols - 2; } xlp_valid = false; - cp = x_lastcp(); + x_lastcp(); x_zots(xbp); if (xbp != xbuf || xep > xlp) limit = xx_cols; diff --git a/histrap.c b/histrap.c index 20bab98..3bd237d 100644 --- a/histrap.c +++ b/histrap.c @@ -3,7 +3,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.70 2008/09/30 19:36:16 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.71 2008/10/13 23:06:02 tg Exp $"); /*- * MirOS: This is the default mapping type, and need not be specified. @@ -283,7 +283,7 @@ hist_execute(char *cmd) histsave(&hist_source->line, p, true, true); shellf("%s\n", p); /* POSIX doesn't say this is done... */ - if ((p = q)) /* restore \n (trailing \n not restored) */ + if (q) /* restore \n (trailing \n not restored) */ q[-1] = '\n'; } diff --git a/jobs.c b/jobs.c index 0830a28..c781684 100644 --- a/jobs.c +++ b/jobs.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.36 2008/05/17 19:03:25 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.37 2008/10/13 23:06:03 tg Exp $"); /* Order important! */ #define PRUNNING 0 @@ -319,7 +319,8 @@ exchild(struct op *t, int flags, /* used if XPCLOSE or XCCLOSE */ int close_fd) "exchild: XPIPEI and no last_job - pid %d", (int)procpid); j = last_job; - last_proc->next = p; + if (last_proc) + last_proc->next = p; last_proc = p; } else { j = new_job(); /* fills in j->job */ @@ -402,18 +403,16 @@ exchild(struct op *t, int flags, /* used if XPCLOSE or XCCLOSE */ int close_fd) SS_RESTORE_DFL|SS_FORCE); } if (Flag(FBGNICE) && (flags & XBGND)) - i = nice(4); + (void)nice(4); if ((flags & XBGND) && !Flag(FMONITOR)) { setsig(&sigtraps[SIGINT], SIG_IGN, SS_RESTORE_IGN|SS_FORCE); setsig(&sigtraps[SIGQUIT], SIG_IGN, SS_RESTORE_IGN|SS_FORCE); - if (!(flags & (XPIPEI | XCOPROC))) { - int fd = open("/dev/null", 0); - if (fd != 0) { - (void) ksh_dup2(fd, 0, true); - close(fd); - } + if ((!(flags & (XPIPEI | XCOPROC))) && + ((i = open("/dev/null", 0)) > 0)) { + (void)ksh_dup2(i, 0, true); + close(i); } } remove_job(j, "child"); /* in case of $(jobs) command */ diff --git a/misc.c b/misc.c index 4690424..8d2ae23 100644 --- a/misc.c +++ b/misc.c @@ -6,7 +6,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.85 2008/07/18 11:33:12 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.86 2008/10/13 23:06:03 tg Exp $"); #undef USE_CHVT #if defined(TIOCSCTTY) && !defined(MKSH_SMALL) @@ -773,11 +773,11 @@ pat_scan(const unsigned char *p, const unsigned char *pe, int match_sep) continue; if ((*++p == /*(*/ ')' && nest-- == 0) || (*p == '|' && match_sep && nest == 0)) - return ++p; + return (p + 1); if ((*p & 0x80) && vstrchr("*+?@! ", *p & 0x7f)) nest++; } - return NULL; + return (NULL); } int @@ -1137,7 +1137,7 @@ make_path(const char *cwd, const char *file, for (pend = plist; *pend && *pend != ':'; pend++) ; plen = pend - plist; - *cdpathp = *pend ? ++pend : NULL; + *cdpathp = *pend ? pend + 1 : NULL; } if ((use_cdpath == 0 || !plen || plist[0] != '/') && diff --git a/sh.h b/sh.h index 9ddd668..efe59ec 100644 --- a/sh.h +++ b/sh.h @@ -100,9 +100,9 @@ #define __SCCSID(x) __IDSTRING(sccsid,x) #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.239 2008/10/10 21:30:42 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.240 2008/10/13 23:06:03 tg Exp $"); #endif -#define MKSH_VERSION "R35 2008/10/10" +#define MKSH_VERSION "R35 2008/10/13" #ifndef MKSH_INCLUDES_ONLY diff --git a/tree.c b/tree.c index 667be2f..fe509d3 100644 --- a/tree.c +++ b/tree.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.19 2008/09/14 20:29:13 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.20 2008/10/13 23:06:04 tg Exp $"); #define INDENT 4 @@ -262,7 +262,7 @@ tputS(char *wp, struct shf *shf) * COMSUB [(`] ...\0 (handle $ ` \ and maybe " in `...` case) */ while (1) - switch ((c = *wp++)) { + switch (*wp++) { case EOS: return; case ADELIM: @@ -541,7 +541,7 @@ wdstrip(const char *wp, bool keepq, bool make_magic) * x${foo:-'hi'} -> x${foo:-hi} unless keepq */ while (1) - switch ((c = *wp++)) { + switch (*wp++) { case EOS: return shf_sclose(&shf); /* null terminates */ case ADELIM: