cmw9xcom.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmSystemTools.h"
  14. #include "cmWin32ProcessExecution.h"
  15. // this is a test driver program for cmake.
  16. int main (int argc, char *argv[])
  17. {
  18. if ( argc <= 1 )
  19. {
  20. std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
  21. return 1;
  22. }
  23. std::string arg = argv[1];
  24. if ( (arg.find_first_of(" ") != arg.npos) &&
  25. (arg.find_first_of("\"") == arg.npos) )
  26. {
  27. arg = "\"" + arg + "\"";
  28. }
  29. std::string command = arg;
  30. int cc;
  31. for ( cc = 2; cc < argc; cc ++ )
  32. {
  33. std::string arg = argv[cc];
  34. if ( (arg.find_first_of(" ") != arg.npos) &&
  35. (arg.find_first_of("\"") == arg.npos) )
  36. {
  37. arg = "\"" + arg + "\"";
  38. }
  39. command += " ";
  40. command += arg;
  41. }
  42. return cmWin32ProcessExecution::Windows9xHack(command.c_str());
  43. }