From 51e5d29357644965bc6a8a4d1f3b2878936147f7 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sat, 27 Nov 2021 00:18:28 +0100 Subject: 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 --- iptables/xshared.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'iptables/xshared.c') 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); +} -- cgit v1.2.3