# # 2022 Tormod Volden # # 1. Use double quotes in command invokations # Index: cmoc-0.1.77-win/src/main.cpp =================================================================== --- cmoc-0.1.77-win.orig/src/main.cpp +++ cmoc-0.1.77-win/src/main.cpp @@ -397,9 +397,9 @@ invokeAssembler(const string &inputFilen string lwasmCmdLine = params.lwasmPath + " -fobj --pragma=forwardrefmax" + " -D" + targetPreprocId - + " --output='" + objectFilename + "'" - + (params.intermediateFilesKept ? " --list='" + lstFilename + "'" : "") - + " '" + inputFilename + "'"; + + " --output=\"" + objectFilename + "\"" + + (params.intermediateFilesKept ? " --list=\"" + lstFilename + "\"" : "") + + " \"" + inputFilename + "\""; if (verbose) cout << "Assembler command: " << lwasmCmdLine << endl; @@ -710,11 +710,11 @@ invokeLinker(const vector &objec string lwlinkCmdLine = params.lwlinkPath + " --format=" + lwlinkFormat - + " --output='" + outputFilename - + "' --script='" + linkScriptFilename - + "' --map='" + mapFilename + "'"; + + " --output=\"" + outputFilename + + "\" --script=\"" + linkScriptFilename + + "\" --map=\"" + mapFilename + "\""; for (vector::const_iterator it = libDirs.begin(); it != libDirs.end(); ++it) - lwlinkCmdLine += " -L'" + *it + "'"; + lwlinkCmdLine += " -L\"" + *it + "\""; lwlinkCmdLine += " -L" + params.pkgdatadir + "/lib"; lwlinkCmdLine += " -lcmoc-crt-" + string(targetKW); @@ -727,11 +727,11 @@ invokeLinker(const vector &objec for (vector::const_iterator it = objectFilenames.begin(); it != objectFilenames.end(); ++it) - lwlinkCmdLine += " '" + useIntDir(*it) + ".o'"; + lwlinkCmdLine += " \"" + useIntDir(*it) + ".o\""; for (vector::const_iterator it = libraryFilenames.begin(); it != libraryFilenames.end(); ++it) - lwlinkCmdLine += " '" + *it + "'"; + lwlinkCmdLine += " \"" + *it + "\""; if (verbose) cout << "Linker command: " << lwlinkCmdLine << endl; @@ -1032,7 +1032,7 @@ Parameters::compileCFile(const string &i stringstream cppCommand; cppCommand << "cpp -xc++ -U__cplusplus"; // -xc++ makes sure cpp accepts C++-style comments for (list::const_iterator it = includeDirList.begin(); it != includeDirList.end(); ++it) - cppCommand << " -I'" << *it << "'"; + cppCommand << " -I\"" << *it << "\""; cppCommand << " -D_CMOC_VERSION_=" << getVersionInteger(); cppCommand << " -D" << targetPreprocId << "=1"; if (!relocatabilitySupported) @@ -1040,7 +1040,7 @@ Parameters::compileCFile(const string &i cppCommand << " -U__GNUC__ -nostdinc -undef"; for (list::const_iterator it = defines.begin(); it != defines.end(); ++it) - cppCommand << " -D'" << *it << "'"; + cppCommand << " -D\"" << *it << "\""; cppCommand << " " << inputFilename; // must be last argument, for portability