scriptexec: try to use shell/interpreter name as well on OS/2

If specified path does not exist, try to use shell/interpreter name
without directory.

On OS/2, directory structures of distribution is quite different. And
Some scripts have hard coded shell/interpreter. To overcome this, allow
to use shell/interpreter name if specified path does not exist.
This commit is contained in:
KO Myung-Hun 2015-06-11 16:11:06 +09:00
parent 25bb7dcec4
commit b27e10a32e
1 changed files with 8 additions and 0 deletions

8
exec.c
View File

@ -957,6 +957,14 @@ scriptexec(struct op *tp, const char **ap)
if (*cp)
*tp->args-- = (char *)cp;
}
#ifdef __OS2__
/*
* Use shell/interpreter name without directory if specified
* path does not exist
*/
if (ksh_vstrchr_dirsep(sh) && !search_path(sh, path, X_OK, NULL))
sh = _getname(sh);
#endif
goto nomagic;
noshebang:
m = buf[0] << 8 | buf[1];