summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-01-10 17:55:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-01-10 17:55:04 +0000
commit72cf5c5e2022b91fc486d3ef569034cbcbdeb2a8 (patch)
tree4298b1cf3a93f5de208765ff3c2c2c4884c7da21
parent1494c2efdc94109bcd53d3092332b170ed6b8d6d (diff)
sync with pdksh-unstable-5.2.13.6
-rw-r--r--bin/ksh/BUG-REPORTS15
-rw-r--r--bin/ksh/CONTRIBUTORS6
-rw-r--r--bin/ksh/ChangeLog14
-rw-r--r--bin/ksh/Makefile4
-rw-r--r--bin/ksh/c_ksh.c19
-rw-r--r--bin/ksh/c_sh.c16
-rw-r--r--bin/ksh/edit.c4
-rw-r--r--bin/ksh/emacs.c8
-rw-r--r--bin/ksh/eval.c3
-rw-r--r--bin/ksh/exec.c12
-rw-r--r--bin/ksh/expr.c3
-rw-r--r--bin/ksh/history.c6
-rw-r--r--bin/ksh/io.c5
-rw-r--r--bin/ksh/jobs.c5
-rw-r--r--bin/ksh/lex.c5
-rw-r--r--bin/ksh/mail.c3
-rw-r--r--bin/ksh/main.c9
-rw-r--r--bin/ksh/table.c5
-rw-r--r--bin/ksh/tests/regress.t16
-rw-r--r--bin/ksh/tests/version.t2
-rw-r--r--bin/ksh/var.c15
-rw-r--r--bin/ksh/version.c4
22 files changed, 129 insertions, 50 deletions
diff --git a/bin/ksh/BUG-REPORTS b/bin/ksh/BUG-REPORTS
index 4926186d0be..43161fb034f 100644
--- a/bin/ksh/BUG-REPORTS
+++ b/bin/ksh/BUG-REPORTS
@@ -1,4 +1,4 @@
-$OpenBSD: BUG-REPORTS,v 1.8 1999/01/08 20:24:54 millert Exp $
+$OpenBSD: BUG-REPORTS,v 1.9 1999/01/10 17:55:01 millert Exp $
List of reported problems (problems reported and fixed before 5.0.4 not
included). Unresolved problems (may or may not still exist) marked by *,
@@ -1323,3 +1323,16 @@ x pdksh 5.2.13, (reported by Dmitri Kulginov): "trap exit 1" does not set a
x pdksh 5.2.13, (reported by Mark Funkenhauser): eval "$(false)" does not
result in $? being set to 1 (is 0).
[fixed in 5.2.14: c_sh.c(c_eval): set exstat to subst_exstat before shell()]
+
+x pdksh 5.2.13, (reported with fix by Kevin Schoedel): word boardaries in
+ file completion are only spaces - at&t ksh uses ()<>&| and spaces.
+ [fixed in 5.2.14: edit.c(IS_WORDC): changed macro to be LEX1 + quotes]
+
+x pdksh 5.2.13.5, (reported with fix by Martin Lucina <mato@kotelna.sk>):
+ exit status parsing in exit command incorrect (sets status to random
+ value if no argument given).
+ [fixed in 5.2.14: c_sh.c(c_exitreturn): only set exstat if arg given]
+
+x pdksh 5.2.13.5, (reported with fix by Martin Lucina <mato@kotelna.sk>):
+ KSH_CHECK_H_TYPE in aclocal.m4 has too many [] around the patterns.
+ [fixed in 5.2.14: aclocal.m4(KSH_CHECK_H_TYPE): remove two pairs on []]
diff --git a/bin/ksh/CONTRIBUTORS b/bin/ksh/CONTRIBUTORS
index 801a81c1be3..b1fc67c8065 100644
--- a/bin/ksh/CONTRIBUTORS
+++ b/bin/ksh/CONTRIBUTORS
@@ -1,4 +1,4 @@
-$OpenBSD: CONTRIBUTORS,v 1.6 1999/01/08 20:24:56 millert Exp $
+$OpenBSD: CONTRIBUTORS,v 1.7 1999/01/10 17:55:01 millert Exp $
This is a partial history of this shell gleened from old change logs and
readmes (most of which are still in the misc directory) and the source
@@ -118,3 +118,7 @@ Other contributors:
in exec.c(flushcom).
* Todd. C Miller (Todd C. Miller <Todd.Miller@courtesan.com>): fix
for coredump in jobs.
+ * Kevin Schoedel <schoedel@kw.igs.net>: fix for word location in file
+ completion.
+ * Martin Lucina <mato@kotelna.sk>: fix for argument parsing in exit command,
+ fix for KSH_CHECK_H_TYPE.
diff --git a/bin/ksh/ChangeLog b/bin/ksh/ChangeLog
index 0e2987437c9..824000f9744 100644
--- a/bin/ksh/ChangeLog
+++ b/bin/ksh/ChangeLog
@@ -1,3 +1,15 @@
+Tue Jan 5 16:45:00 NST 1999 Michael Rendell (michael@panda.cs.mun.ca)
+
+ * aclocal.m4(KSH_CHECK_H_TYPE): remove extra [] from egrep pattern.
+ * c_sh.c(c_exitreturn): fixed logic of exit status parsing
+ (fixes from Martin Lucina).
+
+Tue Jan 5 16:31:37 NST 1999 Michael Rendell (michael@panda.cs.mun.ca)
+
+ * edit.c(x_locate_word): changed IS_WORDC macro from !isspace
+ to !lex1/'/"
+ (based on fix from Kevin Schoedel).
+
Wed Dec 16 15:02:48 NST 1998 Michael Rendell (michael@panda.cs.mun.ca)
* io.c(kshdebug_init_,kshdebug_printf_,kshdebug_dump_),
@@ -290,7 +302,7 @@ Wed Oct 30 11:23:17 NST 1996 Michael Rendell (michael@panda.cs.mun.ca)
* exec.c(comexec): case CFUNC: set $0 to kshname if non-function
function.
-$OpenBSD: ChangeLog,v 1.8 1999/01/08 20:24:56 millert Exp $
+$OpenBSD: ChangeLog,v 1.9 1999/01/10 17:55:01 millert Exp $
Tue Oct 29 11:34:58 NST 1996 Michael Rendell (michael@panda.cs.mun.ca)
diff --git a/bin/ksh/Makefile b/bin/ksh/Makefile
index bcd0ec772f2..76970d8cbd6 100644
--- a/bin/ksh/Makefile
+++ b/bin/ksh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 1998/03/06 05:39:59 millert Exp $
+# $OpenBSD: Makefile,v 1.10 1999/01/10 17:55:01 millert Exp $
PROG= ksh
SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
@@ -6,7 +6,7 @@ SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
main.c misc.c missing.c path.c shf.c syn.c table.c trap.c \
tree.c tty.c var.c version.c vi.c
-DEFS= -DHAVE_CONFIG_H
+DEFS= -DHAVE_CONFIG_H -Wall -Wno-unused
CFLAGS+=${DEFS} -I. -I${.CURDIR} -DKSH
MAN= ksh.1 sh.1
diff --git a/bin/ksh/c_ksh.c b/bin/ksh/c_ksh.c
index 36057aed1fd..1dde0c7a844 100644
--- a/bin/ksh/c_ksh.c
+++ b/bin/ksh/c_ksh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_ksh.c,v 1.10 1999/01/08 20:24:57 millert Exp $ */
+/* $OpenBSD: c_ksh.c,v 1.11 1999/01/10 17:55:01 millert Exp $ */
/*
* built-in Korn commands: c_*
@@ -125,9 +125,11 @@ c_cd(wp)
/* Clear out tracked aliases with relative paths */
flushcom(0);
- /* Set OLDPWD */
+ /* Set OLDPWD (note: unsetting OLDPWD does not disable this
+ * setting in at&t ksh)
+ */
if (current_wd[0])
- setstr(oldpwd_s, current_wd);
+ setstr(oldpwd_s, current_wd); /* SETSTR no die, don't set */
if (!ISABSPATH(Xstring(xs, xp))) {
#ifdef OS2
@@ -148,7 +150,7 @@ c_cd(wp)
/* Set PWD */
if (pwd) {
set_current_wd(pwd);
- setstr(pwd_s, pwd);
+ setstr(pwd_s, pwd); /* SETSTR no die, leave unchanged */
} else {
set_current_wd(null);
pwd = Xstring(xs, xp);
@@ -1098,13 +1100,14 @@ c_jobs(wp)
return 1;
}
wp += builtin_opt.optind;
- if (!*wp)
+ if (!*wp) {
if (j_jobs((char *) 0, flag, nflag))
rv = 1;
- else
+ } else {
for (; *wp; wp++)
if (j_jobs(*wp, flag, nflag))
rv = 1;
+ }
return rv;
}
@@ -1364,7 +1367,7 @@ c_getopts(wp)
if (user_opt.optarg == (char *) 0)
unset(global("OPTARG"), 0);
else
- setstr(global("OPTARG"), user_opt.optarg);
+ setstr(global("OPTARG"), user_opt.optarg); /* SETSTR: no fail, cause exit code to be non-zero */
vq = global(var);
if (vq->flag & RDONLY) {
@@ -1373,7 +1376,7 @@ c_getopts(wp)
}
if (Flag(FEXPORT))
typeset(var, EXPORT, 0, 0, 0);
- setstr(vq, buf);
+ setstr(vq, buf); /* SETSTR: no fail, cause exit code to be !0 */
return optc < 0 ? 1 : 0;
}
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c
index 572df310002..abe9c8ea471 100644
--- a/bin/ksh/c_sh.c
+++ b/bin/ksh/c_sh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_sh.c,v 1.10 1999/01/10 16:45:49 millert Exp $ */
+/* $OpenBSD: c_sh.c,v 1.11 1999/01/10 17:55:02 millert Exp $ */
/*
* built-in Bourne commands
@@ -394,7 +394,7 @@ c_read(wp)
}
if (Flag(FEXPORT))
typeset(*wp, EXPORT, 0, 0, 0);
- setstr(vp, Xstring(cs, cp));
+ setstr(vp, Xstring(cs, cp)); /* SETSTR: fail */
}
shf_flush(shf);
@@ -517,12 +517,12 @@ c_exitreturn(wp)
return 1;
arg = wp[builtin_opt.optind];
- if (arg != NULL) {
- if (!getn(arg, &n)) {
- exstat = 1;
- warningf(TRUE, "%s: bad number", arg);
- } else
- exstat = n;
+ if (arg) {
+ if (!getn(arg, &n)) {
+ exstat = 1;
+ warningf(TRUE, "%s: bad number", arg);
+ } else
+ exstat = n;
}
if (wp[0][0] == 'r') { /* return */
struct env *ep;
diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c
index 5112e077bd6..17992e47ff4 100644
--- a/bin/ksh/edit.c
+++ b/bin/ksh/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.8 1999/01/08 20:24:58 millert Exp $ */
+/* $OpenBSD: edit.c,v 1.9 1999/01/10 17:55:02 millert Exp $ */
/*
* Command line editing - common code
@@ -707,7 +707,7 @@ x_command_glob(flags, str, slen, wordsp)
return nwords;
}
-#define IS_WORDC(c) !isspace(c)
+#define IS_WORDC(c) !(ctype(c, C_LEX1) || (c) == '\'' || (c) == '"')
static int
x_locate_word(buf, buflen, pos, startp, is_commandp)
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c
index 2d09cfcb412..53ea0f332a0 100644
--- a/bin/ksh/emacs.c
+++ b/bin/ksh/emacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emacs.c,v 1.6 1998/10/29 04:09:20 millert Exp $ */
+/* $OpenBSD: emacs.c,v 1.7 1999/01/10 17:55:02 millert Exp $ */
/*
* Emacs-like command line editing and history
@@ -680,7 +680,7 @@ static void
x_bs(c)
int c;
{
- register i;
+ register int i;
i = x_size(c);
while (i--)
x_e_putc('\b');
@@ -690,7 +690,7 @@ static int
x_size_str(cp)
register char *cp;
{
- register size = 0;
+ register int size = 0;
while (*cp)
size += x_size(*cp++);
return size;
@@ -1480,7 +1480,7 @@ x_init_emacs()
for (j = 0; j < X_TABSZ; j++)
x_tab[i][j] = XFUNC_error;
for (i = 0; i < NELEM(x_defbindings); i++)
- x_tab[x_defbindings[i].xdb_tab][x_defbindings[i].xdb_char]
+ x_tab[(unsigned char)x_defbindings[i].xdb_tab][x_defbindings[i].xdb_char]
= x_defbindings[i].xdb_func;
x_atab = (char *(*)[X_TABSZ]) alloc(sizeofN(*x_atab, X_NTABS), AEDIT);
diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c
index 56917f378b6..3e63507acec 100644
--- a/bin/ksh/eval.c
+++ b/bin/ksh/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.7 1999/01/08 20:24:58 millert Exp $ */
+/* $OpenBSD: eval.c,v 1.8 1999/01/10 17:55:02 millert Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -417,6 +417,7 @@ expand(cp, wp, f)
setstr(st->var, debunk(
(char *) alloc(strlen(dp) + 1,
ATEMP), dp));
+ /* SETSTR: fail operation */
x.str = str_val(st->var);
type = XSUB;
if (f&DOBLANK)
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index bf0f3975dd8..ec65d5c41eb 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.14 1999/01/08 20:24:59 millert Exp $ */
+/* $OpenBSD: exec.c,v 1.15 1999/01/10 17:55:02 millert Exp $ */
/*
* execute command tree
@@ -326,6 +326,9 @@ execute(t, flags)
vq = global(t->str);
if (vq->flag & RDONLY)
errorf("%s is read only", t->str);
+ /* SETSTR: fail (put readonly check in setstr,
+ * controlled by a flag?)
+ */
setstr(vq, *ap++);
rv = execute(t->left, flags & XERROK);
}
@@ -343,6 +346,9 @@ execute(t, flags)
vq = global(t->str);
if (vq->flag & RDONLY)
errorf("%s is read only", t->str);
+ /* SETSTR: fail (put readonly check in setstr,
+ * controlled by a flag?)
+ */
setstr(vq, cp);
rv = execute(t->left, flags & XERROK);
}
@@ -471,7 +477,8 @@ comexec(t, tp, ap, flags)
if (!Flag(FSH) && Flag(FTALKING) && *(lastp = ap)) {
while (*++lastp)
;
- setstr(typeset("_", LOCAL, 0, 0, 0), *--lastp);
+ /* SETSTR: can't fail */
+ setstr(typeset("_", LOCAL, 0, INTEGER, 0), *--lastp);
}
#endif /* KSH */
@@ -716,6 +723,7 @@ comexec(t, tp, ap, flags)
#ifdef KSH
if (!Flag(FSH)) {
/* set $_ to program's full path */
+ /* SETSTR: can't fail */
setstr(typeset("_", LOCAL|EXPORT, 0, 0, 0), tp->val.s);
}
#endif /* KSH */
diff --git a/bin/ksh/expr.c b/bin/ksh/expr.c
index 775d7ee44dd..85a017161fa 100644
--- a/bin/ksh/expr.c
+++ b/bin/ksh/expr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expr.c,v 1.4 1997/06/19 13:58:41 kstailey Exp $ */
+/* $OpenBSD: expr.c,v 1.5 1999/01/10 17:55:02 millert Exp $ */
/*
* Korn expression evaluation
@@ -212,6 +212,7 @@ v_evaluate(vp, expr, error_ok)
if (vp->flag & INTEGER)
setint_v(vp, v);
else
+ /* SETSTR: can't fail; if pretending, allow fail */
setstr(vp, str_val(v));
es = curstate.prev;
diff --git a/bin/ksh/history.c b/bin/ksh/history.c
index bb02a879500..c962e957604 100644
--- a/bin/ksh/history.c
+++ b/bin/ksh/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.9 1998/10/29 04:09:20 millert Exp $ */
+/* $OpenBSD: history.c,v 1.10 1999/01/10 17:55:02 millert Exp $ */
/*
* command history
@@ -240,8 +240,10 @@ c_fc(wp)
return 1;
}
- if (!Flag(FSH))
+ if (!Flag(FSH)) {
+ /* SETSTR: ignore fail (arbitrary) */
setstr(local("_", FALSE), tf->name);
+ }
/* XXX: source should not get trashed by this.. */
{
diff --git a/bin/ksh/io.c b/bin/ksh/io.c
index 93c6b1f97af..b2e98a73b3b 100644
--- a/bin/ksh/io.c
+++ b/bin/ksh/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.6 1999/01/08 20:24:59 millert Exp $ */
+/* $OpenBSD: io.c,v 1.7 1999/01/10 17:55:02 millert Exp $ */
/*
* shell buffered IO and formatted output
@@ -299,11 +299,12 @@ savefd(fd, noclose)
if (fd < FDBASE) {
nfd = ksh_dupbase(fd, FDBASE);
- if (nfd < 0)
+ if (nfd < 0) {
if (errno == EBADF)
return -1;
else
errorf("too many files open in shell");
+ }
if (!noclose)
close(fd);
} else
diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index 31397fed61a..f49c11a0b62 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jobs.c,v 1.11 1999/01/08 20:24:59 millert Exp $ */
+/* $OpenBSD: jobs.c,v 1.12 1999/01/10 17:55:02 millert Exp $ */
/*
* Process and job control
@@ -1557,11 +1557,12 @@ j_print(j, how, shf)
break;
}
- if (how != JP_SHORT)
+ if (how != JP_SHORT) {
if (p == j->proc_list)
shf_fprintf(shf, "[%d] %c ", j->job, jobchar);
else
shf_fprintf(shf, "%s", filler);
+ }
if (how == JP_LONG)
shf_fprintf(shf, "%5d ", p->pid);
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index cf92b67454a..855b6352da0 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.11 1998/06/25 19:02:06 millert Exp $ */
+/* $OpenBSD: lex.c,v 1.12 1999/01/10 17:55:03 millert Exp $ */
/*
* lexical analysis and source input
@@ -647,11 +647,12 @@ Done:
if (c == c2 || (c == '<' && c2 == '>')) {
iop->flag = c == c2 ?
(c == '>' ? IOCAT : IOHERE) : IORDWR;
- if (iop->flag == IOHERE)
+ if (iop->flag == IOHERE) {
if ((c2 = getsc()) == '-')
iop->flag |= IOSKIP;
else
ungetsc(c2);
+ }
} else if (c2 == '&')
iop->flag = IODUP | (c == '<' ? IORDUP : 0);
else {
diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c
index d3136632622..2a9d429e524 100644
--- a/bin/ksh/mail.c
+++ b/bin/ksh/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.7 1998/06/25 19:02:09 millert Exp $ */
+/* $OpenBSD: mail.c,v 1.8 1999/01/10 17:55:03 millert Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -192,6 +192,7 @@ mbox_t *mbp;
*/
if (!Flag(FSH))
#endif
+ /* SETSTR: ignore fail (arbitrary; havn't checked at&t) */
setstr((vp = local("_", FALSE)), mbp->mb_path);
shellf("%s\n", substitute(mbp->mb_msg ? mbp->mb_msg : MBMESSAGE, 0));
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 3fc6446d80f..2d591844f09 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.12 1999/01/08 20:25:00 millert Exp $ */
+/* $OpenBSD: main.c,v 1.13 1999/01/10 17:55:03 millert Exp $ */
/*
* startup, main loop, enviroments and error handling
@@ -186,6 +186,7 @@ main(argc, argv)
*/
{
struct tbl *vp = global("PATH");
+ /* SETSTR: can't fail */
setstr(vp, def_path);
}
@@ -252,6 +253,7 @@ main(argc, argv)
* bogus value
*/
if (current_wd[0] || pwd != null)
+ /* SETSTR: can't fail */
setstr(pwd_v, current_wd);
}
ppid = getppid();
@@ -259,6 +261,7 @@ main(argc, argv)
#ifdef KSH
setint(global("RANDOM"), (long) (time((time_t *)0) * kshpid * ppid));
#endif /* KSH */
+ /* SETSTR: can't fail */
setstr(global(version_param), ksh_version);
/* execute initialization statements */
@@ -279,6 +282,7 @@ main(argc, argv)
*/
if (!(vp->flag & ISSET)
|| (!ksheuid && !strchr(str_val(vp), '#')))
+ /* SETSTR: can't fail */
setstr(vp, safe_prompt);
}
@@ -593,11 +597,12 @@ shell(s, toplevel)
if (trap)
runtraps(0);
- if (s->next == NULL)
+ if (s->next == NULL) {
if (Flag(FVERBOSE))
s->flags |= SF_ECHO;
else
s->flags &= ~SF_ECHO;
+ }
if (interactive) {
j_notify();
diff --git a/bin/ksh/table.c b/bin/ksh/table.c
index a390c172c77..91b33bc96c5 100644
--- a/bin/ksh/table.c
+++ b/bin/ksh/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.4 1997/06/19 13:58:47 kstailey Exp $ */
+/* $OpenBSD: table.c,v 1.5 1999/01/10 17:55:03 millert Exp $ */
/*
* dynamic hashed associative table for commands and variables
@@ -55,7 +55,7 @@ texpand(tp, nsize)
if (otblp == NULL)
return;
for (i = 0; i < osize; i++)
- if ((tblp = otblp[i]) != NULL)
+ if ((tblp = otblp[i]) != NULL) {
if ((tblp->flag&DEFINED)) {
for (p = &ntblp[hash(tblp->name)
& (tp->size-1)];
@@ -67,6 +67,7 @@ texpand(tp, nsize)
} else if (!(tblp->flag & FINUSE)) {
afree((void*)tblp, tp->areap);
}
+ }
afree((void*)otblp, tp->areap);
}
diff --git a/bin/ksh/tests/regress.t b/bin/ksh/tests/regress.t
index 763891f839c..628a179b80a 100644
--- a/bin/ksh/tests/regress.t
+++ b/bin/ksh/tests/regress.t
@@ -1036,3 +1036,19 @@ stdin:
expected-stdout:
2
---
+
+name: regression-60
+description:
+ Check if default exit status is previous command
+stdin:
+ (true; exit)
+ echo A $?
+ (false; exit)
+ echo B $?
+ ( (exit 103) ; exit)
+ echo C $?
+expected-stdout:
+ A 0
+ B 1
+ C 103
+---
diff --git a/bin/ksh/tests/version.t b/bin/ksh/tests/version.t
index f3dabcb445a..f0b1b9a75ef 100644
--- a/bin/ksh/tests/version.t
+++ b/bin/ksh/tests/version.t
@@ -4,5 +4,5 @@ description:
stdin:
echo $KSH_VERSION
expected-stdout:
- @(#)PD KSH v5.2.13.5 98/12/18
+ @(#)PD KSH v5.2.13.5 99/01/10
---
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index c985a1144e8..c6170734b13 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.8 1999/01/08 20:25:02 millert Exp $ */
+/* $OpenBSD: var.c,v 1.9 1999/01/10 17:55:03 millert Exp $ */
#include "sh.h"
#include "ksh_time.h"
@@ -64,11 +64,12 @@ popblock()
e->loc = l->next; /* pop block */
for (i = l->vars.size; --i >= 0; )
- if ((vp = *vpp++) != NULL && (vp->flag&SPECIAL))
+ if ((vp = *vpp++) != NULL && (vp->flag&SPECIAL)) {
if ((vq = global(vp->name))->flag & ISSET)
setspec(vq);
else
unsetspec(vq);
+ }
if (l->flags & BF_DOGETOPTS)
user_opt = l->getopts_state;
afreeall(&l->area);
@@ -182,6 +183,7 @@ global(n)
for (c = 0; digit(*n); n++)
c = c*10 + *n-'0';
if (c <= l->argc)
+ /* SETSTR: can't fail */
setstr(vp, l->argv[c]);
return vp;
}
@@ -214,11 +216,12 @@ global(n)
}
for (l = e->loc; ; l = l->next) {
vp = tsearch(&l->vars, n, h);
- if (vp != NULL)
+ if (vp != NULL) {
if (array)
return arraysearch(vp, val);
else
return vp;
+ }
if (l->next == NULL)
break;
}
@@ -390,6 +393,7 @@ setint(vq, n)
vp->type = 0;
vp->areap = ATEMP;
vp->val.i = n;
+ /* SETSTR: can't fail */
setstr(vq, str_val(vp));
} else
vq->val.i = n;
@@ -675,6 +679,7 @@ typeset(var, set, clr, field, base)
if (set & (LJUST|RJUST|ZEROFIL))
t->u2.field = field;
if (fake_assign) {
+ /* SETSTR: XXX make unset, then fail? */
setstr(t, s);
if (free_me)
afree((void *) free_me, t->areap);
@@ -685,11 +690,13 @@ typeset(var, set, clr, field, base)
if (val != NULL) {
if (vp->flag&INTEGER) {
/* do not zero base before assignment */
+ /* SETSTR: XXX */
setstr(vp, val);
/* Done after assignment to override default */
if (base > 0)
vp->type = base;
} else
+ /* SETSTR: can't fail */
setstr(vp, val);
}
@@ -835,6 +842,7 @@ makenv()
char *val;
val = str_val(vp);
vp->flag &= ~INTEGER;
+ /* SETSTR: can't fail */
setstr(vp, val);
}
XPput(env, vp->val.s);
@@ -1157,6 +1165,7 @@ set_array(var, reset, vals)
*/
for (i = 0; vals[i]; i++) {
vq = arraysearch(vp, i);
+ /* SETSTR: XXX */
setstr(vq, vals[i]);
}
}
diff --git a/bin/ksh/version.c b/bin/ksh/version.c
index ef44a10ce87..75e5f409b11 100644
--- a/bin/ksh/version.c
+++ b/bin/ksh/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.8 1999/01/08 20:25:03 millert Exp $ */
+/* $OpenBSD: version.c,v 1.9 1999/01/10 17:55:03 millert Exp $ */
/*
* value of $KSH_VERSION (or $SH_VERSION)
@@ -7,4 +7,4 @@
#include "sh.h"
const char ksh_version [] =
- "@(#)PD KSH v5.2.13.5 98/12/18";
+ "@(#)PD KSH v5.2.13.6 99/01/10";