update for recent changes
This commit is contained in:
parent
489fb7e845
commit
b2b0c0bbb6
9
Build.sh
9
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.692 2015/12/08 20:59:33 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.693 2015/12/12 22:25:10 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014, 2015
|
# 2011, 2012, 2013, 2014, 2015
|
||||||
@ -100,6 +100,7 @@ do_genopt() {
|
|||||||
srcfile=$1
|
srcfile=$1
|
||||||
test -f "$srcfile" || genopt_die Source file \$srcfile not set.
|
test -f "$srcfile" || genopt_die Source file \$srcfile not set.
|
||||||
bn=`basename "$srcfile" | sed 's/.opt$//'`
|
bn=`basename "$srcfile" | sed 's/.opt$//'`
|
||||||
|
o_hdr='/* +++ GENERATED FILE +++ DO NOT EDIT +++ */'
|
||||||
o_gen=
|
o_gen=
|
||||||
o_str=
|
o_str=
|
||||||
o_sym=
|
o_sym=
|
||||||
@ -128,6 +129,9 @@ do_genopt() {
|
|||||||
;;
|
;;
|
||||||
*:@@*)
|
*:@@*)
|
||||||
genopt_die ;;
|
genopt_die ;;
|
||||||
|
0:/\*-|0:\ \**|0:)
|
||||||
|
o_hdr=$o_hdr$nl$line
|
||||||
|
;;
|
||||||
0:@*|1:@*)
|
0:@*|1:@*)
|
||||||
# begin of a definition block
|
# begin of a definition block
|
||||||
sym=`echo "$line" | sed 's/^@//'`
|
sym=`echo "$line" | sed 's/^@//'`
|
||||||
@ -177,6 +181,7 @@ do_genopt() {
|
|||||||
echo "\"$opts\""
|
echo "\"$opts\""
|
||||||
test -n "$cond" && echo "#endif"
|
test -n "$cond" && echo "#endif"
|
||||||
done | {
|
done | {
|
||||||
|
echo "$o_hdr"
|
||||||
echo "#ifndef $o_sym$o_gen"
|
echo "#ifndef $o_sym$o_gen"
|
||||||
echo "#else"
|
echo "#else"
|
||||||
cat
|
cat
|
||||||
@ -2337,7 +2342,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c
|
|||||||
addsrcs USE_PRINTF_BUILTIN printf.c
|
addsrcs USE_PRINTF_BUILTIN printf.c
|
||||||
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
||||||
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
||||||
add_cppflags -DMKSH_BUILD_R=511
|
add_cppflags -DMKSH_BUILD_R=521
|
||||||
|
|
||||||
$e $bi$me: Finished configuration testing, now producing output.$ao
|
$e $bi$me: Finished configuration testing, now producing output.$ao
|
||||||
|
|
||||||
|
4
Makefile
4
Makefile
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.144 2015/10/05 17:58:56 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.145 2015/12/12 22:25:11 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014, 2015
|
# 2011, 2012, 2013, 2014, 2015
|
||||||
@ -57,7 +57,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
|
|||||||
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
||||||
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
||||||
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
||||||
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=511
|
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=521
|
||||||
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
||||||
CPPFLAGS+= -I.
|
CPPFLAGS+= -I.
|
||||||
COPTS+= -std=c89 -Wall
|
COPTS+= -std=c89 -Wall
|
||||||
|
236
check.t
236
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.714 2015/12/12 16:37:44 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.715 2015/12/12 22:25:12 tg Exp $
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@ -30,7 +30,7 @@
|
|||||||
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R51 2015/10/24
|
@(#)MIRBSD KSH R52 2015/12/12
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -39,7 +39,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R51 2015/10/24
|
@(#)LEGACY KSH R52 2015/12/12
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -270,6 +270,14 @@ stdin:
|
|||||||
expected-stdout:
|
expected-stdout:
|
||||||
bar - baz,z
|
bar - baz,z
|
||||||
---
|
---
|
||||||
|
name: arith-compound
|
||||||
|
description:
|
||||||
|
Check that arithmetic expressions are compound constructs
|
||||||
|
stdin:
|
||||||
|
{ ! (( 0$(cat >&2) )) <<<1; } <<<2
|
||||||
|
expected-stderr:
|
||||||
|
1
|
||||||
|
---
|
||||||
name: arith-lazy-1
|
name: arith-lazy-1
|
||||||
description:
|
description:
|
||||||
Check that only one side of ternary operator is evaluated
|
Check that only one side of ternary operator is evaluated
|
||||||
@ -1668,6 +1676,17 @@ expected-stdout:
|
|||||||
1=02.
|
1=02.
|
||||||
2=02.
|
2=02.
|
||||||
---
|
---
|
||||||
|
name: expand-weird-4
|
||||||
|
description:
|
||||||
|
Check that tilde expansion is enabled in ${x#~}
|
||||||
|
and cases that are modelled after it (${x/~/~})
|
||||||
|
stdin:
|
||||||
|
HOME=/etc
|
||||||
|
a="~/x"
|
||||||
|
echo "<${a#~}> <${a#\~}> <${b:-~}> <${b:-\~}> <${c:=~}><$c> <${a/~}> <${a/x/~}> <${a/x/\~}>"
|
||||||
|
expected-stdout:
|
||||||
|
<~/x> </x> <~> <\~> <~><~> <~/x> <~//etc> <~/~>
|
||||||
|
---
|
||||||
name: expand-number-1
|
name: expand-number-1
|
||||||
description:
|
description:
|
||||||
Check that positional arguments do not overflow
|
Check that positional arguments do not overflow
|
||||||
@ -1861,13 +1880,15 @@ stdin:
|
|||||||
echo 20: ${x/\//.}
|
echo 20: ${x/\//.}
|
||||||
echo 21: ${x//\//.}
|
echo 21: ${x//\//.}
|
||||||
echo 22: ${x///.}
|
echo 22: ${x///.}
|
||||||
echo 23: ${x//#1/9}
|
echo 23: ${x/#1/9}
|
||||||
echo 24: ${x//%1/9}
|
echo 24: ${x//#1/9}
|
||||||
echo 25: ${x//\%1/9}
|
echo 25: ${x/%1/9}
|
||||||
echo 26: ${x//\\%1/9}
|
echo 26: ${x//%1/9}
|
||||||
echo 27: ${x//\a/9}
|
echo 27: ${x//\%1/9}
|
||||||
echo 28: ${x//\\a/9}
|
echo 28: ${x//\\%1/9}
|
||||||
echo 29: ${x/2/$y}
|
echo 29: ${x//\a/9}
|
||||||
|
echo 30: ${x//\\a/9}
|
||||||
|
echo 31: ${x/2/$y}
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
1: 122321_ab/cde_b/c_1221
|
1: 122321_ab/cde_b/c_1221
|
||||||
2: 131_ab/cde_b/c_11
|
2: 131_ab/cde_b/c_11
|
||||||
@ -1892,12 +1913,14 @@ expected-stdout:
|
|||||||
21: 1222321_ab.cde_b.c_1221
|
21: 1222321_ab.cde_b.c_1221
|
||||||
22: 1222321_ab/cde_b/c_1221
|
22: 1222321_ab/cde_b/c_1221
|
||||||
23: 9222321_ab/cde_b/c_1221
|
23: 9222321_ab/cde_b/c_1221
|
||||||
24: 1222321_ab/cde_b/c_1229
|
24: 1222321_ab/cde_b/c_1221
|
||||||
25: 1222321_ab/cde_b/c_1229
|
25: 1222321_ab/cde_b/c_1229
|
||||||
26: 1222321_ab/cde_b/c_1221
|
26: 1222321_ab/cde_b/c_1221
|
||||||
27: 1222321_9b/cde_b/c_1221
|
27: 1222321_ab/cde_b/c_1221
|
||||||
28: 1222321_9b/cde_b/c_1221
|
28: 1222321_ab/cde_b/c_1221
|
||||||
29: 1xyz22321_ab/cde_b/c_1221
|
29: 1222321_9b/cde_b/c_1221
|
||||||
|
30: 1222321_ab/cde_b/c_1221
|
||||||
|
31: 1xyz22321_ab/cde_b/c_1221
|
||||||
---
|
---
|
||||||
name: eglob-substrpl-2
|
name: eglob-substrpl-2
|
||||||
description:
|
description:
|
||||||
@ -1922,6 +1945,7 @@ name: eglob-substrpl-3a
|
|||||||
description:
|
description:
|
||||||
Check substring replacement works with variables and slashes, too
|
Check substring replacement works with variables and slashes, too
|
||||||
stdin:
|
stdin:
|
||||||
|
HOME=/etc
|
||||||
pfx=/home/user
|
pfx=/home/user
|
||||||
wd=/home/user/tmp
|
wd=/home/user/tmp
|
||||||
echo "${wd/#$pfx/~}"
|
echo "${wd/#$pfx/~}"
|
||||||
@ -1931,9 +1955,9 @@ stdin:
|
|||||||
echo "${wd/#"\$pfx"/~}"
|
echo "${wd/#"\$pfx"/~}"
|
||||||
echo "${wd/#'\$pfx'/~}"
|
echo "${wd/#'\$pfx'/~}"
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
~/tmp
|
/etc/tmp
|
||||||
/home/user/tmp
|
/home/user/tmp
|
||||||
~/tmp
|
/etc/tmp
|
||||||
/home/user/tmp
|
/home/user/tmp
|
||||||
/home/user/tmp
|
/home/user/tmp
|
||||||
/home/user/tmp
|
/home/user/tmp
|
||||||
@ -1942,20 +1966,22 @@ name: eglob-substrpl-3b
|
|||||||
description:
|
description:
|
||||||
More of this, bash fails it (bash4 passes)
|
More of this, bash fails it (bash4 passes)
|
||||||
stdin:
|
stdin:
|
||||||
|
HOME=/etc
|
||||||
pfx=/home/user
|
pfx=/home/user
|
||||||
wd=/home/user/tmp
|
wd=/home/user/tmp
|
||||||
echo "${wd/#$(echo /home/user)/~}"
|
echo "${wd/#$(echo /home/user)/~}"
|
||||||
echo "${wd/#"$(echo /home/user)"/~}"
|
echo "${wd/#"$(echo /home/user)"/~}"
|
||||||
echo "${wd/#'$(echo /home/user)'/~}"
|
echo "${wd/#'$(echo /home/user)'/~}"
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
~/tmp
|
/etc/tmp
|
||||||
~/tmp
|
/etc/tmp
|
||||||
/home/user/tmp
|
/home/user/tmp
|
||||||
---
|
---
|
||||||
name: eglob-substrpl-3c
|
name: eglob-substrpl-3c
|
||||||
description:
|
description:
|
||||||
Even more weird cases
|
Even more weird cases
|
||||||
stdin:
|
stdin:
|
||||||
|
HOME=/etc
|
||||||
pfx=/home/user
|
pfx=/home/user
|
||||||
wd='$pfx/tmp'
|
wd='$pfx/tmp'
|
||||||
echo 1: ${wd/#$pfx/~}
|
echo 1: ${wd/#$pfx/~}
|
||||||
@ -1981,31 +2007,31 @@ stdin:
|
|||||||
echo 17: ${ts/+($tp)/$tr}
|
echo 17: ${ts/+($tp)/$tr}
|
||||||
echo 18: ${ts/+($tp)/c/d}
|
echo 18: ${ts/+($tp)/c/d}
|
||||||
echo 19: ${ts/+($tp)/c\/d}
|
echo 19: ${ts/+($tp)/c\/d}
|
||||||
echo 25: ${ts//a\/b/$tr}
|
echo 20: ${ts//a\/b/$tr}
|
||||||
echo 26: ${ts//a\/b/\$tr}
|
echo 21: ${ts//a\/b/\$tr}
|
||||||
echo 27: ${ts//$tp/$tr}
|
echo 22: ${ts//$tp/$tr}
|
||||||
echo 28: ${ts//$tp/c/d}
|
echo 23: ${ts//$tp/c/d}
|
||||||
echo 29: ${ts//$tp/c\/d}
|
echo 24: ${ts//$tp/c\/d}
|
||||||
echo 30: ${ts//+(a\/b)/$tr}
|
echo 25: ${ts//+(a\/b)/$tr}
|
||||||
echo 31: ${ts//+(a\/b)/\$tr}
|
echo 26: ${ts//+(a\/b)/\$tr}
|
||||||
echo 32: ${ts//+($tp)/$tr}
|
echo 27: ${ts//+($tp)/$tr}
|
||||||
echo 33: ${ts//+($tp)/c/d}
|
echo 28: ${ts//+($tp)/c/d}
|
||||||
echo 34: ${ts//+($tp)/c\/d}
|
echo 29: ${ts//+($tp)/c\/d}
|
||||||
tp="+($tp)"
|
tp="+($tp)"
|
||||||
echo 40: ${ts/$tp/$tr}
|
echo 30: ${ts/$tp/$tr}
|
||||||
echo 41: ${ts//$tp/$tr}
|
echo 31: ${ts//$tp/$tr}
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
1: $pfx/tmp
|
1: $pfx/tmp
|
||||||
2: ~/tmp
|
2: /etc/tmp
|
||||||
3: $pfx/tmp
|
3: $pfx/tmp
|
||||||
4: ~/tmp
|
4: /etc/tmp
|
||||||
5: ~/tmp
|
5: /etc/tmp
|
||||||
6: ~/tmp
|
6: $pfx/tmp
|
||||||
7: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
7: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
8: $tra/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
8: $tra/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
9: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
9: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
10: a/ba/bc/d$tp_a/b$tp_*(a/b)_*($tp)
|
10: a/ba/bc/d$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
11: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
11: a/ba/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
12: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
12: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
13: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
13: c/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
14: c\/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
14: c\/da/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
@ -2014,21 +2040,21 @@ expected-stdout:
|
|||||||
17: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
17: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
18: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
18: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
19: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
19: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
25: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
20: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
26: $tr$tr$tp$tp_$tr$tp_*($tr)_*($tp)
|
21: $tr$tr$tp$tp_$tr$tp_*($tr)_*($tp)
|
||||||
27: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
22: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
28: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
23: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
29: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
24: c/dc/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
30: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
25: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
31: $tr$tp$tp_$tr$tp_*($tr)_*($tp)
|
26: $tr$tp$tp_$tr$tp_*($tr)_*($tp)
|
||||||
32: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
27: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
33: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
28: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
34: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
29: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
40: a/ba/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
30: a/ba/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
41: a/ba/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
31: a/ba/b$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
# This is what GNU bash does:
|
# This is what GNU bash does:
|
||||||
# 40: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
# 30: c/d$tp$tp_a/b$tp_*(a/b)_*($tp)
|
||||||
# 41: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
# 31: c/d$tp$tp_c/d$tp_*(c/d)_*($tp)
|
||||||
---
|
---
|
||||||
name: eglob-utf8-1
|
name: eglob-utf8-1
|
||||||
description:
|
description:
|
||||||
@ -6384,6 +6410,41 @@ expected-stderr-pattern:
|
|||||||
/bad substitution/
|
/bad substitution/
|
||||||
expected-exit: 1
|
expected-exit: 1
|
||||||
---
|
---
|
||||||
|
name: xxx-variable-syntax-4
|
||||||
|
description:
|
||||||
|
Not all kinds of trims are currently impossible, check those who do
|
||||||
|
stdin:
|
||||||
|
foo() {
|
||||||
|
echo "<$*> X${*:+ }X"
|
||||||
|
}
|
||||||
|
foo a b
|
||||||
|
foo "" c
|
||||||
|
foo ""
|
||||||
|
foo "" ""
|
||||||
|
IFS=:
|
||||||
|
foo a b
|
||||||
|
foo "" c
|
||||||
|
foo ""
|
||||||
|
foo "" ""
|
||||||
|
IFS=
|
||||||
|
foo a b
|
||||||
|
foo "" c
|
||||||
|
foo ""
|
||||||
|
foo "" ""
|
||||||
|
expected-stdout:
|
||||||
|
<a b> X X
|
||||||
|
< c> X X
|
||||||
|
<> XX
|
||||||
|
< > X X
|
||||||
|
<a:b> X X
|
||||||
|
<:c> X X
|
||||||
|
<> XX
|
||||||
|
<:> X X
|
||||||
|
<ab> X X
|
||||||
|
<c> X X
|
||||||
|
<> XX
|
||||||
|
<> XX
|
||||||
|
---
|
||||||
name: xxx-substitution-eval-order
|
name: xxx-substitution-eval-order
|
||||||
description:
|
description:
|
||||||
Check order of evaluation of expressions
|
Check order of evaluation of expressions
|
||||||
@ -7115,6 +7176,41 @@ expected-stdout:
|
|||||||
11 0
|
11 0
|
||||||
12 0
|
12 0
|
||||||
---
|
---
|
||||||
|
name: test-numeq
|
||||||
|
description:
|
||||||
|
Check numeric -eq works (R40d regression); spotted by Martijn Dekker
|
||||||
|
stdin:
|
||||||
|
tst() {
|
||||||
|
eval "$2"
|
||||||
|
case $? in
|
||||||
|
(0) echo yepp 0 \#"$*" ;;
|
||||||
|
(1) echo nope 1 \#"$*" ;;
|
||||||
|
(2) echo terr 2 \#"$*" ;;
|
||||||
|
(*) echo wtf\? $? \#"$*" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
tst 1 'test 2 -eq 2'
|
||||||
|
tst 2 'test 2 -eq 2a'
|
||||||
|
tst 3 'test 2 -eq 3'
|
||||||
|
tst 4 'test 2 -ne 2'
|
||||||
|
tst 5 'test 2 -ne 2a'
|
||||||
|
tst 6 'test 2 -ne 3'
|
||||||
|
tst 7 'test \! 2 -eq 2'
|
||||||
|
tst 8 'test \! 2 -eq 2a'
|
||||||
|
tst 9 'test \! 2 -eq 3'
|
||||||
|
expected-stdout:
|
||||||
|
yepp 0 #1 test 2 -eq 2
|
||||||
|
terr 2 #2 test 2 -eq 2a
|
||||||
|
nope 1 #3 test 2 -eq 3
|
||||||
|
nope 1 #4 test 2 -ne 2
|
||||||
|
terr 2 #5 test 2 -ne 2a
|
||||||
|
yepp 0 #6 test 2 -ne 3
|
||||||
|
nope 1 #7 test \! 2 -eq 2
|
||||||
|
terr 2 #8 test \! 2 -eq 2a
|
||||||
|
yepp 0 #9 test \! 2 -eq 3
|
||||||
|
expected-stderr-pattern:
|
||||||
|
/bad number/
|
||||||
|
---
|
||||||
name: mkshrc-1
|
name: mkshrc-1
|
||||||
description:
|
description:
|
||||||
Check that ~/.mkshrc works correctly.
|
Check that ~/.mkshrc works correctly.
|
||||||
@ -10470,7 +10566,9 @@ expected-stdout:
|
|||||||
}
|
}
|
||||||
inline_TWHILE() {
|
inline_TWHILE() {
|
||||||
i=1
|
i=1
|
||||||
while \let] " i < 10 "
|
while {
|
||||||
|
\let] " i < 10 "
|
||||||
|
}
|
||||||
do
|
do
|
||||||
echo $i
|
echo $i
|
||||||
let ++i
|
let ++i
|
||||||
@ -10480,20 +10578,22 @@ expected-stdout:
|
|||||||
i=1; while (( i < 10 )); do echo $i; let ++i; done
|
i=1; while (( i < 10 )); do echo $i; let ++i; done
|
||||||
); }
|
); }
|
||||||
function comsub_TWHILE {
|
function comsub_TWHILE {
|
||||||
x=$(i=1 ; while \let] " i < 10 " ; do echo $i ; let ++i ; done )
|
x=$(i=1 ; while { \let] " i < 10 " ; } ; do echo $i ; let ++i ; done )
|
||||||
}
|
}
|
||||||
function reread_TWHILE { x=$((
|
function reread_TWHILE { x=$((
|
||||||
i=1; while (( i < 10 )); do echo $i; let ++i; done
|
i=1; while (( i < 10 )); do echo $i; let ++i; done
|
||||||
)|tr u x); }
|
)|tr u x); }
|
||||||
function reread_TWHILE {
|
function reread_TWHILE {
|
||||||
x=$(( i=1 ; while \let] " i < 10 " ; do echo $i ; let ++i ; done ) | tr u x )
|
x=$(( i=1 ; while { \let] " i < 10 " ; } ; do echo $i ; let ++i ; done ) | tr u x )
|
||||||
}
|
}
|
||||||
inline_TUNTIL() {
|
inline_TUNTIL() {
|
||||||
i=10; until (( !--i )) ; do echo $i; done
|
i=10; until (( !--i )) ; do echo $i; done
|
||||||
}
|
}
|
||||||
inline_TUNTIL() {
|
inline_TUNTIL() {
|
||||||
i=10
|
i=10
|
||||||
until \let] " !--i "
|
until {
|
||||||
|
\let] " !--i "
|
||||||
|
}
|
||||||
do
|
do
|
||||||
echo $i
|
echo $i
|
||||||
done
|
done
|
||||||
@ -10502,13 +10602,13 @@ expected-stdout:
|
|||||||
i=10; until (( !--i )) ; do echo $i; done
|
i=10; until (( !--i )) ; do echo $i; done
|
||||||
); }
|
); }
|
||||||
function comsub_TUNTIL {
|
function comsub_TUNTIL {
|
||||||
x=$(i=10 ; until \let] " !--i " ; do echo $i ; done )
|
x=$(i=10 ; until { \let] " !--i " ; } ; do echo $i ; done )
|
||||||
}
|
}
|
||||||
function reread_TUNTIL { x=$((
|
function reread_TUNTIL { x=$((
|
||||||
i=10; until (( !--i )) ; do echo $i; done
|
i=10; until (( !--i )) ; do echo $i; done
|
||||||
)|tr u x); }
|
)|tr u x); }
|
||||||
function reread_TUNTIL {
|
function reread_TUNTIL {
|
||||||
x=$(( i=10 ; until \let] " !--i " ; do echo $i ; done ) | tr u x )
|
x=$(( i=10 ; until { \let] " !--i " ; } ; do echo $i ; done ) | tr u x )
|
||||||
}
|
}
|
||||||
inline_TCOPROC() {
|
inline_TCOPROC() {
|
||||||
cat * |& ls
|
cat * |& ls
|
||||||
@ -11122,7 +11222,9 @@ expected-stdout:
|
|||||||
}
|
}
|
||||||
inline_TWHILE() {
|
inline_TWHILE() {
|
||||||
i=1
|
i=1
|
||||||
while \let] " i < 10 " >&3
|
while {
|
||||||
|
\let] " i < 10 "
|
||||||
|
} >&3
|
||||||
do
|
do
|
||||||
echo $i
|
echo $i
|
||||||
let ++i
|
let ++i
|
||||||
@ -11132,20 +11234,22 @@ expected-stdout:
|
|||||||
i=1; while (( i < 10 )) >&3; do echo $i; let ++i; done >&3
|
i=1; while (( i < 10 )) >&3; do echo $i; let ++i; done >&3
|
||||||
); }
|
); }
|
||||||
function comsub_TWHILE {
|
function comsub_TWHILE {
|
||||||
x=$(i=1 ; while \let] " i < 10 " >&3 ; do echo $i ; let ++i ; done >&3 )
|
x=$(i=1 ; while { \let] " i < 10 " ; } >&3 ; do echo $i ; let ++i ; done >&3 )
|
||||||
}
|
}
|
||||||
function reread_TWHILE { x=$((
|
function reread_TWHILE { x=$((
|
||||||
i=1; while (( i < 10 )) >&3; do echo $i; let ++i; done >&3
|
i=1; while (( i < 10 )) >&3; do echo $i; let ++i; done >&3
|
||||||
)|tr u x); }
|
)|tr u x); }
|
||||||
function reread_TWHILE {
|
function reread_TWHILE {
|
||||||
x=$(( i=1 ; while \let] " i < 10 " >&3 ; do echo $i ; let ++i ; done >&3 ) | tr u x )
|
x=$(( i=1 ; while { \let] " i < 10 " ; } >&3 ; do echo $i ; let ++i ; done >&3 ) | tr u x )
|
||||||
}
|
}
|
||||||
inline_TUNTIL() {
|
inline_TUNTIL() {
|
||||||
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
||||||
}
|
}
|
||||||
inline_TUNTIL() {
|
inline_TUNTIL() {
|
||||||
i=10
|
i=10
|
||||||
until \let] " !--i " >&3
|
until {
|
||||||
|
\let] " !--i "
|
||||||
|
} >&3
|
||||||
do
|
do
|
||||||
echo $i
|
echo $i
|
||||||
done >&3
|
done >&3
|
||||||
@ -11154,13 +11258,13 @@ expected-stdout:
|
|||||||
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
||||||
); }
|
); }
|
||||||
function comsub_TUNTIL {
|
function comsub_TUNTIL {
|
||||||
x=$(i=10 ; until \let] " !--i " >&3 ; do echo $i ; done >&3 )
|
x=$(i=10 ; until { \let] " !--i " ; } >&3 ; do echo $i ; done >&3 )
|
||||||
}
|
}
|
||||||
function reread_TUNTIL { x=$((
|
function reread_TUNTIL { x=$((
|
||||||
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
i=10; until (( !--i )) >&3 ; do echo $i; done >&3
|
||||||
)|tr u x); }
|
)|tr u x); }
|
||||||
function reread_TUNTIL {
|
function reread_TUNTIL {
|
||||||
x=$(( i=10 ; until \let] " !--i " >&3 ; do echo $i ; done >&3 ) | tr u x )
|
x=$(( i=10 ; until { \let] " !--i " ; } >&3 ; do echo $i ; done >&3 ) | tr u x )
|
||||||
}
|
}
|
||||||
inline_TCOPROC() {
|
inline_TCOPROC() {
|
||||||
cat * >&3 |& >&3 ls
|
cat * >&3 |& >&3 ls
|
||||||
@ -11657,6 +11761,16 @@ stdin:
|
|||||||
expected-stdout:
|
expected-stdout:
|
||||||
fxbar 0
|
fxbar 0
|
||||||
---
|
---
|
||||||
|
name: better-parens-5
|
||||||
|
description:
|
||||||
|
Another corner case
|
||||||
|
stdin:
|
||||||
|
( (echo 'fo o$bar' "baz\$bla\"" m\$eh) | tr a A)
|
||||||
|
((echo 'fo o$bar' "baz\$bla\"" m\$eh) | tr a A)
|
||||||
|
expected-stdout:
|
||||||
|
fo o$bAr bAz$blA" m$eh
|
||||||
|
fo o$bAr bAz$blA" m$eh
|
||||||
|
---
|
||||||
name: echo-test-1
|
name: echo-test-1
|
||||||
description:
|
description:
|
||||||
Test what the echo builtin does (mksh)
|
Test what the echo builtin does (mksh)
|
||||||
|
10
lksh.1
10
lksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/lksh.1,v 1.15 2015/10/09 21:36:56 tg Exp $
|
.\" $MirOS: src/bin/mksh/lksh.1,v 1.16 2015/12/12 22:25:14 tg Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
|
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015
|
||||||
.\" mirabilos <m@mirbsd.org>
|
.\" mirabilos <m@mirbsd.org>
|
||||||
@ -72,7 +72,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: October 9 2015 $
|
.Dd $Mdocdate: December 12 2015 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use, and do other -mdoc setup.
|
.\" Check which macro package we use, and do other -mdoc setup.
|
||||||
.\"
|
.\"
|
||||||
@ -302,6 +302,12 @@ instead of locally scoping them.
|
|||||||
.Pp
|
.Pp
|
||||||
.Pa https://www.mirbsd.org/ksh\-chan.htm
|
.Pa https://www.mirbsd.org/ksh\-chan.htm
|
||||||
.Sh CAVEATS
|
.Sh CAVEATS
|
||||||
|
The distinction between the shell variants
|
||||||
|
.Pq Nm lksh / Nm mksh
|
||||||
|
and shell flags
|
||||||
|
.Pq Fl o Ic posix / Ic sh
|
||||||
|
will be reworked for an upcoming release.
|
||||||
|
.Pp
|
||||||
To use
|
To use
|
||||||
.Nm
|
.Nm
|
||||||
as
|
as
|
||||||
|
64
mksh.1
64
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.382 2015/10/09 21:36:57 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.383 2015/12/12 22:25:14 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
@ -74,7 +74,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: October 9 2015 $
|
.Dd $Mdocdate: December 12 2015 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use, and do other -mdoc setup.
|
.\" Check which macro package we use, and do other -mdoc setup.
|
||||||
.\"
|
.\"
|
||||||
@ -914,7 +914,7 @@ is evaluated; equivalent to
|
|||||||
.Sx Arithmetic expressions
|
.Sx Arithmetic expressions
|
||||||
and the
|
and the
|
||||||
.Ic let
|
.Ic let
|
||||||
command, below).
|
command, below) in a compound construct.
|
||||||
.It Bq Bq Ar \ \&expression\ \&
|
.It Bq Bq Ar \ \&expression\ \&
|
||||||
Similar to the
|
Similar to the
|
||||||
.Ic test
|
.Ic test
|
||||||
@ -1625,31 +1625,40 @@ Cannot be applied to a vector.
|
|||||||
.Xc
|
.Xc
|
||||||
.It Xo
|
.It Xo
|
||||||
.Pf ${ Ar name
|
.Pf ${ Ar name
|
||||||
|
.Pf /# Ar pattern / Ar string No }
|
||||||
|
.Xc
|
||||||
|
.It Xo
|
||||||
|
.Pf ${ Ar name
|
||||||
|
.Pf /% Ar pattern / Ar string No }
|
||||||
|
.Xc
|
||||||
|
.It Xo
|
||||||
|
.Pf ${ Ar name
|
||||||
.Pf // Ar pattern / Ar string No }
|
.Pf // Ar pattern / Ar string No }
|
||||||
.Xc
|
.Xc
|
||||||
.Sm on
|
.Sm on
|
||||||
Similar to ${..##..} substitution, but it replaces the longest match of
|
The longest match of
|
||||||
.Ar pattern ,
|
|
||||||
anchored anywhere in the value, with
|
|
||||||
.Ar string .
|
|
||||||
If
|
|
||||||
.Ar pattern
|
.Ar pattern
|
||||||
begins with
|
in the value of parameter
|
||||||
.Ql # ,
|
.Ar name
|
||||||
it is anchored at the beginning of the value; if it begins with
|
is replaced with
|
||||||
.Ql % ,
|
.Ar string
|
||||||
it is anchored at the end.
|
(deleted if
|
||||||
Empty patterns cause no replacement to happen.
|
.Ar string
|
||||||
A single leading
|
is empty; the trailing slash
|
||||||
.Ql /
|
.Pq Ql /
|
||||||
or use of a pattern that matches the empty string causes the
|
may be omitted in that case).
|
||||||
replacement to happen only once; two leading slashes cause
|
A leading slash followed by
|
||||||
all occurrences of matches in the value to be replaced.
|
.Ql #
|
||||||
If the trailing
|
or
|
||||||
.Pf / Ar string
|
.Ql %
|
||||||
is omitted, any matches of
|
causes the pattern to be anchored at the beginning or end of
|
||||||
|
the value, respectively; empty unanchored
|
||||||
|
.Ar pattern Ns s
|
||||||
|
cause no replacement; a single leading slash or use of a
|
||||||
.Ar pattern
|
.Ar pattern
|
||||||
are replaced by the empty string, i.e. deleted.
|
that matches the empty string causes the replacement to
|
||||||
|
happen only once; two leading slashes cause all occurrences
|
||||||
|
of matches in the value to be replaced.
|
||||||
Cannot be applied to a vector.
|
Cannot be applied to a vector.
|
||||||
Inefficiently implemented, may be slow.
|
Inefficiently implemented, may be slow.
|
||||||
.Pp
|
.Pp
|
||||||
@ -3633,7 +3642,7 @@ the parsing or evaluation of an expression, the exit status is greater than 1.
|
|||||||
Since expressions may need to be quoted,
|
Since expressions may need to be quoted,
|
||||||
.No \&(( Ar expr No ))
|
.No \&(( Ar expr No ))
|
||||||
is syntactic sugar for
|
is syntactic sugar for
|
||||||
.No let \&" Ns Ar expr Ns \&" .
|
.No "{ let '" Ns Ar expr Ns "'; }" .
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic let]
|
.It Ic let]
|
||||||
Internally used alias for
|
Internally used alias for
|
||||||
@ -5320,7 +5329,7 @@ The
|
|||||||
builtin does not interpret backslashes and only supports the exact option
|
builtin does not interpret backslashes and only supports the exact option
|
||||||
.Dq Fl n .
|
.Dq Fl n .
|
||||||
.It
|
.It
|
||||||
\&... (list is incomplete)
|
\&... (list is incomplete and may change for R53)
|
||||||
.El
|
.El
|
||||||
.Ss SH mode
|
.Ss SH mode
|
||||||
Compatibility mode; intended for use with legacy scripts that
|
Compatibility mode; intended for use with legacy scripts that
|
||||||
@ -5341,7 +5350,7 @@ The
|
|||||||
builtin does not interpret backslashes and only supports the exact option
|
builtin does not interpret backslashes and only supports the exact option
|
||||||
.Dq Fl n .
|
.Dq Fl n .
|
||||||
.It
|
.It
|
||||||
\&... (list is incomplete)
|
\&... (list is incomplete and may change for R53)
|
||||||
.El
|
.El
|
||||||
.Ss Interactive input line editing
|
.Ss Interactive input line editing
|
||||||
The shell supports three modes of reading command lines from a
|
The shell supports three modes of reading command lines from a
|
||||||
@ -6345,6 +6354,7 @@ contains the system and suid profile.
|
|||||||
.Xr cat 1 ,
|
.Xr cat 1 ,
|
||||||
.Xr ed 1 ,
|
.Xr ed 1 ,
|
||||||
.Xr getopt 1 ,
|
.Xr getopt 1 ,
|
||||||
|
.Xr lksh 1 ,
|
||||||
.Xr sed 1 ,
|
.Xr sed 1 ,
|
||||||
.Xr sh 1 ,
|
.Xr sh 1 ,
|
||||||
.Xr stty 1 ,
|
.Xr stty 1 ,
|
||||||
@ -6565,7 +6575,7 @@ for the in-memory portion of the history is slow, should use
|
|||||||
.Xr memmove 3 .
|
.Xr memmove 3 .
|
||||||
.Pp
|
.Pp
|
||||||
This document attempts to describe
|
This document attempts to describe
|
||||||
.Nm mksh\ R51 Ns -CVS
|
.Nm mksh\ R52
|
||||||
and up,
|
and up,
|
||||||
.\" with vendor patches from insert-your-name-here,
|
.\" with vendor patches from insert-your-name-here,
|
||||||
compiled without any options impacting functionality, such as
|
compiled without any options impacting functionality, such as
|
||||||
|
8
sh.h
8
sh.h
@ -175,9 +175,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.750 2015/10/24 19:45:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.751 2015/12/12 22:25:15 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R51 2015/10/24"
|
#define MKSH_VERSION "R52 2015/12/12"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@ -576,7 +576,7 @@ char *ucstrstr(char *, const char *);
|
|||||||
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 511)
|
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 521)
|
||||||
#error Must run Build.sh to compile this.
|
#error Must run Build.sh to compile this.
|
||||||
extern void thiswillneverbedefinedIhope(void);
|
extern void thiswillneverbedefinedIhope(void);
|
||||||
int
|
int
|
||||||
@ -1998,8 +1998,6 @@ struct op *tcopy(struct op *, Area *);
|
|||||||
char *wdcopy(const char *, Area *);
|
char *wdcopy(const char *, Area *);
|
||||||
const char *wdscan(const char *, int);
|
const char *wdscan(const char *, int);
|
||||||
#define WDS_TPUTS BIT(0) /* tputS (dumpwdvar) mode */
|
#define WDS_TPUTS BIT(0) /* tputS (dumpwdvar) mode */
|
||||||
#define WDS_KEEPQ BIT(1) /* keep quote characters */
|
|
||||||
#define WDS_MAGIC BIT(2) /* make MAGIC */
|
|
||||||
char *wdstrip(const char *, int);
|
char *wdstrip(const char *, int);
|
||||||
void tfree(struct op *, Area *);
|
void tfree(struct op *, Area *);
|
||||||
void dumpchar(struct shf *, int);
|
void dumpchar(struct shf *, int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user