int opt::parse_args(int* argc, char* argv[])
{
+ int result = 1;
+
char* tmp = strrchr(argv[0], '/');
opt::program_name = (tmp ? tmp + 1 : argv[0]);
opt::version_requested = true;
break;
case '?':
- WARN1("invalid option -- '%c'", optopt);
+ ERROR1("invalid option -- '%c'", optopt);
+ result = 0;
break;
}
}
if (opt::version_requested || opt::help_requested)
return 1;
- switch (*argc - optind) {
+ int rem_args = *argc - optind;
+ switch (rem_args) {
case 0:
ERROR0("missing parameter -- <plaform_file>");
case 1:
ERROR0("missing parameter -- <application_file>");
- return 0;
+ result = 0;
+ break;
default:
opt::platform_file = argv[optind];
opt::application_file = argv[optind + 1];
+ if (rem_args == 2)
+ break;
for (int i = optind + 2 ; i < *argc ; ++i)
- WARN1("unused parameter -- \"%s\"", argv[i]);
+ ERROR1("unused parameter -- \"%s\"", argv[i]);
+ result = 0;
break;
}
- return 1;
+ return result;
}
void opt::print()
<< "print help and exit (use -hh or -hhh for extended help)\n";
if (opt::help_requested < 1)
return;
+
std::clog << o("-V") << "print version and exit\n";
std::clog << o("-b") << "activate bookkeeping\n";
std::clog << oo("-c", "[fn,...]f0")