From 8f633da789b1a05f5ba5f24ce4eb71c5f3b8867a Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Thu, 7 May 2015 12:51:22 +0900 Subject: [PATCH] Path separator is ; on OS/2 --- edit.c | 2 +- exec.c | 2 +- main.c | 2 +- misc.c | 2 +- sh.h | 8 ++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/edit.c b/edit.c index bc8cc2c..34e5096 100644 --- a/edit.c +++ b/edit.c @@ -771,7 +771,7 @@ glob_path(int flags, const char *pat, XPtrV *wp, const char *lpath) Xinit(xs, xp, patlen + 128, ATEMP); while (sp) { xp = Xstring(xs, xp); - if (!(p = cstrchr(sp, ':'))) + if (!(p = cstrchr(sp, PATH_SEP))) p = sp + strlen(sp); pathlen = p - sp; if (pathlen) { diff --git a/exec.c b/exec.c index affc23b..7497b69 100644 --- a/exec.c +++ b/exec.c @@ -1271,7 +1271,7 @@ search_path(const char *name, const char *lpath, sp = lpath; while (sp != NULL) { xp = Xstring(xs, xp); - if (!(p = cstrchr(sp, ':'))) + if (!(p = cstrchr(sp, PATH_SEP))) p = sp + strlen(sp); if (p != sp) { XcheckN(xs, xp, p - sp); diff --git a/main.c b/main.c index 8bb4f0d..8519b01 100644 --- a/main.c +++ b/main.c @@ -82,7 +82,7 @@ static const char *initcoms[] = { "nameref=\\typeset -n", "nohup=nohup ", "r=\\builtin fc -e -", - "source=PATH=$PATH:. \\command .", + "source=PATH=\"$PATH" PATH_SEP_STR ".\" \\command .", "login=\\exec login", NULL, /* this is what AT&T ksh seems to track, with the addition of emacs */ diff --git a/misc.c b/misc.c index 82f57ee..6d48e05 100644 --- a/misc.c +++ b/misc.c @@ -1636,7 +1636,7 @@ make_path(const char *cwd, const char *file, else if (use_cdpath) { char *pend; - for (pend = plist; *pend && *pend != ':'; pend++) + for (pend = plist; *pend && *pend != PATH_SEP; pend++) ; plen = pend - plist; *cdpathp = *pend ? pend + 1 : NULL; diff --git a/sh.h b/sh.h index b1def24..0281c13 100644 --- a/sh.h +++ b/sh.h @@ -299,6 +299,14 @@ struct rusage { } while (/* CONSTCOND */ 0) #endif +#ifdef __OS2__ +#define PATH_SEP ';' +#define PATH_SEP_STR ";" +#else +#define PATH_SEP ':' +#define PATH_SEP_STR ":" +#endif + #ifdef MKSH__NO_PATH_MAX #undef PATH_MAX #else