ab238d53998064b84960bdb98694a760a7a144f6
[platform/upstream/cmake.git] / Source / cmw9xcom.cxx
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #include "cmSystemTools.h"
13 #include "cmWin32ProcessExecution.h"
14
15 // this is a test driver program for cmake.
16 int main (int argc, char *argv[])
17 {
18   cmSystemTools::EnableMSVCDebugHook();
19   if ( argc <= 1 )
20     {
21     std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
22     return 1;
23     }
24   std::string arg = argv[1];
25   if ( (arg.find_first_of(" ") != arg.npos) &&
26        (arg.find_first_of("\"") == arg.npos) )
27     {
28     arg = "\"" + arg + "\"";
29     }
30   std::string command = arg;
31   int cc;
32   for ( cc = 2; cc < argc; cc ++ )
33     {
34     std::string nextArg = argv[cc];
35     if ( (nextArg.find_first_of(" ") != nextArg.npos) &&
36          (nextArg.find_first_of("\"") == nextArg.npos) )
37       {
38       nextArg = "\"" + nextArg + "\"";
39       }
40     command += " ";
41     command += nextArg;
42     }
43
44   return cmWin32ProcessExecution::Windows9xHack(command.c_str());
45 }