summaryrefslogtreecommitdiffstats
path: root/userspace
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2002-11-03 14:54:09 +0000
committerBart De Schuymer <bdschuym@pandora.be>2002-11-03 14:54:09 +0000
commitb2fffa9efb9f2c4ceb90c83e9d22611916c55a24 (patch)
tree4f23547388730a6264b3cd8ef0c0e9ac34ff06e5 /userspace
parentb7ba87999c43ccf3f2f822f5a724f342091768a8 (diff)
allow ! - option, equivalent with - ! option
Diffstat (limited to 'userspace')
-rw-r--r--userspace/ebtables2/ebtables.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/userspace/ebtables2/ebtables.c b/userspace/ebtables2/ebtables.c
index c057f09..c6d3100 100644
--- a/userspace/ebtables2/ebtables.c
+++ b/userspace/ebtables2/ebtables.c
@@ -1436,13 +1436,17 @@ static void check_for_references(int chain_nr)
}
}
+static int invert = 0;
int check_inverse(const char option[])
{
if (strcmp(option, "!") == 0) {
+ if (invert == 1)
+ print_error("double use of '!' not allowed");
optind++;
+ invert = 1;
return 1;
}
- return 0;
+ return invert;
}
void check_option(unsigned int *flags, unsigned int mask)
@@ -1499,6 +1503,8 @@ int main(int argc, char *argv[])
struct ebt_u_entries *entries;
const char *modprobe = NULL;
+ opterr = 0;
+
// initialize the table name, OPT_ flags, selected hook and command
strcpy(replace.name, "filter");
replace.flags = 0;
@@ -1993,7 +1999,14 @@ int main(int argc, char *argv[])
replace.filename = (char *)malloc(strlen(optarg) + 1);
strcpy(replace.filename, optarg);
break;
-
+ case 1 :
+ if (!strcmp(optarg, "!"))
+ check_inverse(optarg);
+ else
+ print_error("Bad argument : %s", optarg);
+ // check_inverse() did optind++
+ optind--;
+ continue;
default:
// is it a target option?
t = (struct ebt_u_target *)new_entry->t;
@@ -2028,6 +2041,7 @@ check_extension:
replace.command != 'D')
print_error("Extensions only for -A, -I and -D");
}
+ invert = 0;
}
if ( !table && !(table = find_table(replace.name)) )