From a32d1d70bfaaada1f47d6794bfb7da386dce31cd Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Tue, 12 May 2015 14:10:12 +0900 Subject: [PATCH] Support .cmd and .bat on OS/2 --- exec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exec.c b/exec.c index 22a3aa5..8e755a6 100644 --- a/exec.c +++ b/exec.c @@ -975,6 +975,19 @@ scriptexec(struct op *tp, const char **ap) #endif (m == /* gzip */ 0x1F8B) || (m == /* .Z */ 0x1F9D)) errorf("%s: not executable: magic %04X", tp->str, m); +#ifdef __OS2__ + cp = _getext(tp->str); + if (cp && (!stricmp(cp, ".cmd") || !stricmp(cp, ".bat"))) { + /* execute .cmd and .bat with OS2_SHELL, usually CMD.EXE */ + sh = getenv("OS2_SHELL"); + *tp->args-- = "/c"; + /* convert slahes to back-slashes */ + for (cp = tp->str; *cp; cp++) { + if (*cp == '/') + *cp = '\\'; + } + } +#endif nomagic: ; }