diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-08-07 23:00:53 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-08-07 23:00:53 (GMT) |
commit | 028f5aa2c791f3afd6f811f56f03fba5dfc62abf (patch) | |
tree | 1b2775e293ce357b0623ce0c21053ccae5ecb0da /Source/cmSystemTools.cxx | |
parent | 9a0ca088a1097ae5dc7b3a3264ffe4d530f13b19 (diff) | |
download | CMake-028f5aa2c791f3afd6f811f56f03fba5dfc62abf.zip CMake-028f5aa2c791f3afd6f811f56f03fba5dfc62abf.tar.gz CMake-028f5aa2c791f3afd6f811f56f03fba5dfc62abf.tar.bz2 |
ENH: Abstract parsing of arguments so that I can use it in other places
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c8797d6..798d890 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -293,20 +293,9 @@ bool cmSystemTools::IsOff(const char* val) v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); } -bool cmSystemTools::RunSingleCommand( - const char* command, - std::string* output, - int *retVal, - const char* dir, - bool verbose, - int timeout) +std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command) { - if(s_DisableRunCommandOutput) - { - verbose = false; - } - - std::vector<std::string> args; + std::vector<cmStdString> args; std::string arg; bool win_path = false; @@ -365,19 +354,37 @@ bool cmSystemTools::RunSingleCommand( } } - std::vector<const char*> argv; - for(std::vector<std::string>::const_iterator a = args.begin(); - a != args.end(); ++a) + return args; +} + +bool cmSystemTools::RunSingleCommand( + const char* command, + std::string* output, + int *retVal, + const char* dir, + bool verbose, + int timeout) +{ + if(s_DisableRunCommandOutput) { - argv.push_back(a->c_str()); + verbose = false; } - argv.push_back(0); - - if(argv.size() < 2) + + std::vector<cmStdString> args = cmSystemTools::ParseArguments(command); + + if(args.size() < 1) { return false; } + std::vector<const char*> argv; + for(std::vector<cmStdString>::const_iterator a = args.begin(); + a != args.end(); ++a) + { + argv.push_back(a->c_str()); + } + argv.push_back(0); + if ( output ) { *output = ""; |