From 041666eefb08ddb0fe888265e89d128e60eb7b5d Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 9 Jul 2015 19:28:21 +0000 Subject: [PATCH] a few more mksh-os2 inspired fixes --- Build.sh | 21 +++++++++++++++------ check.t | 8 ++++---- main.c | 4 ++-- sh.h | 9 ++++++++- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Build.sh b/Build.sh index 82cf6e3..60263ea 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.683 2015/07/09 19:19:09 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.684 2015/07/09 19:28:17 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015 @@ -578,8 +578,8 @@ if test -d $tfn || test -d $tfn.exe; then echo "$me: Error: ./$tfn is a directory!" >&2 exit 1 fi -rmf a.exe* a.out* conftest.c *core core.* ${tfn}* *.bc *.dbg *.ll *.o *.gen \ - Rebuild.sh lft no signames.inc test.sh x vv.out +rmf a.exe* a.out* conftest.c conftest.exe* *core core.* ${tfn}* *.bc *.dbg \ + *.ll *.o *.gen Rebuild.sh lft no signames.inc test.sh x vv.out SRCS="lalloc.c eval.c exec.c expr.c funcs.c histrap.c jobs.c" SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c" @@ -831,7 +831,11 @@ OpenBSD) : ${HAVE_SETLOCALE_CTYPE=0} ;; OS/2) + HAVE_MKNOD=0 # setmode() incompatible + oswarn="; it is currently being ported" + check_categories="$check_categories nosymlink" : ${CC=gcc} + : ${SIZE=: size} ;; OSF1) HAVE_SIG_T=0 # incompatible @@ -1237,7 +1241,7 @@ unknown) ;; esac $e "$bi==> which compiler seems to be used...$ao $ui$ct${et+ on $et}$ao" -rmf conftest.c conftest.o conftest a.out* a.exe* vv.out +rmf conftest.c conftest.o conftest a.out* a.exe* conftest.exe* vv.out # # Compiler: works as-is, with -Wno-error and -Werror @@ -2341,8 +2345,13 @@ files= objs= sp= case $tcfn in -a.exe|conftest.exe) mkshexe=$tfn.exe ;; -*) mkshexe=$tfn ;; +a.exe|conftest.exe) + mkshexe=$tfn.exe + add_cppflags -DMKSH_EXE_EXT + ;; +*) + mkshexe=$tfn + ;; esac case $curdir in *\ *) mkshshebang="#!./$mkshexe" ;; diff --git a/check.t b/check.t index 2b461d0..b3a377f 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.699 2015/07/06 17:48:29 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.700 2015/07/09 19:28:18 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -2075,9 +2075,9 @@ expected-stdout: name: glob-bad-2 description: Check that symbolic links aren't stat()'d -# breaks on FreeMiNT (cannot unlink dangling symlinks) -# breaks on MSYS (does not support symlinks) # breaks on Dell UNIX 4.0 R2.2 (SVR4) where unlink also fails +# breaks on FreeMiNT (cannot unlink dangling symlinks) +# breaks on MSYS, OS/2 (do not support symlinks) category: !os:mint,!os:msys,!os:svr4.0,!nosymlink file-setup: dir 755 "dir" file-setup: symlink 644 "dir/abc" @@ -2132,7 +2132,7 @@ description: # breaks on Mac OSX (HFS+ non-standard Unicode canonical decomposition) # breaks on Cygwin 1.7 (files are now UTF-16 or something) # breaks on QNX 6.4.1 (says RT) -category: !os:cygwin,!os:darwin,!os:msys,!os:nto +category: !os:cygwin,!os:darwin,!os:msys,!os:nto,!os:os2 need-pass: no file-setup: file 644 "aÂc" stdin: diff --git a/main.c b/main.c index 2e0b576..d45c83a 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.296 2015/07/09 19:19:10 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.297 2015/07/09 19:28:20 tg Exp $"); extern char **environ; @@ -264,7 +264,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) #if defined(MKSH_BINSHPOSIX) || defined(MKSH_BINSHREDUCED) /* are we called as -sh or /bin/sh or so? */ - if (!strcmp(ccp, "sh")) { + if (!strcmp(ccp, "sh" MKSH_EXE_EXT)) { /* either also turns off braceexpand */ #ifdef MKSH_BINSHPOSIX /* enable better POSIX conformance */ diff --git a/sh.h b/sh.h index 23c7e5a..c6807cd 100644 --- a/sh.h +++ b/sh.h @@ -169,7 +169,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.734 2015/07/06 17:48:37 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.735 2015/07/09 19:28:21 tg Exp $"); #endif #define MKSH_VERSION "R51 2015/07/06" @@ -375,6 +375,13 @@ struct rusage { /* OS-dependent additions (functions, variables, by OS) */ +#ifdef MKSH_EXE_EXT +#undef MKSH_EXE_EXT +#define MKSH_EXE_EXT ".exe" +#else +#define MKSH_EXE_EXT "" +#endif + #if !HAVE_FLOCK_DECL extern int flock(int, int); #endif