#define prog_name ip6tables_globals.program_name
#define prog_vers ip6tables_globals.program_version
-static void __attribute__((noreturn))
-exit_tryhelp(int status)
-{
- if (line != -1)
- fprintf(stderr, "Error occurred at line: %d\n", line);
- fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
- prog_name, prog_name);
- xtables_free_opts(1);
- exit(status);
-}
-
static void
exit_printhelp(const struct xtables_rule_match *matches)
{
va_end(args);
fprintf(stderr, "\n");
if (status == PARAMETER_PROBLEM)
- exit_tryhelp(status);
+ exit_tryhelp(status, line);
if (status == VERSION_PROBLEM)
fprintf(stderr,
"Perhaps ip6tables or your kernel needs to be upgraded.\n");
if (line != -1)
return 1; /* success: line ignored */
fprintf(stderr, "This is the IPv6 version of ip6tables.\n");
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
case '6':
/* This is indeed the IPv6 ip6tables */
continue;
}
fprintf(stderr, "Bad argument `%s'\n", optarg);
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
default:
if (command_default(&cs, &ip6tables_globals, invert))
break;
default:
/* We should never reach this... */
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
}
if (verbose > 1)
#define prog_name iptables_globals.program_name
#define prog_vers iptables_globals.program_version
-static void __attribute__((noreturn))
-exit_tryhelp(int status)
-{
- if (line != -1)
- fprintf(stderr, "Error occurred at line: %d\n", line);
- fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
- prog_name, prog_name);
- xtables_free_opts(1);
- exit(status);
-}
-
static void
exit_printhelp(const struct xtables_rule_match *matches)
{
va_end(args);
fprintf(stderr, "\n");
if (status == PARAMETER_PROBLEM)
- exit_tryhelp(status);
+ exit_tryhelp(status, line);
if (status == VERSION_PROBLEM)
fprintf(stderr,
"Perhaps iptables or your kernel needs to be upgraded.\n");
if (line != -1)
return 1; /* success: line ignored */
fprintf(stderr, "This is the IPv4 version of iptables.\n");
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
case 1: /* non option */
if (optarg[0] == '!' && optarg[1] == '\0') {
continue;
}
fprintf(stderr, "Bad argument `%s'\n", optarg);
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
default:
if (command_default(&cs, &iptables_globals, invert))
break;
default:
/* We should never reach this... */
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
}
if (verbose > 1)
print_extension_helps(xtables_targets, matches);
}
+
+void exit_tryhelp(int status, int line)
+{
+ if (line != -1)
+ fprintf(stderr, "Error occurred at line: %d\n", line);
+ fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
+ xt_params->program_name, xt_params->program_name);
+ xtables_free_opts(1);
+ exit(status);
+}
int print_match_save(const struct xt_entry_match *e, const void *ip);
void xtables_printhelp(const struct xtables_rule_match *matches);
+void exit_tryhelp(int status, int line) __attribute__((noreturn));
#endif /* IPTABLES_XSHARED_H */
#define prog_name xt_params->program_name
#define prog_vers xt_params->program_version
-static void __attribute__((noreturn))
-exit_tryhelp(int status)
-{
- if (line != -1)
- fprintf(stderr, "Error occurred at line: %d\n", line);
- fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
- prog_name, prog_name);
- xtables_free_opts(1);
- exit(status);
-}
-
void
xtables_exit_error(enum xtables_exittype status, const char *msg, ...)
{
va_end(args);
fprintf(stderr, "\n");
if (status == PARAMETER_PROBLEM)
- exit_tryhelp(status);
+ exit_tryhelp(status, line);
if (status == VERSION_PROBLEM)
fprintf(stderr,
"Perhaps iptables or your kernel needs to be upgraded.\n");
if (p->restore && args->family == AF_INET6)
return;
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
case '6':
if (args->family == AF_INET6)
if (p->restore && args->family == AF_INET)
return;
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
case 1: /* non option */
if (optarg[0] == '!' && optarg[1] == '\0') {
continue;
}
fprintf(stderr, "Bad argument `%s'\n", optarg);
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
default:
if (command_default(cs, xt_params, invert))
break;
default:
/* We should never reach this... */
- exit_tryhelp(2);
+ exit_tryhelp(2, line);
}
*table = p.table;