summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-11-27 00:18:28 +0100
committerPhil Sutter <phil@nwl.cc>2021-12-16 14:30:29 +0100
commit51e5d29357644965bc6a8a4d1f3b2878936147f7 (patch)
treee2ce6355b527d1de1629dbacd83d4923e1c03c48 /iptables/xshared.c
parent56ac0452a4968f1af8d3ad1717c8646593177155 (diff)
xshared: Share exit_tryhelp()
The function existed three times in identical form. Avoid having to declare extern int line in xshared.c by making it a parameter. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/xshared.c')
-rw-r--r--iptables/xshared.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/iptables/xshared.c b/iptables/xshared.c
index 9b326107..efee7a30 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -1252,3 +1252,13 @@ xtables_printhelp(const struct xtables_rule_match *matches)
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);
+}