mirror of https://github.com/sheumann/hush.git
Translate colons to slashes in the current path name, for compatibility with Unix-style usage.
As an exception, the translation isn't done if there is a directory name containing a /.
This commit is contained in:
parent
fb9b298ca4
commit
dc2193b997
|
@ -38,6 +38,16 @@ xrealloc_getcwd_or_warn(char *cwd)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cwd = xrealloc(cwd, strlen(cwd) + 1);
|
cwd = xrealloc(cwd, strlen(cwd) + 1);
|
||||||
|
#ifdef __GNO__
|
||||||
|
/* Translate path to use slashes (unless it contains a directory
|
||||||
|
* name with a slash in it). This increases compatibility with
|
||||||
|
* scripts that expect paths to be in the normal Unix style. */
|
||||||
|
if (strchr(cwd, '/') == NULL) {
|
||||||
|
char *ch = cwd;
|
||||||
|
while ((ch = strchr(ch, ':')) != NULL)
|
||||||
|
*ch = '/';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return cwd;
|
return cwd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue