new flag/token strict_unk_token will abort on unknow @token
git-svn-id: file:///home/hardaker/lib/sf-bkups/net-snmp-convert-svnrepo/trunk@8833 06827809-a52a-0410-b366-d66718629ded
diff --git a/local/mib2c b/local/mib2c
index 61ccef3..4f24564 100755
--- a/local/mib2c
+++ b/local/mib2c
@@ -45,6 +45,7 @@
$configfile="mib2c.conf";
$debug=0;
$quiet=0;
+$strict_unk_token = 0;
$nostats = 0;
$noindent = 0;
$currentline = 0;
@@ -437,6 +438,13 @@
else {
$debug = 0;
}
+ } elsif (/\@\s*strict token\s+([^\@]+)\@/) { # STRICT
+ if ($1 eq "on") {
+ $strict_unk_token = 1;
+ }
+ else {
+ $strict_unk_token = 0;
+ }
} elsif (/\@\s*open\s+([^\@]+)\@/) { # OPEN
my $arg = $1;
my ($multiple) = (0);
@@ -711,6 +719,7 @@
warn "$currentfile:$currentline contained a line that started with a @ but did not match any mib2c configuration tokens.\n";
warn "(maybe missing the trailing @?)\n";
warn "$currentfile:$currentline [$_]\n";
+ die if ($strict_unk_token == 1);
}
}
$currentlevel--;