}
static void
-exit_printhelp(void)
+printhelp(void)
{
struct xtables_target *t = NULL;
int i;
printf("\n");
t->help();
}
- exit(0);
}
static char
if (!optarg)
optarg = argv[optind];
- exit_printhelp();
+ printhelp();
+ command = CMD_NONE;
break;
case 's':
check_inverse(optarg, &invert, &optind, argc);
if (optind < argc)
xtables_error(PARAMETER_PROBLEM,
"unknown arguments found on commandline");
- if (!command)
- xtables_error(PARAMETER_PROBLEM, "no command specified");
if (invert)
xtables_error(PARAMETER_PROBLEM,
"nothing appropriate following !");
xtables_error(PARAMETER_PROBLEM, "Wrong policy `%s'\n",
policy);
break;
+ case CMD_NONE:
+ break;
default:
/* We should never reach this... */
exit_tryhelp(2);
if (command == 'h' && !(flags & OPT_ZERO)) {
print_help(cs.target, cs.matches, *table);
- exit(0);
+ ret = 1;
}
/* Do the final checks */
}
static void
-exit_printhelp(const struct xtables_rule_match *matches)
+printhelp(const struct xtables_rule_match *matches)
{
printf("%s v%s\n\n"
"Usage: %s -[ACD] chain rule-specification [options]\n"
"[!] --version -V print package version.\n");
print_extension_helps(xtables_targets, matches);
- exit(0);
}
void
xtables_find_match(cs->protocol,
XTF_TRY_LOAD, &cs->matches);
- exit_printhelp(cs->matches);
+ printhelp(cs->matches);
+ p->command = CMD_NONE;
+ return;
/*
* Option selection