* move <sys/param.h> include to sh.h
* fix compilation and invocation of test suite with whitespace in the pathnames for real, this time * clean up (especially whitespace)
This commit is contained in:
5
Build.sh
5
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.15 2005/06/08 23:02:08 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.16 2005/07/07 23:27:52 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Recognised environment variables and their defaults:
|
# Recognised environment variables and their defaults:
|
||||||
# CC gcc
|
# CC gcc
|
||||||
@ -7,9 +7,8 @@
|
|||||||
# CPPFLAGS (empty)
|
# CPPFLAGS (empty)
|
||||||
# LDFLAGS -static
|
# LDFLAGS -static
|
||||||
# LIBS (empty)
|
# LIBS (empty)
|
||||||
# srcdir (path of script)
|
|
||||||
# NROFF nroff # (ignored if -r option given)
|
# NROFF nroff # (ignored if -r option given)
|
||||||
# GNU/Linux, Mac, Solaris: add -d, maybe -r, CPPFLAGS='-D_FILE_OFFSET_BITS=64'
|
# GNU/Linux, Mac, Solaris: add -d, CPPFLAGS='-D_FILE_OFFSET_BITS=64'
|
||||||
|
|
||||||
SHELL="${SHELL:-/bin/sh}"
|
SHELL="${SHELL:-/bin/sh}"
|
||||||
CC="${CC:-gcc}"
|
CC="${CC:-gcc}"
|
||||||
|
7
check.pl
7
check.pl
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
# $MirOS: src/bin/mksh/check.pl,v 1.6 2005/06/08 21:39:59 tg Exp $
|
# $MirOS: src/bin/mksh/check.pl,v 1.7 2005/07/07 23:27:52 tg Exp $
|
||||||
# $OpenBSD: th,v 1.12 2005/05/28 04:53:47 millert Exp $
|
# $OpenBSD: th,v 1.12 2005/05/28 04:53:47 millert Exp $
|
||||||
#-
|
#-
|
||||||
# Example test:
|
# Example test:
|
||||||
@ -17,7 +17,7 @@
|
|||||||
# + false
|
# + false
|
||||||
# expected-exit: 1
|
# expected-exit: 1
|
||||||
# ---
|
# ---
|
||||||
# This runs the test-program (eg, pdksh) with the arguments -x and -f,
|
# This runs the test-program (eg, mksh) with the arguments -x and -f,
|
||||||
# standard input is a file containing "echo hi*\nfalse\n". The program
|
# standard input is a file containing "echo hi*\nfalse\n". The program
|
||||||
# is expected to produce "hi*" (no trailing newline) on standard output,
|
# is expected to produce "hi*" (no trailing newline) on standard output,
|
||||||
# "+ echo hi*\n+false\n" on standard error, and an exit code of 1.
|
# "+ echo hi*\n+false\n" on standard error, and an exit code of 1.
|
||||||
@ -484,7 +484,6 @@ run_test
|
|||||||
if ($program_kludge) {
|
if ($program_kludge) {
|
||||||
@argv = split(' ', $test_prog);
|
@argv = split(' ', $test_prog);
|
||||||
} else {
|
} else {
|
||||||
$test_prog =~ s/ /\\ /g;
|
|
||||||
@argv = ($test_prog);
|
@argv = ($test_prog);
|
||||||
}
|
}
|
||||||
if (defined $test{'arguments'}) {
|
if (defined $test{'arguments'}) {
|
||||||
@ -493,7 +492,7 @@ run_test
|
|||||||
substr($test{'arguments'}, 1)));
|
substr($test{'arguments'}, 1)));
|
||||||
}
|
}
|
||||||
push(@argv, $temps) if defined $test{'script'};
|
push(@argv, $temps) if defined $test{'script'};
|
||||||
exec(@argv);
|
exec { $argv[0] } @argv;
|
||||||
print STDERR "$prog: couldn't execute $test_prog - $!\n";
|
print STDERR "$prog: couldn't execute $test_prog - $!\n";
|
||||||
kill('TERM', $$);
|
kill('TERM', $$);
|
||||||
exit(95);
|
exit(95);
|
||||||
|
58
check.t
58
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.25 2005/07/07 22:00:45 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.26 2005/07/07 23:27:52 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -222,7 +222,7 @@ description:
|
|||||||
Check interaction of aliases, single quotes and here-documents
|
Check interaction of aliases, single quotes and here-documents
|
||||||
with backslash-newline
|
with backslash-newline
|
||||||
(don't know what posix has to say about this)
|
(don't know what posix has to say about this)
|
||||||
stdin:
|
stdin:
|
||||||
a=2
|
a=2
|
||||||
alias x='echo hi
|
alias x='echo hi
|
||||||
cat << "EOF"
|
cat << "EOF"
|
||||||
@ -445,7 +445,7 @@ description:
|
|||||||
Check that \ at the end of an alias is collapsed when followed
|
Check that \ at the end of an alias is collapsed when followed
|
||||||
by a newline
|
by a newline
|
||||||
(don't know what posix has to say about this)
|
(don't know what posix has to say about this)
|
||||||
stdin:
|
stdin:
|
||||||
alias x='echo hi\'
|
alias x='echo hi\'
|
||||||
x
|
x
|
||||||
echo there
|
echo there
|
||||||
@ -455,7 +455,7 @@ expected-stdout:
|
|||||||
name: blsk-nl-10
|
name: blsk-nl-10
|
||||||
description:
|
description:
|
||||||
Check that \newline in a keyword is collapsed
|
Check that \newline in a keyword is collapsed
|
||||||
stdin:
|
stdin:
|
||||||
i\
|
i\
|
||||||
f true; then\
|
f true; then\
|
||||||
echo pass; el\
|
echo pass; el\
|
||||||
@ -470,7 +470,7 @@ name: blsk-nl-ksh-1
|
|||||||
description:
|
description:
|
||||||
Check that \newline is collapsed in extended globbing
|
Check that \newline is collapsed in extended globbing
|
||||||
(ksh93 fails this)
|
(ksh93 fails this)
|
||||||
stdin:
|
stdin:
|
||||||
xxx=foo
|
xxx=foo
|
||||||
case $xxx in
|
case $xxx in
|
||||||
(f*\
|
(f*\
|
||||||
@ -487,7 +487,7 @@ name: blsk-nl-ksh-2
|
|||||||
description:
|
description:
|
||||||
Check that \newline is collapsed in ((...)) expressions
|
Check that \newline is collapsed in ((...)) expressions
|
||||||
(ksh93 fails this)
|
(ksh93 fails this)
|
||||||
stdin:
|
stdin:
|
||||||
i=1
|
i=1
|
||||||
(\
|
(\
|
||||||
(\
|
(\
|
||||||
@ -1082,7 +1082,7 @@ name: heredoc-1
|
|||||||
description:
|
description:
|
||||||
Check ordering/content of redundent here documents.
|
Check ordering/content of redundent here documents.
|
||||||
stdin:
|
stdin:
|
||||||
cat << EOF1 << EOF2
|
cat << EOF1 << EOF2
|
||||||
hi
|
hi
|
||||||
EOF1
|
EOF1
|
||||||
there
|
there
|
||||||
@ -1134,7 +1134,7 @@ expected-stderr-pattern: /.*/
|
|||||||
name: heredoc-5
|
name: heredoc-5
|
||||||
description:
|
description:
|
||||||
Check that backslash quotes a $, ` and \ and kills a \newline
|
Check that backslash quotes a $, ` and \ and kills a \newline
|
||||||
stdin:
|
stdin:
|
||||||
a=BAD
|
a=BAD
|
||||||
b=ok
|
b=ok
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ -1160,7 +1160,7 @@ name: heredoc-6
|
|||||||
description:
|
description:
|
||||||
Check that \newline in initial here-delim word doesn't imply
|
Check that \newline in initial here-delim word doesn't imply
|
||||||
a quoted here-doc.
|
a quoted here-doc.
|
||||||
stdin:
|
stdin:
|
||||||
a=i
|
a=i
|
||||||
cat << EO\
|
cat << EO\
|
||||||
F
|
F
|
||||||
@ -1176,7 +1176,7 @@ description:
|
|||||||
Check that double quoted $ expressions in here delimiters are
|
Check that double quoted $ expressions in here delimiters are
|
||||||
not expanded and match the delimiter.
|
not expanded and match the delimiter.
|
||||||
POSIX says only quote removal is applied to the delimiter.
|
POSIX says only quote removal is applied to the delimiter.
|
||||||
stdin:
|
stdin:
|
||||||
a=b
|
a=b
|
||||||
cat << "E$a"
|
cat << "E$a"
|
||||||
hi
|
hi
|
||||||
@ -1196,7 +1196,7 @@ description:
|
|||||||
delimiters are not expanded and match the delimiter.
|
delimiters are not expanded and match the delimiter.
|
||||||
POSIX says only quote removal is applied to the delimiter
|
POSIX says only quote removal is applied to the delimiter
|
||||||
(\ counts as a quote).
|
(\ counts as a quote).
|
||||||
stdin:
|
stdin:
|
||||||
a=b
|
a=b
|
||||||
cat << "E\$a"
|
cat << "E\$a"
|
||||||
hi
|
hi
|
||||||
@ -2874,7 +2874,7 @@ script:
|
|||||||
read x y z
|
read x y z
|
||||||
a=x$a
|
a=x$a
|
||||||
done
|
done
|
||||||
echo 1: ${x-x not set} ${y-y not set} ${z-z not set}
|
echo 1: ${x-x not set} ${y-y not set} ${z-z not set}
|
||||||
echo 2: ${x:+x not null} ${y:+y not null} ${z:+z not null}
|
echo 2: ${x:+x not null} ${y:+y not null} ${z:+z not null}
|
||||||
stdin:
|
stdin:
|
||||||
a A Aa
|
a A Aa
|
||||||
@ -2921,7 +2921,7 @@ description:
|
|||||||
Command substitution breaks reading in while loop
|
Command substitution breaks reading in while loop
|
||||||
(test from <sjg@void.zen.oz.au>)
|
(test from <sjg@void.zen.oz.au>)
|
||||||
stdin:
|
stdin:
|
||||||
(echo abcdef; echo; echo 123) |
|
(echo abcdef; echo; echo 123) |
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
# the following line breaks it
|
# the following line breaks it
|
||||||
@ -2949,7 +2949,7 @@ stdin:
|
|||||||
if false; then echo hi ; fi
|
if false; then echo hi ; fi
|
||||||
false || true
|
false || true
|
||||||
false && true
|
false && true
|
||||||
while false; do echo hi; done
|
while false; do echo hi; done
|
||||||
echo ok
|
echo ok
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
ok
|
ok
|
||||||
@ -3066,7 +3066,7 @@ description:
|
|||||||
Check that (here doc) temp files are not left behind after an exec.
|
Check that (here doc) temp files are not left behind after an exec.
|
||||||
stdin:
|
stdin:
|
||||||
mkdir foo || exit 1
|
mkdir foo || exit 1
|
||||||
TMPDIR=$PWD/foo $0 <<- 'EOF'
|
TMPDIR=$PWD/foo "$0" <<- 'EOF'
|
||||||
x() {
|
x() {
|
||||||
sed 's/^/X /' << E_O_F
|
sed 's/^/X /' << E_O_F
|
||||||
hi
|
hi
|
||||||
@ -3079,7 +3079,7 @@ stdin:
|
|||||||
exec $echo subtest-1 hi
|
exec $echo subtest-1 hi
|
||||||
EOF
|
EOF
|
||||||
echo subtest-1 foo/*
|
echo subtest-1 foo/*
|
||||||
TMPDIR=$PWD/foo $0 <<- 'EOF'
|
TMPDIR=$PWD/foo "$0" <<- 'EOF'
|
||||||
echo=echo; [ -x /bin/echo ] && echo=/bin/echo
|
echo=echo; [ -x /bin/echo ] && echo=/bin/echo
|
||||||
sed 's/^/X /' << E_O_F; exec $echo subtest-2 hi
|
sed 's/^/X /' << E_O_F; exec $echo subtest-2 hi
|
||||||
a
|
a
|
||||||
@ -3127,7 +3127,7 @@ stdin:
|
|||||||
alias foo='echo hi ; '
|
alias foo='echo hi ; '
|
||||||
foo
|
foo
|
||||||
foo echo there
|
foo echo there
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
hi
|
hi
|
||||||
hi
|
hi
|
||||||
there
|
there
|
||||||
@ -3141,7 +3141,7 @@ stdin:
|
|||||||
set a b c
|
set a b c
|
||||||
set -o noglob +o allexport
|
set -o noglob +o allexport
|
||||||
echo A: $*, *
|
echo A: $*, *
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
A: a b c, *
|
A: a b c, *
|
||||||
---
|
---
|
||||||
name: regression-52
|
name: regression-52
|
||||||
@ -3158,7 +3158,7 @@ stdin:
|
|||||||
echo mark 1
|
echo mark 1
|
||||||
sed 's/^/X /' < ab* | sed 's/^/Y /'
|
sed 's/^/X /' < ab* | sed 's/^/Y /'
|
||||||
echo mark 2
|
echo mark 2
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
X stuff
|
X stuff
|
||||||
mark 1
|
mark 1
|
||||||
Y X stuff
|
Y X stuff
|
||||||
@ -3227,7 +3227,7 @@ stdin:
|
|||||||
echo "line 50: OPTIND=$OPTIND"
|
echo "line 50: OPTIND=$OPTIND"
|
||||||
getopts kbfl optc
|
getopts kbfl optc
|
||||||
echo "line 60: ret=$?, optc=$optc, OPTIND=$OPTIND"
|
echo "line 60: ret=$?, optc=$optc, OPTIND=$OPTIND"
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
line 1: OPTIND=1
|
line 1: OPTIND=1
|
||||||
line 2: ret=0, optc=f, OPTIND=2
|
line 2: ret=0, optc=f, OPTIND=2
|
||||||
bfunc: enter (args: -BBB blah; OPTIND=2)
|
bfunc: enter (args: -BBB blah; OPTIND=2)
|
||||||
@ -3270,7 +3270,7 @@ stdin:
|
|||||||
if [[ -n 1 ]] then
|
if [[ -n 1 ]] then
|
||||||
echo ok dbrackets
|
echo ok dbrackets
|
||||||
fi
|
fi
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
ok dparen
|
ok dparen
|
||||||
ok dbrackets
|
ok dbrackets
|
||||||
---
|
---
|
||||||
@ -3287,7 +3287,7 @@ stdin:
|
|||||||
echo 6 ${x:#*X}
|
echo 6 ${x:#*X}
|
||||||
echo 7 ${x##*X}
|
echo 7 ${x##*X}
|
||||||
echo 8 ${x:##*X}
|
echo 8 ${x:##*X}
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
1 fooXbar
|
1 fooXbar
|
||||||
2 fooXbar
|
2 fooXbar
|
||||||
3 foo
|
3 foo
|
||||||
@ -3315,7 +3315,7 @@ stdin:
|
|||||||
IFS="$IFS:"
|
IFS="$IFS:"
|
||||||
eval $(echo :; false)
|
eval $(echo :; false)
|
||||||
echo F $?
|
echo F $?
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
A 1
|
A 1
|
||||||
B 1
|
B 1
|
||||||
C 1
|
C 1
|
||||||
@ -3339,7 +3339,7 @@ stdin:
|
|||||||
typeset -i | grep xxx | sed 's/^/ /'
|
typeset -i | grep xxx | sed 's/^/ /'
|
||||||
echo N
|
echo N
|
||||||
typeset | grep xxx | sed 's/^/ /'
|
typeset | grep xxx | sed 's/^/ /'
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
A
|
A
|
||||||
xxx
|
xxx
|
||||||
B
|
B
|
||||||
@ -3355,7 +3355,7 @@ description:
|
|||||||
stdin:
|
stdin:
|
||||||
trap 'echo hi' exit
|
trap 'echo hi' exit
|
||||||
trap exit 1
|
trap exit 1
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
hi
|
hi
|
||||||
---
|
---
|
||||||
name: regression-59
|
name: regression-59
|
||||||
@ -3365,7 +3365,7 @@ stdin:
|
|||||||
a[12]=hi
|
a[12]=hi
|
||||||
a[8]=there
|
a[8]=there
|
||||||
echo ${#a[*]}
|
echo ${#a[*]}
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
2
|
2
|
||||||
---
|
---
|
||||||
name: regression-60
|
name: regression-60
|
||||||
@ -3378,7 +3378,7 @@ stdin:
|
|||||||
echo B $?
|
echo B $?
|
||||||
( (exit 103) ; exit)
|
( (exit 103) ; exit)
|
||||||
echo C $?
|
echo C $?
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
A 0
|
A 0
|
||||||
B 1
|
B 1
|
||||||
C 103
|
C 103
|
||||||
@ -3393,7 +3393,7 @@ stdin:
|
|||||||
echo B
|
echo B
|
||||||
(echo C; trap 'echo sub exit' EXIT; echo C last)
|
(echo C; trap 'echo sub exit' EXIT; echo C last)
|
||||||
echo parent last
|
echo parent last
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
start
|
start
|
||||||
A
|
A
|
||||||
A last
|
A last
|
||||||
@ -3411,7 +3411,7 @@ stdin:
|
|||||||
touch a
|
touch a
|
||||||
test a -nt b && echo nt OK || echo nt BAD
|
test a -nt b && echo nt OK || echo nt BAD
|
||||||
test b -ot a && echo ot OK || echo ot BAD
|
test b -ot a && echo ot OK || echo ot BAD
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
nt OK
|
nt OK
|
||||||
ot OK
|
ot OK
|
||||||
---
|
---
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
/** $MirOS: src/bin/mksh/histrap.c,v 1.9 2005/06/24 15:36:57 tg Exp $ */
|
/** $MirOS: src/bin/mksh/histrap.c,v 1.10 2005/07/07 23:27:52 tg Exp $ */
|
||||||
/* $OpenBSD: history.c,v 1.30 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: history.c,v 1.30 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: trap.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: trap.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
#include <sys/param.h> /* for BSD */
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.9 2005/06/24 15:36:57 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.10 2005/07/07 23:27:52 tg Exp $");
|
||||||
|
|
||||||
static int histfd;
|
static int histfd;
|
||||||
static int hsize;
|
static int hsize;
|
||||||
|
5
misc.c
5
misc.c
@ -1,13 +1,12 @@
|
|||||||
/** $MirOS: src/bin/mksh/misc.c,v 1.6 2005/07/04 12:34:23 tg Exp $ */
|
/** $MirOS: src/bin/mksh/misc.c,v 1.7 2005/07/07 23:27:52 tg Exp $ */
|
||||||
/* $OpenBSD: misc.c,v 1.28 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: misc.c,v 1.28 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/param.h> /* for MAXPATHLEN */
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.6 2005/07/04 12:34:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.7 2005/07/07 23:27:52 tg Exp $");
|
||||||
|
|
||||||
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
|
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
|
||||||
|
|
||||||
|
4
sh.h
4
sh.h
@ -1,4 +1,4 @@
|
|||||||
/** $MirOS: src/bin/mksh/sh.h,v 1.15 2005/07/05 22:00:20 tg Exp $ */
|
/** $MirOS: src/bin/mksh/sh.h,v 1.16 2005/07/07 23:27:52 tg Exp $ */
|
||||||
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
|
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
|
||||||
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
|
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#define _ALL_SOURCE
|
#define _ALL_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#if defined(__gnu_linux__) && !defined(_POSIX_SOURCE)
|
#if defined(__gnu_linux__) && !defined(_POSIX_SOURCE)
|
||||||
#define _POSIX_SOURCE
|
#define _POSIX_SOURCE
|
||||||
|
Reference in New Issue
Block a user