--showpaths wasn't returning the paths if there was an error in a config file

Also,
Windows only: Introduces some environment variable substitution for paths
specified in a config file
This commit is contained in:
nhmall
2019-11-11 12:49:54 -05:00
parent 11c869d7c5
commit 6dfbff9d4b
5 changed files with 80 additions and 4 deletions

View File

@@ -151,6 +151,10 @@ static int lockptr;
#ifndef WIN_CE
#define DeleteFile unlink
#endif
#ifdef WIN32
/*from windmain.c */
extern char *FDECL(translate_path_variables, (const char *, char *));
#endif
#endif
#ifdef MAC
@@ -350,6 +354,10 @@ const char *basenam;
int whichprefix UNUSED_if_not_PREFIXES_IN_USE;
int buffnum UNUSED_if_not_PREFIXES_IN_USE;
{
#ifdef WIN32
char tmpbuf[BUFSZ];
#endif
#ifndef PREFIXES_IN_USE
return basenam;
#else
@@ -367,9 +375,16 @@ int buffnum UNUSED_if_not_PREFIXES_IN_USE;
basenam);
return basenam; /* XXX */
}
#ifdef WIN32
if (strchr(fqn_prefix[whichprefix], '%') ||
strchr(fqn_prefix[whichprefix], '~'))
Strcpy(fqn_filename_buffer[buffnum],
translate_path_variables(fqn_prefix[whichprefix], tmpbuf));
else
#endif
Strcpy(fqn_filename_buffer[buffnum], fqn_prefix[whichprefix]);
return strcat(fqn_filename_buffer[buffnum], basenam);
#endif
#endif /* !PREFIXES_IN_USE */
}
int

View File

@@ -673,7 +673,7 @@ initoptions()
/* ... and _must_ parse correctly. */
if (!read_config_file(SYSCF_FILE, SET_IN_SYS)) {
if (config_error_done())
if (config_error_done() && !iflags.initoptions_noterminate)
nh_terminate(EXIT_FAILURE);
}
config_error_done();