diff options
author | Ken Martin <ken.martin@kitware.com> | 2002-10-01 17:00:30 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2002-10-01 17:00:30 (GMT) |
commit | ffe1132407c021fcbb55a3f8ed1f29062068238b (patch) | |
tree | f433b771a9707379d6fd6990a90367338f37c413 /Source/cmw9xcom.cxx | |
parent | 4918ce659393e799cc428ceb3e13581490fe8812 (diff) | |
download | CMake-ffe1132407c021fcbb55a3f8ed1f29062068238b.zip CMake-ffe1132407c021fcbb55a3f8ed1f29062068238b.tar.gz CMake-ffe1132407c021fcbb55a3f8ed1f29062068238b.tar.bz2 |
Put quotes around arguments if they have spaces and no quotes
Diffstat (limited to 'Source/cmw9xcom.cxx')
-rw-r--r-- | Source/cmw9xcom.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx index bf32430..0f2b403 100644 --- a/Source/cmw9xcom.cxx +++ b/Source/cmw9xcom.cxx @@ -25,13 +25,25 @@ int main (int argc, char *argv[]) std::cerr << "Usage: " << argv[0] << " executable" << std::endl; return 1; } - std::string command = argv[1]; + std::string arg = argv[1]; + if ( (arg.find_first_of(" ") != arg.npos) && + (arg.find_first_of("\"") == arg.npos) ) + { + arg = "\"" + arg + "\""; + } + std::string command = arg; int cc; for ( cc = 2; cc < argc; cc ++ ) { + std::string arg = argv[cc]; + if ( (arg.find_first_of(" ") != arg.npos) && + (arg.find_first_of("\"") == arg.npos) ) + { + arg = "\"" + arg + "\""; + } command += " "; - command += argv[cc]; + command += arg; } - + return cmWin32ProcessExecution::Windows9xHack(command.c_str()); } |