Support extproc on OS/2
extproc is similar to like #! on OS/2.
This commit is contained in:
parent
5127457319
commit
9b30ce1a6d
5
exec.c
5
exec.c
@ -930,9 +930,12 @@ scriptexec(struct op *tp, const char **ap)
|
|||||||
cp = buf + n;
|
cp = buf + n;
|
||||||
/* bail out if no shebang magic found */
|
/* bail out if no shebang magic found */
|
||||||
if ((cp[0] != '#') || (cp[1] != '!'))
|
if ((cp[0] != '#') || (cp[1] != '!'))
|
||||||
|
#ifdef __OS2__
|
||||||
|
if (strncmp(cp, "extproc", 7) || (cp[7] != ' ' && cp[7] != '\t'))
|
||||||
|
#endif
|
||||||
goto noshebang;
|
goto noshebang;
|
||||||
|
|
||||||
cp += 2;
|
cp += *cp == '#' ? 2 : 7;
|
||||||
/* skip whitespace before shell name */
|
/* skip whitespace before shell name */
|
||||||
while (*cp == ' ' || *cp == '\t')
|
while (*cp == ' ' || *cp == '\t')
|
||||||
++cp;
|
++cp;
|
||||||
|
3
funcs.c
3
funcs.c
@ -160,6 +160,9 @@ const struct builtin mkshbuiltins[] = {
|
|||||||
#ifdef __MirBSD__
|
#ifdef __MirBSD__
|
||||||
/* alias to "true" for historical reasons */
|
/* alias to "true" for historical reasons */
|
||||||
{"domainname", c_true},
|
{"domainname", c_true},
|
||||||
|
#endif
|
||||||
|
#ifdef __OS2__
|
||||||
|
{"extproc", c_true},
|
||||||
#endif
|
#endif
|
||||||
{NULL, (int (*)(const char **))NULL}
|
{NULL, (int (*)(const char **))NULL}
|
||||||
};
|
};
|
||||||
|
11
main.c
11
main.c
@ -454,7 +454,18 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||||||
kshname = argv[argi++];
|
kshname = argv[argi++];
|
||||||
} else if (argi < argc && !Flag(FSTDIN)) {
|
} else if (argi < argc && !Flag(FSTDIN)) {
|
||||||
s = pushs(SFILE, ATEMP);
|
s = pushs(SFILE, ATEMP);
|
||||||
|
#ifndef __OS2__
|
||||||
s->file = argv[argi++];
|
s->file = argv[argi++];
|
||||||
|
#else
|
||||||
|
/* a bug in os2 extproc shell processing doesn't pass full pathname
|
||||||
|
* of a script so we have to search for it.
|
||||||
|
* This changes the behavior of 'ksh arg' to search the users search
|
||||||
|
* path but it can't be helped.
|
||||||
|
*/
|
||||||
|
s->file = search_path(argv[argi++], path, X_OK, NULL);
|
||||||
|
if (!s->file || !*s->file)
|
||||||
|
s->file = argv[argi - 1];
|
||||||
|
#endif
|
||||||
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
||||||
SHF_MAPHI | SHF_CLEXEC);
|
SHF_MAPHI | SHF_CLEXEC);
|
||||||
if (s->u.shf == NULL) {
|
if (s->u.shf == NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user