and, finally for today, fixup the “set -x” mess I made

This commit is contained in:
tg 2013-04-26 19:40:45 +00:00
parent 5571430281
commit 5f5393b4f1
3 changed files with 48 additions and 13 deletions

23
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.605 2013/04/01 02:37:47 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.606 2013/04/26 19:40:42 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 $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R44 2013/03/31
@(#)MIRBSD KSH R44 2013/04/26
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R44 2013/03/31
@(#)LEGACY KSH R44 2013/04/26
description:
Check version of legacy shell.
stdin:
@ -3920,6 +3920,13 @@ expected-stdout:
s:-9223372036854775808.-1.0.
u:9223372036854775808.18446744073709551615.0.
---
name: integer-size-FAIL-to-detect
description:
Notify the user that their ints are not 32 or 64 bit
category: int:u
stdin:
:
---
name: lineno-stdin
description:
See if $LINENO is updated and can be modified.
@ -5665,8 +5672,8 @@ stdin:
expected-stdout:
END
expected-stderr:
+ env false
+ echo END
+ env false
+ echo END
---
name: exit-err-2
description:
@ -5685,9 +5692,9 @@ stdin:
expected-stdout:
END
expected-stderr:
+ env true
+ env false
+ echo END
+ env true
+ env false
+ echo END
---
name: exit-err-3
description:

34
exec.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.117 2013/03/24 00:56:22 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.118 2013/04/26 19:40:44 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@ -141,8 +141,7 @@ execute(struct op * volatile t,
if (Flag(FXTRACE)) {
shf_puts(substitute(str_val(global("PS4")), 0),
shl_out);
fptreef(shl_out, 0, "%T\n", t);
shf_flush(shl_out);
Flag(FXTRACE) = 2;
}
if (ap[0])
tp = findcom(ap[0], FC_BI|FC_FUNC);
@ -333,6 +332,7 @@ execute(struct op * volatile t,
case TFOR:
case TSELECT: {
volatile bool is_first = true;
ap = (t->vars == NULL) ? e->loc->argv + 1 :
(const char **)eval((const char **)t->vars,
DOBLANK | DOGLOB | DOTILDE);
@ -642,12 +642,37 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap,
e->loc = l_expand;
cp = evalstr(t->vars[i], DOASNTILDE);
e->loc = l_assign;
if (Flag(FXTRACE)) {
const char *ccp;
ccp = skip_varname(cp, true);
if (*ccp == '+')
++ccp;
if (*ccp == '=')
++ccp;
shf_write(cp, ccp - cp, shl_out);
print_value_quoted(shl_out, ccp);
shf_putc(' ', shl_out);
}
/* but assign in there as usual */
typeset(cp, type_flags, 0, 0, 0);
if (bourne_function_call && !(type_flags & EXPORT))
typeset(cp, LOCAL|LOCAL_COPY|EXPORT, 0, 0, 0);
}
if (Flag(FXTRACE)) {
rv = 0;
xtrace_ap_loop:
print_value_quoted(shl_out, ap[rv]);
if (ap[++rv]) {
shf_putc(' ', shl_out);
goto xtrace_ap_loop;
}
shf_putc('\n', shl_out);
Flag(FXTRACE) = 1;
shf_flush(shl_out);
}
if ((cp = *ap) == NULL) {
rv = subst_exstat;
goto Leave;
@ -1286,6 +1311,9 @@ iosetup(struct ioword *iop, struct tbl *tp)
iotmp.name = (iotype == IOHERE) ? NULL : cp;
iotmp.flag |= IONAMEXP;
if (Flag(FXTRACE) == 2)
fptreef(shl_out, 0, "%R", &iotmp);
switch (iotype) {
case IOREAD:
flags = O_RDONLY;

4
sh.h
View File

@ -164,9 +164,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.649 2013/04/26 18:27:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.650 2013/04/26 19:40:45 tg Exp $");
#endif
#define MKSH_VERSION "R44 2013/03/31"
#define MKSH_VERSION "R44 2013/04/26"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES