- fix command line handlung

- fix configuration and file parser
- remove hack

svn path=/trunk/; revision=27647
This commit is contained in:
Johannes Anderwald 2007-07-14 10:24:02 +00:00
parent bdd2ecc99e
commit d07065ab90
3 changed files with 7 additions and 13 deletions

View file

@ -16,7 +16,6 @@
namespace Sysreg_
{
using std::ifstream;
extern "C" FILE * open(char * filename, char* filemode);
//---------------------------------------------------------------------------------------
ConfigParser::ConfigParser()
{
@ -36,14 +35,13 @@ namespace Sysreg_
#ifdef UNICODE
file = _tfopen(FileName, _T("rt,ccs=UNICODE"));
#else
file = open(FileName, "rt");
file = fopen(FileName, "rt");
#endif
if (!file)
{
cerr << "Error: ConfigParser::parseFile failed to open configuration file " << FileName << endl;
return false;
}
bool ret = false;
while (!feof(file))
{

View file

@ -12,7 +12,6 @@
#include <cstdio>
namespace System_
{
extern "C" FILE * open(char * filename, char* filemode);
//---------------------------------------------------------------------------------------
FileReader::FileReader() : DataSource(), m_File(NULL)
{
@ -27,7 +26,7 @@ namespace System_
#ifdef UNICODE
m_File = (FILE*)_tfopen(filename.c_str(), _T("rb,ccs=UNICODE"));
#else
m_File = open((char*)filename.c_str(), (char*)"rb");
m_File = fopen((char*)filename.c_str(), (char*)"rb");
#endif
if (m_File)

View file

@ -23,7 +23,7 @@ using System_::SymbolFile;
#endif
static const TCHAR USAGE[] =
_T("sysreg.exe -l | [conf_file] <testname>\n\n-l - list available tests\nconf_file - (optional) path to a configuration file (default: sysreg.cfg)\ntest_name - name of test to execute\n");
_T("sysreg.exe [conf_file]\nconfiguration file (default: sysreg.cfg)");
@ -33,9 +33,8 @@ int _tmain(int argc, TCHAR * argv[])
ConfigParser config;
TCHAR DefaultConfig[] = _T("sysreg.cfg");
TCHAR *ConfigFile;
TCHAR * TestName;
if ((argc != 3) && (argc != 2))
if ((argc >= 2))
{
cerr << USAGE << endl;
return -1;
@ -45,13 +44,11 @@ int _tmain(int argc, TCHAR * argv[])
if (argc == 2)
{
ConfigFile = DefaultConfig;
TestName = argv[1];
ConfigFile = argv[1];
}
else
{
ConfigFile = argv[1];
TestName = argv[2];
ConfigFile = DefaultConfig;
}
@ -64,7 +61,7 @@ int _tmain(int argc, TCHAR * argv[])
RosBootTest * regtest = new RosBootTest();
if (!regtest)
{
cerr << "Error: the requested regression test does not exist" << endl;
cerr << "Error: failed to create regression test" << endl;
return -1;
}