enable directory path with spaces for spinit,

if path is put into double quotes
This commit is contained in:
Holger Vogt 2020-10-10 20:32:58 +02:00
parent eb15768095
commit 3350663cdc
1 changed files with 11 additions and 3 deletions

View File

@ -271,9 +271,17 @@ ft_cpinit(void)
/* jump over leading spaces */
for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) {
s = skip_ws(s);
/* copy s into buf until space is seen, r is the actual position */
for (r = buf; *s && !isspace_c(*s); r++, s++)
*r = *s;
if (s[0] == '\"') {
/* copy string between leading and trailing " */
s++;
for (r = buf; *s && (*s != '\"'); r++, s++)
*r = *s;
}
else {
/* copy s into buf until space is seen, r is the actual position */
for (r = buf; *s && !isspace_c(*s); r++, s++)
*r = *s;
}
tfree(copys);
/* add a path separator to buf at actual position */
(void) strcpy(r, DIR_PATHSEP);