• Add support for Ultrix 4.5 and ucode cc (?)

‣ I/O redirection seems broken:
    $ (date; date >/dev/null; date) | wc -l
    1 (expected: 2)
  ‣ other than that: working fine
  ‣ -YBSD (default) and -YSYSTEM_FIVE don’t work, just -YPOSIX, somehow
• Fix $(…) to `…` for OSF/1 V2.0 /bin/sh
  ‣ this compiler is FUBAR though:
	$ cat >t.c
	main() { return (foo()); }
	$ cc t.c
	ld:
	Unresolved :
	foo
	$ echo $?
	0
	$ ls -l a.out
	-rwxr-xr-x   1 mirbsd   users      10835 Jul 21 17:12 a.out
  ‣ it seems to have ucode, but man is not installed
• new mirtoconf check: mkstemp(3)
• if !HAVE_MKSTEMP (Ultrix), use tempnam(3)
• only use printf(1) if it exists (it doesn’t on Ultrix)
• a few more signals
• add S_ISLNK if the OS doesn’t define it
• add strcasecmp(3) proto for Ultrix (it _is_ in <portability.h>, but
  only for -YBSD I think)
• fgrep(1) on Ultrix doesn’t do “-e ① -e ②”

10x DEChengst:#UnixNL for giving access
This commit is contained in:
tg 2008-03-25 21:34:45 +00:00
parent b8b52a7c92
commit def9c172df
5 changed files with 69 additions and 22 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.298 2008/03/25 20:25:27 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.299 2008/03/25 21:34:42 tg Exp $'
#-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
@ -337,6 +337,12 @@ syllable)
: ${HAVE_FLOCK_EX=0}
warn=' and will currently not work'
;;
ULTRIX)
: ${CC=cc -YPOSIX}
CPPFLAGS="$CPPFLAGS -Dssize_t=int"
warn=' but might work. I think that I/O'
warn="$warn${nl}redirs are kaput: child affects parent"
;;
UWIN*)
ccpc='-Yc,'
ccpl='-Yl,'
@ -415,6 +421,8 @@ cat >scn.c <<-'EOF'
ct=gcc
#elif defined(__hpux)
ct=hpcc
#elif defined(__ultrix)
ct=ucode
#else
ct=unknown
#endif
@ -446,12 +454,12 @@ msc)
case $TARGET_OS in
Interix)
if [[ -n $C89_COMPILER ]]; then
C89_COMPILER=$(ntpath2posix -c "$C89_COMPILER")
C89_COMPILER=`ntpath2posix -c "$C89_COMPILER"`
else
C89_COMPILER=CL.EXE
fi
if [[ -n $C89_LINKER ]]; then
C89_LINKER=$(ntpath2posix -c "$C89_LINKER")
C89_LINKER=`ntpath2posix -c "$C89_LINKER"`
else
C89_LINKER=LINK.EXE
fi
@ -466,6 +474,9 @@ pcc|sunpro|tcc)
tendra)
vv '|' "$CC -V 2>&1 | fgrep -i -e version -e release"
;;
ucode)
vv '|' "$CC -V"
;;
xlc)
vv '|' "$CC -qversion=verbose"
;;
@ -550,6 +561,9 @@ elif test $ct = xlc; then
DOWARN=-qflag=i:i
elif test $ct = tendra; then
save_NOWARN=-w
elif test $ct = ucode; then
save_NOWARN=
DOWARN=-w2
else
test x"$save_NOWARN" = x"" && save_NOWARN=-Wno-error
ac_flags 0 wnoerror "$save_NOWARN"
@ -901,6 +915,11 @@ ac_test flock_ex '' 'flock and mmap' <<-'EOF'
MAP_FILE | MAP_PRIVATE, 0, 0) == NULL ? 1 : 0); }
EOF
ac_test mkstemp <<-'EOF'
#include <stdlib.h>
int main(void) { char tmpl[] = "X"; return (mkstemp(tmpl)); }
EOF
ac_test setlocale_ctype '!' mksh_defutf8 0 'setlocale(LC_CTYPE, "")' <<-'EOF'
#include <locale.h>
#include <stddef.h>
@ -1059,28 +1078,30 @@ if test 0 = $HAVE_SYS_SIGNAME; then
case $NSIG in
*[\ \(\)+-]*) NSIG=`awk "BEGIN { print $NSIG }"` ;;
esac
NSIG=`printf %d "$NSIG" 2>/dev/null`
test 1 = $h && printf "NSIG=$NSIG ... "
signames="ABRT ALRM BUS CHLD CLD CONT EMT FPE HUP ILL INFO INT IO IOT"
signames="$signames KILL PIPE PROF PWR QUIT SAK SEGV STOP SYS TERM"
signames="$signames TRAP TSTP TTIN TTOU URG USR1 USR2 WINCH XCPU XFSZ"
test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && signames="$signames "`vq \
printf=printf
printf hallo >/dev/null 2>&1 || printf=echo
test $printf = echo || NSIG=`printf %d "$NSIG" 2>/dev/null`
test 1 = $h && $printf "NSIG=$NSIG ... "
sigs="ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INFO INT IO IOT"
sigs="$sigs KILL LOST PIPE PROF PWR QUIT RESV SAK SEGV STOP SYS TERM"
sigs="$sigs TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ"
test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && sigs="$sigs "`vq \
"$CPP $CPPFLAGS -dD scn.c" | grep '[ ]SIG[A-Z0-9]*[ ]' | \
sed 's/^\(.*[ ]SIG\)\([A-Z0-9]*\)\([ ].*\)$/\2/' | sort`
test $NSIG -gt 1 || signames=
for name in $signames; do
test $NSIG -gt 1 || sigs=
for name in $sigs; do
echo '#include <signal.h>' >scn.c
echo mksh_cfg: SIG$name >>scn.c
vq "$CPP $CPPFLAGS scn.c" | grep mksh_cfg: | \
sed 's/^mksh_cfg:[ ]*\([0-9x]*\).*$/\1:'$name/
done | grep -v '^:' | while IFS=: read nr name; do
nr=`printf %d "$nr" 2>/dev/null`
test $printf = echo || nr=`printf %d "$nr" 2>/dev/null`
test $nr -gt 0 && test $nr -le $NSIG || continue
case $sigseen in
*:$nr:*) ;;
*) echo " { $nr, \"$name\" },"
sigseen=$sigseen$nr:
test 1 = $h && printf "$name=$nr " >&2
test 1 = $h && $printf "$name=$nr " >&2
;;
esac
done 2>&1 >signames.inc
@ -1100,7 +1121,8 @@ case $curdir in
esac
echo "export PATH='$PATH'" >>test.sh
echo "print Testing mksh for conformance:" >>test.sh
echo "fgrep -e MirOS: -e MIRBSD '$srcdir/check.t'" >>test.sh
echo "fgrep MirOS: '$srcdir/check.t'" >>test.sh
echo "fgrep MIRBSD '$srcdir/check.t'" >>test.sh
echo 'print "This shell is actually:\n\t$KSH_VERSION"' >>test.sh
echo "print 'test.sh built for mksh $dstversion'" >>test.sh
echo "perl=perl5" >>test.sh

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.54 2008/03/05 18:49:15 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.55 2008/03/25 21:34:44 tg Exp $
#-
# use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff
@ -17,7 +17,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \
-DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 -DHAVE_STDINT_H=1 \
-DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 \
-DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \
-DHAVE_ARC4RANDOM_PUSHB=1 -DHAVE_FLOCK_EX=1 \
-DHAVE_ARC4RANDOM_PUSHB=1 -DHAVE_FLOCK_EX=1 -DHAVE_MKSTEMP=1 \
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
-DHAVE_MKNOD=1 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.161 2008/03/23 22:09:57 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.162 2008/03/25 21:34:44 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 $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R33 2008/03/23
@(#)MIRBSD KSH R33 2008/03/25
description:
Check version of shell.
category: pdksh

22
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.92 2008/03/01 13:57:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.93 2008/03/25 21:34:44 tg Exp $");
extern char **environ;
@ -1113,13 +1113,31 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist)
const char *dir;
dir = tmpdir ? tmpdir : "/tmp";
#if HAVE_MKSTEMP
len = strlen(dir) + 6 + 10 + 1;
#else
pathname = tempnam(dir, "mksh.");
len = ((pathname == NULL) ? 0 : strlen(pathname)) + 1;
#endif
tp = (struct temp *) alloc(sizeof(struct temp) + len, ap);
tp->name = pathname = (char *)&tp[1];
tp->name = (char *)&tp[1];
#if !HAVE_MKSTEMP
if (pathname == NULL)
tp->name[0] = '\0';
else {
memcpy(tp->name, pathname, len);
free(pathname);
}
#endif
pathname = tp->name;
tp->shf = NULL;
tp->type = type;
#if HAVE_MKSTEMP
shf_snprintf(pathname, len, "%s/mksh.XXXXXXXXXX", dir);
if ((fd = mkstemp(pathname)) >= 0)
#else
if (tp->name[0] && (fd = open(tp->name, O_CREAT | O_RDWR, 0600)) >= 0)
#endif
tp->shf = shf_fdopen(fd, SHF_WR, NULL);
tp->pid = procpid;

11
sh.h
View File

@ -8,8 +8,8 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.197 2008/03/23 22:09:59 tg Exp $"
#define MKSH_VERSION "R33 2008/03/23"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.198 2008/03/25 21:34:45 tg Exp $"
#define MKSH_VERSION "R33 2008/03/25"
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
@ -167,6 +167,9 @@ typedef int bool;
#ifndef S_ISTXT
#define S_ISTXT 0001000
#endif
#ifndef S_ISLNK
#define S_ISLNK(m) ((m & 0170000) == 0120000)
#endif
#ifndef S_ISSOCK
#define S_ISSOCK(m) ((m & 0170000) == 0140000)
#endif
@ -221,6 +224,10 @@ mode_t getmode(const void *, mode_t);
void *setmode(const char *);
#endif
#ifdef __ultrix
int strcasecmp(const char *, const char *);
#endif
#if !HAVE_STRCASESTR
const char *stristr(const char *, const char *);
#endif