summaryrefslogtreecommitdiffstats
path: root/xtables.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-01-30 04:55:38 +0100
committerJan Engelhardt <jengelh@medozas.de>2009-01-30 05:38:33 +0100
commit0f16c725aadaac7e670d632ecbaea3661ff00827 (patch)
tree8d558d1f1ba36c256de163920a08b157bcbcde87 /xtables.c
parenta0baae85f8159f03d52535934aa9b3a375e0f1f3 (diff)
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 <jengelh@medozas.de>
Diffstat (limited to 'xtables.c')
-rw-r--r--xtables.c28
1 files changed, 28 insertions, 0 deletions
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;
+}