diff --git a/misc.c b/misc.c index 5241d68..3c177ee 100644 --- a/misc.c +++ b/misc.c @@ -32,7 +32,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.281 2017/10/11 19:06:44 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.282 2017/10/11 20:46:14 tg Exp $"); #define KSH_CHVT_FLAG #ifdef MKSH_SMALL @@ -1785,7 +1785,7 @@ do_realpath(const char *upath) } #ifdef MKSH_DOSPATH /* drive letter? */ - if (ctype(ip[0], C_ALPHA) && ip[1] == ':') { + if (mksh_drvltr(ip)) { /* keep it */ Xput(xs, xp, *ip++); Xput(xs, xp, *ip++); @@ -1948,6 +1948,8 @@ make_path(const char *cwd, const char *file, * .. .. * ./foo foo * foo/../../../bar ../../bar + * C:/../foo C:/foo + * C:../foo C:../foo */ void simplify_path(char *p) @@ -1956,6 +1958,12 @@ simplify_path(char *p) size_t len; bool needslash; +#ifdef MKSH_DOSPATH + /* keep drive letter */ + if (mksh_drvltr(p)) + p += 2; +#endif + switch (*p) { case 0: return;