|
|
@ -1296,9 +1296,9 @@ inc_fopen(char *file, char **newname) |
|
|
|
* intact, if ENVVAR is not set in the environment. |
|
|
|
* intact, if ENVVAR is not set in the environment. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
pb = file; |
|
|
|
pb = file; |
|
|
|
|
|
|
|
p1 = pb; |
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
|
char *env; |
|
|
|
char *env; |
|
|
|
p1 = pb; |
|
|
|
|
|
|
|
while (*p1 != '\0' && *p1 != '%') |
|
|
|
while (*p1 != '\0' && *p1 != '%') |
|
|
|
p1++; |
|
|
|
p1++; |
|
|
|
if (*p1 == '\0') |
|
|
|
if (*p1 == '\0') |
|
|
@ -1318,7 +1318,7 @@ inc_fopen(char *file, char **newname) |
|
|
|
error(ERR_WARNING, "environment variable `%s' does not exist", |
|
|
|
error(ERR_WARNING, "environment variable `%s' does not exist", |
|
|
|
p1+1); |
|
|
|
p1+1); |
|
|
|
*p2 = '%'; |
|
|
|
*p2 = '%'; |
|
|
|
pb = p2+1; |
|
|
|
p1 = p2+1; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
/* need to expand */ |
|
|
|
/* need to expand */ |
|
|
@ -1331,6 +1331,7 @@ inc_fopen(char *file, char **newname) |
|
|
|
strcat(file2, pb); |
|
|
|
strcat(file2, pb); |
|
|
|
strcat(file2, env); |
|
|
|
strcat(file2, env); |
|
|
|
pb = p2+1; |
|
|
|
pb = p2+1; |
|
|
|
|
|
|
|
p1 = pb; |
|
|
|
} |
|
|
|
} |
|
|
|
/* add tail end; string is long enough that we don't need to realloc */ |
|
|
|
/* add tail end; string is long enough that we don't need to realloc */ |
|
|
|
if (file2) |
|
|
|
if (file2) |
|
|
|