one more int → bool; mention “set -o sh” may (on raare OSes) be enabled

automatically (and it differs between targets); test MidnightBSD 0.1 ash
compat code and adjust the testsuite so it passes with it enabled
This commit is contained in:
tg 2013-02-19 18:45:22 +00:00
parent dffb1ab915
commit 74e2ef8b0b
5 changed files with 53 additions and 17 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.621 2013/02/18 22:55:35 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.622 2013/02/19 18:45:15 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013
@ -1388,6 +1388,9 @@ ac_ifcpp 'ifdef MKSH_CONSERVATIVE_FDS' isset_MKSH_CONSERVATIVE_FDS '' \
#ac_ifcpp 'ifdef MKSH_DISABLE_EXPERIMENTAL' isset_MKSH_DISABLE_EXPERIMENTAL '' \
# "if experimental features are to be omitted" && \
# check_categories="$check_categories noexperimental"
ac_ifcpp 'ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT' isset_MKSH_MIDNIGHTBSD01ASH_COMPAT '' \
'if the MidnightBSD 0.1 ash compatibility mode is requested' && \
check_categories="$check_categories mnbsdash"
#
# Environment: headers
@ -1529,7 +1532,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.621 2013/02/18 22:55:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.622 2013/02/19 18:45:15 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in

39
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.596 2013/02/18 22:55:37 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.597 2013/02/19 18:45:17 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 R43 2013/02/18
@(#)MIRBSD KSH R43 2013/02/19
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R43 2013/02/18
@(#)LEGACY KSH R43 2013/02/19
description:
Check version of legacy shell.
stdin:
@ -6005,10 +6005,9 @@ description:
stdin:
test \( -f = -f \)
rv=$?
test -n "$POSH_VERSION" || set -o sh
echo -e $rv
echo $rv
expected-stdout:
-e 0
0
---
name: test-option-1
description:
@ -10301,12 +10300,38 @@ description:
mandates it shall be treated as string but escapes
shall be expanded.
stdin:
test -n "$POSH_VERSION" || set -o sh
test -n "$POSH_VERSION" || set -o posix
echo -n 'foo\x40bar'
echo -e '\tbaz'
expected-stdout:
foo\x40bar-e \tbaz
---
name: echo-test-3-mnbsd
description:
Test what the echo builtin does, and test a compatibility flag.
category: mnbsdash
stdin:
"$__progname" -c 'echo -n 1=\\x40$1; echo -e \\x2E' -- foo bar
"$__progname" -o posix -c 'echo -n 2=\\x40$1; echo -e \\x2E' -- foo bar
"$__progname" -o sh -c 'echo -n 3=\\x40$1; echo -e \\x2E' -- foo bar
expected-stdout:
1=@foo.
2=\x40foo-e \x2E
3=\x40bar.
---
name: echo-test-3-normal
description:
Test what the echo builtin does, and test a compatibility flag.
category: !mnbsdash
stdin:
"$__progname" -c 'echo -n 1=\\x40$1; echo -e \\x2E' -- foo bar
"$__progname" -o posix -c 'echo -n 2=\\x40$1; echo -e \\x2E' -- foo bar
"$__progname" -o sh -c 'echo -n 3=\\x40$1; echo -e \\x2E' -- foo bar
expected-stdout:
1=@foo.
2=\x40foo-e \x2E
3=\x40foo-e \x2E
---
name: utilities-getopts-1
description:
getopts sets OPTIND correctly for unparsed option

5
lex.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.181 2013/02/17 06:05:02 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.182 2013/02/19 18:45:20 tg Exp $");
/*
* states while lexing word
@ -1508,7 +1508,8 @@ set_prompt(int to, Source *s)
static int
dopprompt(const char *cp, int ntruncate, bool doprint)
{
int columns = 0, lines = 0, indelimit = 0;
int columns = 0, lines = 0;
bool indelimit = false;
char delimiter = 0;
/*

15
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.304 2013/02/11 17:17:59 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.305 2013/02/19 18:45:20 tg Exp $
.\" $OpenBSD: ksh.1,v 1.145 2013/01/17 21:20:25 jmc Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -74,7 +74,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: February 11 2013 $
.Dd $Mdocdate: February 19 2013 $
.\"
.\" Check which macro package we use, and do other -mdoc setup.
.\"
@ -6335,10 +6335,15 @@ $ /bin/sleep 666 && echo fubar
.Ed
.Pp
This document attempts to describe
.Nm mksh\ R42
.Nm mksh\ R43
and up,
compiled without any options impacting functionality, such as
.Dv MKSH_SMALL ,
when not called as
.Pa /bin/sh
which, on some systems only, enables
.Ic set \-o sh
automatically (whose behaviour differs across targets),
for an operating environment supporting all of its advanced needs.
Please report bugs in
.Nm
@ -6351,4 +6356,6 @@ or in the
.Pq or Li \&#ksh
IRC channel at
.Pa irc.freenode.net
.Pq Port 6697 SSL, 6667 unencrypted .
.Pq Port 6697 SSL, 6667 unencrypted ,
or at:
.Pa https://launchpad.net/mksh

4
sh.h
View File

@ -164,9 +164,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.638 2013/02/18 22:55:40 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.639 2013/02/19 18:45:22 tg Exp $");
#endif
#define MKSH_VERSION "R43 2013/02/18"
#define MKSH_VERSION "R43 2013/02/19"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES