Support .cmd and .bat on OS/2

This commit is contained in:
KO Myung-Hun 2015-05-12 14:10:12 +09:00
parent 148c019595
commit a32d1d70bf
1 changed files with 13 additions and 0 deletions

13
exec.c
View File

@ -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:
;
}