diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-01-05 15:33:38 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-01-05 15:33:38 +0000 |
commit | 4c303c67f7e204e1eaa68a88e9feb338ece8af46 (patch) | |
tree | 40994559027b90f3a066506b9b664d6ff1296a12 /cpp/src/Slice/Preprocessor.cpp | |
parent | fix for bug 1415 (diff) | |
download | ice-4c303c67f7e204e1eaa68a88e9feb338ece8af46.tar.bz2 ice-4c303c67f7e204e1eaa68a88e9feb338ece8af46.tar.xz ice-4c303c67f7e204e1eaa68a88e9feb338ece8af46.zip |
Fixed bug 1653
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rw-r--r-- | cpp/src/Slice/Preprocessor.cpp | 80 |
1 files changed, 45 insertions, 35 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index b76d1054e3f..77b28ece361 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -6,18 +6,16 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -
-#include <Slice/Preprocessor.h> +#include <Slice/Preprocessor.h> +#include <IceUtil/StringUtil.h> #include <algorithm> #include <fstream> -
- #include <sys/types.h> #include <sys/stat.h> #ifndef _WIN32 -
+ # include <sys/wait.h> #endif @@ -53,6 +51,18 @@ Slice::Preprocessor::getBaseName() return base; } +string +Slice::Preprocessor::addQuotes(const string& arg) +{ + // + // Add quotes around the given argument to ensure that arguments + // with spaces (such as PATHs) will be preserved as a single + // argument. We also escape the "\" character to ensure that we + // don't end up with a \" at the end of the string. + // + return "\"" + IceUtil::escapeString(arg, "\\") + "\""; +} + FILE* Slice::Preprocessor::preprocess(bool keepComments) { @@ -232,37 +242,37 @@ Slice::Preprocessor::printMakefileDependencies(Language lang) } break; } - case VisualBasic:
- {
- //
- // Change .cpp suffix to .vb suffix.
- //
+ case VisualBasic: + { + // + // Change .cpp suffix to .vb suffix. + // char buf[1024]; - while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- char* dot;
- char* colon = strchr(buf, ':');
- if(colon != NULL)
- {
- *colon = '\0';
- dot = strrchr(buf, '.');
- *colon = ':';
- if(dot != NULL)
- {
- if(strncmp(dot, ".cpp:", 5) == 0)
- {
- *dot = '\0';
- fputs(buf, stdout);
- fputs(".vb", stdout);
- fputs(colon, stdout);
- continue;
- }
- }
- }
- fputs(buf, stdout);
- }
- break;
- }
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL) + { + char* dot; + char* colon = strchr(buf, ':'); + if(colon != NULL) + { + *colon = '\0'; + dot = strrchr(buf, '.'); + *colon = ':'; + if(dot != NULL) + { + if(strncmp(dot, ".cpp:", 5) == 0) + { + *dot = '\0'; + fputs(buf, stdout); + fputs(".vb", stdout); + fputs(colon, stdout); + continue; + } + } + } + fputs(buf, stdout); + } + break; + } default: { abort(); |