diff --git a/src/init.c b/src/init.c index 2fac8ae9..64e19b25 100644 --- a/src/init.c +++ b/src/init.c @@ -885,8 +885,10 @@ parse_line (const char *line, char **com, char **val, int *comind) #if defined(WINDOWS) || defined(MSDOS) # define ISSEP(c) ((c) == '/' || (c) == '\\') +# define SEPSTRING "/\\" #else # define ISSEP(c) ((c) == '/') +# define SEPSTRING "/" #endif /* Run commands[comind].action. */ @@ -927,8 +929,7 @@ setval_internal_tilde (int comind, const char *com, const char *val) xfree (*pstring); /* Skip the leading "~/". */ - for (++val; ISSEP (*val); val++) - ; + val += strspn(val + 1, SEPSTRING) + 1; *pstring = concat_strings (home, "/", val, (char *)0); xfree (home); } diff --git a/src/url.c b/src/url.c index 2e0b7304..4b2263c0 100644 --- a/src/url.c +++ b/src/url.c @@ -1248,9 +1248,8 @@ mkalldirs (const char *path) struct stat st; int res; - p = path + strlen (path); - for (; *p != '/' && p != path; p--) - ; + p = strrchr(path, '/'); + p = p == NULL ? path : p; /* Don't create if it's just a file. */ if ((p == path) && (*p != '/'))