Roxen.git / server / tools / ntroxen / startdll / cmdline.cpp

version» Context lines:

Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1:   // cmdline.cpp: implementation of the CCmdLine class.   // - // $Id: cmdline.cpp,v 1.15 2001/11/13 10:45:49 tomas Exp $ + // $Id: cmdline.cpp,v 1.16 2001/11/14 16:29:49 tomas Exp $   //   //////////////////////////////////////////////////////////////////////      #include "stdafx.h"   #include "startdll.h"   #include "cmdline.h"   #include "roxen.h"   #include "enumproc.h"      #ifdef _DEBUG
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:202:   ////////////////////////   //   // CCmdLine class   //      //////////////////////////////////////////////////////////////////////   // Construction/Destruction   //////////////////////////////////////////////////////////////////////      CCmdLine::CCmdLine() - : m_SelfTestDir("etc\\test"), m_LogDir("..\\logs") + : m_SelfTestDir("etc\\test"), m_LogDir("..\\logs"), +  m_ConfigDir("..\\configurations")   {    m_bPreloaded = FALSE;       m_bInstall = FALSE;    m_bRemove = FALSE;    m_bOnce = FALSE;    m_bHelp = FALSE;    m_bVersion = FALSE;    m_bPassHelp = FALSE;    m_bKeepMysql = FALSE;
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:792:    *argv++ = NULL;    ++*numargs;   }         ////////////////////////   //   // Parse current argument (always argv[0]) and   // return the number of parameters used   // - int CCmdLine::ParseArg(char *argv[], CCmdLine::tArgType & type) + int CCmdLine::ParseArg(int argc, char *argv[], CCmdLine::tArgType & type)   {    char *value;          /*    -DRAM_CACHE    -DENABLE_THREADS       -DRUN_SELF_TEST    ##
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1120:    return 1;    }   */       //'--program')    // program="$2"    // once=1    // passhelp=1    if (Match(*argv, "--program", NULL, NULL) )    { +  if (argc > 1) +  {    m_saRoxenArgs.Add(*argv);    m_saRoxenArgs.Add(argv[1]);    m_bOnce = TRUE;    m_bPassHelp = TRUE;    m_bKeepMysql = TRUE;    m_bCheckVersion = FALSE;    type = eArgNtLoader;    return 2;    } -  +  else +  { +  type = eArgMoreData; +  return 1; +  } +  }       //'--cd')    // cd_to="$2"    // # Use the absolute path...    // roxendir="`pwd`"    // once=1    // shift    if (Match(*argv, "--cd", NULL, NULL) )    { -  +  if (argc > 1) +  {    m_saRoxenArgs.Add(*argv);    m_saRoxenArgs.Add(argv[1]);    m_bOnce = TRUE;    type = eArgNtLoader;    return 2;    } -  +  else +  { +  type = eArgMoreData; +  return 1; +  } +  }       //--debug-without=*|-r*|-d*|-t*|-l*|-w*|-a*|-p*|--*-debug*)    // # Argument passed along to Pike.    // ARGS="$ARGS $1"    if (Match(*argv, "--debug-without=*", NULL, NULL) ||    Match(*argv, "-r*", NULL, NULL) ||    Match(*argv, "-d*", NULL, NULL) ||    Match(*argv, "-t*", NULL, NULL) ||    Match(*argv, "-l*", NULL, NULL) ||    Match(*argv, "-w*", NULL, NULL) ||
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1331:    while (defRoxenArgs[i] != NULL)    {    m_saRoxenArgs.Add(defRoxenArgs[i]);    i++;    }    m_bPreloaded = TRUE;    }       // Walk through the argument list    i = 1; // skip argv[0] -  while (i < argc) +  while (i < argc && ret)    { -  int numParsed = ParseArg(&argv[i], type); +  int numParsed = ParseArg(argc-i, &argv[i], type);       switch (type)    {    case eArgStart:    // No extra handling here    //OutputLineFmt(hOut, ".BNtStart argument: %sB.", argv[i]);    break;       case eArgNtLoader:    // No extra handling here
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1374:    //OutputLineFmt(hOut, ".BNoDebug argument: %sB.", argv[i]);    break;       case eArgVersion:    // No extra handling here    //OutputLineFmt(hOut, ".BVersion argument: %sB.", argv[i]);    break;       case eArgSelfTest:    { -  // Make sure that mysql is not running -  KillMySql(); -  +     // Make sure the var directory exists    CreateDirectory("..\\var", NULL);       std::string selfTestDirUnx;    selfTestDirUnx.resize(m_SelfTestDir.length());    for (int i=0; i<m_SelfTestDir.length(); i++)    {    if (m_SelfTestDir[i] == '\\')    selfTestDirUnx[i] = '/';    else
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1402:    //cp -R etc/test/config $VARDIR/test_config    //cp etc/test/filesystem/test_rxml_package rxml_packages/test_rxml_package    //DIR=$VARDIR/test_config    //once=1    //remove_dumped=1    m_saPikeArgs.Add("-DRUN_SELF_TEST");    m_saPikeArgs.Add(("-DSELF_TEST_DIR=\\\"" + selfTestDirUnx + "\\\"").c_str());       m_bOnce = TRUE;    m_iDebug = max(m_iDebug, 1); -  m_saRoxenArgs.Add("--config-dir=../var/test_config"); +  m_ConfigDir = "../var/test_config"; +  m_saRoxenArgs.Add(("--config-dir=" + m_ConfigDir).c_str());    m_saRoxenArgs.Add("--remove-dumped");    -  +  // Make sure that mysql is not running +  KillMySql(m_ConfigDir.c_str()); +     SetEnvironmentVariable("COPYCMD", "/Y");    system("rmdir /Q /S ..\\var\\test_config >NUL:");       std::string setupCmd = m_SelfTestDir + "\\scripts\\setup.pike";    DWORD attr = GetFileAttributes(setupCmd.c_str());    if (attr != -1 && !(attr & FILE_ATTRIBUTE_DIRECTORY))    {    setupCmd += " " + selfTestDirUnx + " ../var";    CRoxen::RunPike(setupCmd.c_str());    }
Roxen.git/server/tools/ntroxen/startdll/cmdline.cpp:1426:    }    //OutputLineFmt(hOut, ".BSelfTest argument: %sB.", argv[i]);    break;       case eArgHelp:    // No extra handling here    //OutputLineFmt(hOut, ".BHelp argument: %sB.", argv[i]);    break;       +  case eArgMoreData: +  ret = FALSE; +  OutputLineFmt(hOut, ".BArgument requires more data: %sB.", argv[i]); +  break; +  +     case eArgUnsupported:    OutputLineFmt(hOut, ".BArgument not supported: %sB.", argv[i]);    break;          default:    OutputLineFmt(hOut, ".BInternal Error: default case hit with: %sB.", argv[i]);    break;       }