From 0f16c725aadaac7e670d632ecbaea3661ff00827 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 30 Jan 2009 04:55:38 +0100 Subject: libxtables: prefix/order - move check_inverse to xtables.c This also adds a warning that intrapositional negation support is deprecated. Signed-off-by: Jan Engelhardt --- xtables.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'xtables.c') diff --git a/xtables.c b/xtables.c index 8a79c5b1..19e746c3 100644 --- a/xtables.c +++ b/xtables.c @@ -1257,3 +1257,31 @@ void xtables_save_string(const char *value) printf("\" "); } } + +/** + * Check for option-intrapositional negation. + * Do not use in new code. + */ +int xtables_check_inverse(const char option[], int *invert, + int *my_optind, int argc) +{ + if (option && strcmp(option, "!") == 0) { + fprintf(stderr, "Using intrapositioned negation " + "(`--option ! this`) is deprecated in favor of " + "extrapositioned (`! --option this`).\n"); + + if (*invert) + exit_error(PARAMETER_PROBLEM, + "Multiple `!' flags not allowed"); + *invert = true; + if (my_optind != NULL) { + ++*my_optind; + if (argc && *my_optind > argc) + exit_error(PARAMETER_PROBLEM, + "no argument following `!'"); + } + + return true; + } + return false; +} -- cgit v1.2.3