allow ! - option, equivalent with - ! option
diff --git a/ebtables.c b/ebtables.c
index c057f09..c6d3100 100644
--- a/ebtables.c
+++ b/ebtables.c
@@ -1436,13 +1436,17 @@
 	}
 }
 
+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 @@
 	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 @@
 			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 @@
 			   replace.command != 'D')
 				print_error("Extensions only for -A, -I and -D");
 		}
+		invert = 0;
 	}
 
 	if ( !table && !(table = find_table(replace.name)) )