} testRecord;
static vector<testRecord> gTestSet;
-
+
static vector<string> gValidSwitchList;
static vector<string> gSwitchDescriptionList;
}
OK &= !(system_memlock_amount() == 0);
-
+
return OK;
}
printf(" Options are as follows:\n");
printf("\n");
printf("\n");
-
+
vector<testRecord>::iterator itr;
-
+
for (itr = gTestSet.begin(); itr != gTestSet.end(); ++itr) {
printf("%20s %s :\t%s\n", (*itr).switchText.c_str(), (*itr).swOptionText.c_str(), (*itr).descriptionText.c_str());
}
printf("\n");
-
+
return true;
}
DefineSwitches()
{
testRecord rec;
-
+
// Global switches
rec.switchText = "-a";
rec.swOptionText = "";
vector<testRecord>::iterator itr;
bool OK = true;
int i;
-
+
if (argc == 1) {
gSwitchesReceived.push_back("-a");
}
break;
}
}
-
+
if (OK && itr != gTestSet.end()) {
// Known option switch found
gSwitchesReceived.push_back(tmp);
if (OK) {
// All switches are at least valid, now check to make sure they are all valid to
// be used together.
-
+
if (gSwitchesReceived.size() > 1) {
// make sure help is not mixed with other options
vector<string>::iterator swItr;
bool OK = true;
vector<string>::iterator itr;
vector<testRecord>::iterator testItr;
-
+
for (itr = gSwitchesReceived.begin(); itr != gSwitchesReceived.end(); ++itr) {
for (testItr = gTestSet.begin(); testItr != gTestSet.end(); ++testItr) {
if ((*itr) == (*testItr).switchText) {
break;
}
}
-
+
bool result;
if ((*testItr).hasOption) {
result = ((*testItr).opFunctionPtr((*testItr).optionArg) != 0);
OK &= result;
}
-
+
return OK;
}
char **argv)
{
int status = 0;
-
+
DefineSwitches();
if (ParseSwitches(argc, argv)) {