From b27e10a32e74154bbee12100bb9bd75bc55f514e Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Thu, 11 Jun 2015 16:11:06 +0900 Subject: [PATCH] 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. --- exec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exec.c b/exec.c index 8d3a486..bccd684 100644 --- a/exec.c +++ b/exec.c @@ -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];