more easy OS/2 fixes
From: KO Myung-Hun <komh@chollian.net>
This commit is contained in:
parent
041666eefb
commit
950827394b
4
Build.sh
4
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.684 2015/07/09 19:28:17 tg Exp $'
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.685 2015/07/09 19:46:40 tg Exp $'
|
||||
#-
|
||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012, 2013, 2014, 2015
|
||||
@ -836,6 +836,8 @@ OS/2)
|
||||
check_categories="$check_categories nosymlink"
|
||||
: ${CC=gcc}
|
||||
: ${SIZE=: size}
|
||||
add_cppflags -DMKSH_UNEMPLOYED
|
||||
add_cppflags -DMKSH_NOPROSPECTOFWORK
|
||||
;;
|
||||
OSF1)
|
||||
HAVE_SIG_T=0 # incompatible
|
||||
|
13
exec.c
13
exec.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.155 2015/07/06 17:48:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.156 2015/07/09 19:46:41 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||
@ -930,10 +930,15 @@ scriptexec(struct op *tp, const char **ap)
|
||||
/* restore begin of shebang position (buf+0 or buf+3) */
|
||||
cp = buf + n;
|
||||
/* bail out if no shebang magic found */
|
||||
if ((cp[0] != '#') || (cp[1] != '!'))
|
||||
if (cp[0] == '#' && cp[1] == '!')
|
||||
cp += 2;
|
||||
#ifdef __OS2__
|
||||
else if (!strncmp(cp, Textproc, 7) &&
|
||||
(cp[7] == ' ' || cp[7] == '\t'))
|
||||
cp += 8;
|
||||
#endif
|
||||
else
|
||||
goto noshebang;
|
||||
|
||||
cp += 2;
|
||||
/* skip whitespace before shell name */
|
||||
while (*cp == ' ' || *cp == '\t')
|
||||
++cp;
|
||||
|
5
funcs.c
5
funcs.c
@ -38,7 +38,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.277 2015/07/06 17:48:32 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.278 2015/07/09 19:46:41 tg Exp $");
|
||||
|
||||
#if HAVE_KILLPG
|
||||
/*
|
||||
@ -160,6 +160,9 @@ const struct builtin mkshbuiltins[] = {
|
||||
#ifdef __MirBSD__
|
||||
/* alias to "true" for historical reasons */
|
||||
{"domainname", c_true},
|
||||
#endif
|
||||
#ifdef __OS2__
|
||||
{Textproc, c_true},
|
||||
#endif
|
||||
{NULL, (int (*)(const char **))NULL}
|
||||
};
|
||||
|
14
main.c
14
main.c
@ -34,7 +34,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.297 2015/07/09 19:28:20 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.298 2015/07/09 19:46:42 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -454,7 +454,19 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
||||
kshname = argv[argi++];
|
||||
} else if (argi < argc && !Flag(FSTDIN)) {
|
||||
s = pushs(SFILE, ATEMP);
|
||||
#ifdef __OS2__
|
||||
/*
|
||||
* A bug in OS/2 extproc (like shebang) handling makes
|
||||
* it not pass the full pathname of a script, so we need
|
||||
* to search for it. This changes the behaviour of a
|
||||
* simple "mksh foo", but can't be helped.
|
||||
*/
|
||||
s->file = search_path(argv[argi++], path, X_OK, NULL);
|
||||
if (!s->file || !*s->file)
|
||||
s->file = argv[argi - 1];
|
||||
#else
|
||||
s->file = argv[argi++];
|
||||
#endif
|
||||
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
||||
SHF_MAPHI | SHF_CLEXEC);
|
||||
if (s->u.shf == NULL) {
|
||||
|
8
sh.h
8
sh.h
@ -169,7 +169,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.735 2015/07/09 19:28:21 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.736 2015/07/09 19:46:43 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R51 2015/07/06"
|
||||
|
||||
@ -253,7 +253,8 @@ typedef MKSH_TYPEDEF_SSIZE_T ssize_t;
|
||||
|
||||
/* extra types */
|
||||
|
||||
#if !HAVE_GETRUSAGE
|
||||
/* getrusage does not exist on OS/2 kLIBC */
|
||||
#if !HAVE_GETRUSAGE && !defined(__OS2__)
|
||||
#undef rusage
|
||||
#undef RUSAGE_SELF
|
||||
#undef RUSAGE_CHILDREN
|
||||
@ -829,6 +830,9 @@ EXTERN const char T_typeset[] E_INIT("=typeset");
|
||||
EXTERN const char Talias[] E_INIT("alias");
|
||||
EXTERN const char Tunalias[] E_INIT("unalias");
|
||||
EXTERN const char Tcat[] E_INIT("cat");
|
||||
#ifdef __OS2__
|
||||
EXTERN const char Textproc[] E_INIT("extproc");
|
||||
#endif
|
||||
EXTERN const char Tsgset[] E_INIT("*=set");
|
||||
#define Tset (Tsgset + 2) /* "set" */
|
||||
EXTERN const char Tsgexport[] E_INIT("*=export");
|
||||
|
Loading…
Reference in New Issue
Block a user