2013-05-05 19:00:24 +04:00
|
|
|
#include <cmSystemTools.h>
|
2013-05-22 00:58:36 +04:00
|
|
|
#include <string>
|
2013-05-05 19:00:24 +04:00
|
|
|
|
|
|
|
#define RETVAL @_retval@
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
std::string exename = argv[0];
|
|
|
|
std::string logarg;
|
|
|
|
bool nextarg = false;
|
|
|
|
|
|
|
|
if (exename.find("valgrind") != exename.npos)
|
|
|
|
logarg = "--log-file=";
|
|
|
|
else if (exename.find("purify") != exename.npos)
|
|
|
|
#ifdef _WIN32
|
|
|
|
logarg = "/SAVETEXTDATA=";
|
|
|
|
#else
|
|
|
|
logarg = "-log-file=";
|
|
|
|
#endif
|
|
|
|
else if (exename.find("BC") != exename.npos)
|
|
|
|
{
|
|
|
|
nextarg = true;
|
|
|
|
logarg = "/X";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!logarg.empty()) {
|
|
|
|
std::string logfile;
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
|
|
std::string arg = argv[i];
|
2013-05-09 14:24:09 +04:00
|
|
|
// stop processing options, this allows to force
|
|
|
|
// the logfile to be ignored
|
|
|
|
if (arg == "--")
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2013-05-05 19:00:24 +04:00
|
|
|
if (arg.find(logarg) == 0)
|
|
|
|
{
|
|
|
|
if (nextarg)
|
|
|
|
{
|
|
|
|
if (i == argc - 1)
|
|
|
|
return 1; // invalid command line
|
|
|
|
logfile = argv[i + 1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logfile = arg.substr(logarg.length());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!logfile.empty())
|
|
|
|
cmSystemTools::Touch(logfile.c_str(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return RETVAL;
|
|
|
|
}
|