sample_substr_validator: bug fix for --reject_if_present

This commit is contained in:
David Anderson 2015-01-31 18:30:36 -08:00
parent 5c5f996809
commit 57e8f8cf5d
1 changed files with 8 additions and 5 deletions

View File

@ -31,19 +31,22 @@ char* stderr_string;
bool reject_if_present = false; bool reject_if_present = false;
void parse_cmdline() { void parse_cmdline() {
bool found = false;
for (int i=1; i<g_argc; i++) { for (int i=1; i<g_argc; i++) {
if (!strcmp(g_argv[i], "--stderr_string")) { if (!strcmp(g_argv[i], "--stderr_string")) {
stderr_string = g_argv[++i]; stderr_string = g_argv[++i];
return; found = true;
} }
if (!strcmp(g_argv[i], "--reject_if_present")) { if (!strcmp(g_argv[i], "--reject_if_present")) {
reject_if_present = true; reject_if_present = true;
} }
} }
log_messages.printf(MSG_CRITICAL, if (!found) {
"--stderr_string missing from command line\n" log_messages.printf(MSG_CRITICAL,
); "--stderr_string missing from command line\n"
exit(1); );
exit(1);
}
} }
int init_result(RESULT& r, void*&) { int init_result(RESULT& r, void*&) {