Add support for spaces in many paths/files names

This patch adds support for spaces in the path to the temporary files.
Adds support for spaces in output files and in library paths.

A space in the installation path is only supported under MinGW
(windows) at this time.
This commit is contained in:
Cary R 2009-11-30 20:01:03 -08:00 committed by Stephen Williams
parent f44c1cadde
commit dba2a6e434
2 changed files with 13 additions and 12 deletions

View File

@ -291,7 +291,7 @@ static int t_version_only(void)
} }
fflush(0); fflush(0);
snprintf(tmp, sizeof tmp, "%s%civl -V -C%s -C%s", base, sep, snprintf(tmp, sizeof tmp, "%s%civl -V -C\"%s\" -C\"%s\"", base, sep,
iconfig_path, iconfig_common_path); iconfig_path, iconfig_common_path);
rc = system(tmp); rc = system(tmp);
if (rc != 0) { if (rc != 0) {
@ -312,7 +312,7 @@ static int t_version_only(void)
static void build_preprocess_command(int e_flag) static void build_preprocess_command(int e_flag)
{ {
snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F%s -f%s -p%s ", snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F\"%s\" -f\"%s\" -p\"%s\" ",
pbase, sep, verbose_flag?" -v":"", pbase, sep, verbose_flag?" -v":"",
e_flag?"":" -L", defines_path, source_path, e_flag?"":" -L", defines_path, source_path,
compiled_defines_path); compiled_defines_path);
@ -331,7 +331,7 @@ static int t_preprocess_only(void)
strcpy(cmd, tmp); strcpy(cmd, tmp);
if (strcmp(opath,"-") != 0) { if (strcmp(opath,"-") != 0) {
snprintf(tmp, sizeof tmp, " > %s", opath); snprintf(tmp, sizeof tmp, " > \"%s\"", opath);
cmd = realloc(cmd, ncmd+strlen(tmp)+1); cmd = realloc(cmd, ncmd+strlen(tmp)+1);
strcpy(cmd+ncmd, tmp); strcpy(cmd+ncmd, tmp);
ncmd += strlen(tmp); ncmd += strlen(tmp);
@ -406,20 +406,20 @@ static int t_compile()
} }
if (npath != 0) { if (npath != 0) {
snprintf(tmp, sizeof tmp, " -N%s", npath); snprintf(tmp, sizeof tmp, " -N\"%s\"", npath);
rc = strlen(tmp); rc = strlen(tmp);
cmd = realloc(cmd, ncmd+rc+1); cmd = realloc(cmd, ncmd+rc+1);
strcpy(cmd+ncmd, tmp); strcpy(cmd+ncmd, tmp);
ncmd += rc; ncmd += rc;
} }
snprintf(tmp, sizeof tmp, " -C%s", iconfig_path); snprintf(tmp, sizeof tmp, " -C\"%s\"", iconfig_path);
rc = strlen(tmp); rc = strlen(tmp);
cmd = realloc(cmd, ncmd+rc+1); cmd = realloc(cmd, ncmd+rc+1);
strcpy(cmd+ncmd, tmp); strcpy(cmd+ncmd, tmp);
ncmd += rc; ncmd += rc;
snprintf(tmp, sizeof tmp, " -C%s -- -", iconfig_common_path); snprintf(tmp, sizeof tmp, " -C\"%s\" -- -", iconfig_common_path);
rc = strlen(tmp); rc = strlen(tmp);
cmd = realloc(cmd, ncmd+rc+1); cmd = realloc(cmd, ncmd+rc+1);
strcpy(cmd+ncmd, tmp); strcpy(cmd+ncmd, tmp);
@ -1104,7 +1104,7 @@ int main(int argc, char **argv)
/* Write the preprocessor command needed to preprocess a /* Write the preprocessor command needed to preprocess a
single file. This may be used to preprocess library single file. This may be used to preprocess library
files. */ files. */
fprintf(iconfig_file, "ivlpp:%s%civlpp -L -F%s -P%s\n", fprintf(iconfig_file, "ivlpp:%s%civlpp -L -F\"%s\" -P\"%s\"\n",
pbase, sep, defines_path, compiled_defines_path); pbase, sep, defines_path, compiled_defines_path);
/* Done writing to the iconfig file. Close it now. */ /* Done writing to the iconfig file. Close it now. */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -83,10 +83,11 @@ bool load_module(const char*type)
if (ivlpp_string) { if (ivlpp_string) {
char*cmdline = (char*)malloc(strlen(ivlpp_string) + char*cmdline = (char*)malloc(strlen(ivlpp_string) +
strlen(path) + 2); strlen(path) + 4);
strcpy(cmdline, ivlpp_string); strcpy(cmdline, ivlpp_string);
strcat(cmdline, " "); strcat(cmdline, " \"");
strcat(cmdline, path); strcat(cmdline, path);
strcat(cmdline, "\"");
FILE*file = popen(cmdline, "r"); FILE*file = popen(cmdline, "r");
if (verbose_flag) if (verbose_flag)