* 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:
tg 2005-07-07 23:27:52 +00:00
parent 3506838417
commit ee7992988b
6 changed files with 40 additions and 44 deletions

View File

@ -1,5 +1,5 @@
#!/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:
# CC gcc
@ -7,9 +7,8 @@
# CPPFLAGS (empty)
# LDFLAGS -static
# LIBS (empty)
# srcdir (path of script)
# 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}"
CC="${CC:-gcc}"

View File

@ -1,5 +1,5 @@
#!/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 $
#-
# Example test:
@ -17,7 +17,7 @@
# + false
# 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
# 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.
@ -484,7 +484,6 @@ run_test
if ($program_kludge) {
@argv = split(' ', $test_prog);
} else {
$test_prog =~ s/ /\\ /g;
@argv = ($test_prog);
}
if (defined $test{'arguments'}) {
@ -493,7 +492,7 @@ run_test
substr($test{'arguments'}, 1)));
}
push(@argv, $temps) if defined $test{'script'};
exec(@argv);
exec { $argv[0] } @argv;
print STDERR "$prog: couldn't execute $test_prog - $!\n";
kill('TERM', $$);
exit(95);

58
check.t
View File

@ -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: 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 $
@ -222,7 +222,7 @@ description:
Check interaction of aliases, single quotes and here-documents
with backslash-newline
(don't know what posix has to say about this)
stdin:
stdin:
a=2
alias x='echo hi
cat << "EOF"
@ -445,7 +445,7 @@ description:
Check that \ at the end of an alias is collapsed when followed
by a newline
(don't know what posix has to say about this)
stdin:
stdin:
alias x='echo hi\'
x
echo there
@ -455,7 +455,7 @@ expected-stdout:
name: blsk-nl-10
description:
Check that \newline in a keyword is collapsed
stdin:
stdin:
i\
f true; then\
echo pass; el\
@ -470,7 +470,7 @@ name: blsk-nl-ksh-1
description:
Check that \newline is collapsed in extended globbing
(ksh93 fails this)
stdin:
stdin:
xxx=foo
case $xxx in
(f*\
@ -487,7 +487,7 @@ name: blsk-nl-ksh-2
description:
Check that \newline is collapsed in ((...)) expressions
(ksh93 fails this)
stdin:
stdin:
i=1
(\
(\
@ -1082,7 +1082,7 @@ name: heredoc-1
description:
Check ordering/content of redundent here documents.
stdin:
cat << EOF1 << EOF2
cat << EOF1 << EOF2
hi
EOF1
there
@ -1134,7 +1134,7 @@ expected-stderr-pattern: /.*/
name: heredoc-5
description:
Check that backslash quotes a $, ` and \ and kills a \newline
stdin:
stdin:
a=BAD
b=ok
cat << EOF
@ -1160,7 +1160,7 @@ name: heredoc-6
description:
Check that \newline in initial here-delim word doesn't imply
a quoted here-doc.
stdin:
stdin:
a=i
cat << EO\
F
@ -1176,7 +1176,7 @@ description:
Check that double quoted $ expressions in here delimiters are
not expanded and match the delimiter.
POSIX says only quote removal is applied to the delimiter.
stdin:
stdin:
a=b
cat << "E$a"
hi
@ -1196,7 +1196,7 @@ description:
delimiters are not expanded and match the delimiter.
POSIX says only quote removal is applied to the delimiter
(\ counts as a quote).
stdin:
stdin:
a=b
cat << "E\$a"
hi
@ -2874,7 +2874,7 @@ script:
read x y z
a=x$a
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}
stdin:
a A Aa
@ -2921,7 +2921,7 @@ description:
Command substitution breaks reading in while loop
(test from <sjg@void.zen.oz.au>)
stdin:
(echo abcdef; echo; echo 123) |
(echo abcdef; echo; echo 123) |
while read line
do
# the following line breaks it
@ -2949,7 +2949,7 @@ stdin:
if false; then echo hi ; fi
false || true
false && true
while false; do echo hi; done
while false; do echo hi; done
echo ok
expected-stdout:
ok
@ -3066,7 +3066,7 @@ description:
Check that (here doc) temp files are not left behind after an exec.
stdin:
mkdir foo || exit 1
TMPDIR=$PWD/foo $0 <<- 'EOF'
TMPDIR=$PWD/foo "$0" <<- 'EOF'
x() {
sed 's/^/X /' << E_O_F
hi
@ -3079,7 +3079,7 @@ stdin:
exec $echo subtest-1 hi
EOF
echo subtest-1 foo/*
TMPDIR=$PWD/foo $0 <<- 'EOF'
TMPDIR=$PWD/foo "$0" <<- 'EOF'
echo=echo; [ -x /bin/echo ] && echo=/bin/echo
sed 's/^/X /' << E_O_F; exec $echo subtest-2 hi
a
@ -3127,7 +3127,7 @@ stdin:
alias foo='echo hi ; '
foo
foo echo there
expected-stdout:
expected-stdout:
hi
hi
there
@ -3141,7 +3141,7 @@ stdin:
set a b c
set -o noglob +o allexport
echo A: $*, *
expected-stdout:
expected-stdout:
A: a b c, *
---
name: regression-52
@ -3158,7 +3158,7 @@ stdin:
echo mark 1
sed 's/^/X /' < ab* | sed 's/^/Y /'
echo mark 2
expected-stdout:
expected-stdout:
X stuff
mark 1
Y X stuff
@ -3227,7 +3227,7 @@ stdin:
echo "line 50: OPTIND=$OPTIND"
getopts kbfl optc
echo "line 60: ret=$?, optc=$optc, OPTIND=$OPTIND"
expected-stdout:
expected-stdout:
line 1: OPTIND=1
line 2: ret=0, optc=f, OPTIND=2
bfunc: enter (args: -BBB blah; OPTIND=2)
@ -3270,7 +3270,7 @@ stdin:
if [[ -n 1 ]] then
echo ok dbrackets
fi
expected-stdout:
expected-stdout:
ok dparen
ok dbrackets
---
@ -3287,7 +3287,7 @@ stdin:
echo 6 ${x:#*X}
echo 7 ${x##*X}
echo 8 ${x:##*X}
expected-stdout:
expected-stdout:
1 fooXbar
2 fooXbar
3 foo
@ -3315,7 +3315,7 @@ stdin:
IFS="$IFS:"
eval $(echo :; false)
echo F $?
expected-stdout:
expected-stdout:
A 1
B 1
C 1
@ -3339,7 +3339,7 @@ stdin:
typeset -i | grep xxx | sed 's/^/ /'
echo N
typeset | grep xxx | sed 's/^/ /'
expected-stdout:
expected-stdout:
A
xxx
B
@ -3355,7 +3355,7 @@ description:
stdin:
trap 'echo hi' exit
trap exit 1
expected-stdout:
expected-stdout:
hi
---
name: regression-59
@ -3365,7 +3365,7 @@ stdin:
a[12]=hi
a[8]=there
echo ${#a[*]}
expected-stdout:
expected-stdout:
2
---
name: regression-60
@ -3378,7 +3378,7 @@ stdin:
echo B $?
( (exit 103) ; exit)
echo C $?
expected-stdout:
expected-stdout:
A 0
B 1
C 103
@ -3393,7 +3393,7 @@ stdin:
echo B
(echo C; trap 'echo sub exit' EXIT; echo C last)
echo parent last
expected-stdout:
expected-stdout:
start
A
A last
@ -3411,7 +3411,7 @@ stdin:
touch a
test a -nt b && echo nt OK || echo nt BAD
test b -ot a && echo ot OK || echo ot BAD
expected-stdout:
expected-stdout:
nt OK
ot OK
---

View File

@ -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: trap.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h"
#include <sys/param.h> /* for BSD */
#include <sys/file.h>
#include <sys/mman.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 hsize;

5
misc.c
View File

@ -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: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h"
#include <sys/ioctl.h>
#include <sys/param.h> /* for MAXPATHLEN */
#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 */

4
sh.h
View File

@ -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: 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 $ */
@ -13,7 +13,7 @@
#define _ALL_SOURCE
#endif
#include <sys/types.h>
#include <sys/param.h>
#if defined(__gnu_linux__) && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE