more Windows path environ variable translation bits

This commit is contained in:
nhmall
2019-11-11 14:19:16 -05:00
parent 6dfbff9d4b
commit 02da5f2d38

View File

@@ -354,10 +354,13 @@ const char *basenam;
int whichprefix UNUSED_if_not_PREFIXES_IN_USE; int whichprefix UNUSED_if_not_PREFIXES_IN_USE;
int buffnum UNUSED_if_not_PREFIXES_IN_USE; int buffnum UNUSED_if_not_PREFIXES_IN_USE;
{ {
#ifdef PREFIXES_IN_USE
char *bufptr;
#endif
#ifdef WIN32 #ifdef WIN32
char tmpbuf[BUFSZ]; char tmpbuf[BUFSZ];
#endif #endif
#ifndef PREFIXES_IN_USE #ifndef PREFIXES_IN_USE
return basenam; return basenam;
#else #else
@@ -369,20 +372,17 @@ int buffnum UNUSED_if_not_PREFIXES_IN_USE;
impossible("Invalid fqn_filename_buffer specified: %d", buffnum); impossible("Invalid fqn_filename_buffer specified: %d", buffnum);
buffnum = 0; buffnum = 0;
} }
if (strlen(fqn_prefix[whichprefix]) + strlen(basenam) bufptr = fqn_prefix[whichprefix];
>= FQN_MAX_FILENAME) { #ifdef WIN32
impossible("fqname too long: %s + %s", fqn_prefix[whichprefix], if (strchr(fqn_prefix[whichprefix], '%')
basenam); || strchr(fqn_prefix[whichprefix], '~'))
bufptr = translate_path_variables(fqn_prefix[whichprefix], tmpbuf);
#endif
if (strlen(bufptr) + strlen(basenam) >= FQN_MAX_FILENAME) {
impossible("fqname too long: %s + %s", bufptr, basenam);
return basenam; /* XXX */ return basenam; /* XXX */
} }
#ifdef WIN32 Strcpy(fqn_filename_buffer[buffnum], bufptr);
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); return strcat(fqn_filename_buffer[buffnum], basenam);
#endif /* !PREFIXES_IN_USE */ #endif /* !PREFIXES_IN_USE */
} }