diff --git a/driver/main.c b/driver/main.c index 8d2b62908..015b8af75 100644 --- a/driver/main.c +++ b/driver/main.c @@ -291,7 +291,7 @@ static int t_version_only(void) } 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); rc = system(tmp); if (rc != 0) { @@ -312,8 +312,8 @@ static int t_version_only(void) static void build_preprocess_command(int e_flag) { - snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F%s -f%s -p%s ", - pbase,sep, verbose_flag?" -v":"", + snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F\"%s\" -f\"%s\" -p\"%s\" ", + pbase, sep, verbose_flag?" -v":"", e_flag?"":" -L", defines_path, source_path, compiled_defines_path); } @@ -331,7 +331,7 @@ static int t_preprocess_only(void) strcpy(cmd, tmp); if (strcmp(opath,"-") != 0) { - snprintf(tmp, sizeof tmp, " > %s", opath); + snprintf(tmp, sizeof tmp, " > \"%s\"", opath); cmd = realloc(cmd, ncmd+strlen(tmp)+1); strcpy(cmd+ncmd, tmp); ncmd += strlen(tmp); @@ -406,20 +406,20 @@ static int t_compile() } if (npath != 0) { - snprintf(tmp, sizeof tmp, " -N%s", npath); + snprintf(tmp, sizeof tmp, " -N\"%s\"", npath); rc = strlen(tmp); cmd = realloc(cmd, ncmd+rc+1); strcpy(cmd+ncmd, tmp); ncmd += rc; } - snprintf(tmp, sizeof tmp, " -C%s", iconfig_path); + snprintf(tmp, sizeof tmp, " -C\"%s\"", iconfig_path); rc = strlen(tmp); cmd = realloc(cmd, ncmd+rc+1); strcpy(cmd+ncmd, tmp); ncmd += rc; - snprintf(tmp, sizeof tmp, " -C%s -- -", iconfig_common_path); + snprintf(tmp, sizeof tmp, " -C\"%s\" -- -", iconfig_common_path); rc = strlen(tmp); cmd = realloc(cmd, ncmd+rc+1); strcpy(cmd+ncmd, tmp); @@ -985,7 +985,7 @@ int main(int argc, char **argv) /* Make a common conf file path to reflect the target. */ snprintf(iconfig_common_path, sizeof iconfig_common_path, "%s%c%s%s.conf", - base,sep, targ, synth_flag? "-s" : ""); + base, sep, targ, synth_flag? "-s" : ""); /* Write values to the iconfig file. */ fprintf(iconfig_file, "basedir:%s\n", base); @@ -1104,7 +1104,7 @@ int main(int argc, char **argv) /* Write the preprocessor command needed to preprocess a single file. This may be used to preprocess library 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); /* Done writing to the iconfig file. Close it now. */ diff --git a/load_module.cc b/load_module.cc index 646e4ce83..49a0058b7 100644 --- a/load_module.cc +++ b/load_module.cc @@ -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 * 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) { char*cmdline = (char*)malloc(strlen(ivlpp_string) + - strlen(path) + 2); + strlen(path) + 4); strcpy(cmdline, ivlpp_string); - strcat(cmdline, " "); + strcat(cmdline, " \""); strcat(cmdline, path); + strcat(cmdline, "\""); FILE*file = popen(cmdline, "r"); if (verbose_flag)