aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@zing.org>2014-04-27 13:26:17 -0700
committerGerald Combs <gerald@wireshark.org>2014-04-30 16:35:55 +0000
commit002cefc721e5fe01ba6ecb9ec7261f549f4f1459 (patch)
tree1c2598c06fde75c94072e368596108b574dff6d0 /tools
parent45f381daa6c44408987ebd9e71df574232190030 (diff)
make-sminmpec.pl fixups.
Enforce a minimum number of entries and do our work in the epan directory. Change-Id: I69cc6ae3255b23706a2e67db890a9718e10568b2 Reviewed-on: https://code.wireshark.org/review/1398 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-sminmpec.pl23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/make-sminmpec.pl b/tools/make-sminmpec.pl
index 3c2f6177da..e1a9afaf5b 100755
--- a/tools/make-sminmpec.pl
+++ b/tools/make-sminmpec.pl
@@ -20,12 +20,21 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
+use File::Spec;
+
+my ($vol, $script_dir, $file) = File::Spec->splitpath( __FILE__ );
+my $epan_dir = File::Spec->catpath($vol, $script_dir, '../epan');
+chdir($epan_dir) || die("Can't find $epan_dir");
my $in = shift;
-$in = "http://www.iana.org/assignments/enterprise-numbers/enterprise-numbers" unless(defined $in);
+$in = "http://www.iana.org/assignments/enterprise-numbers" unless(defined $in);
my @in_lines;
+my $revision = '2014-04-27';
+
+my $min_entries = 100;
+my $smi_total = 0;
if($in =~ m/^http:/i) {
eval "require LWP::UserAgent;";
@@ -33,13 +42,12 @@ if($in =~ m/^http:/i) {
my $agent = LWP::UserAgent->new;
$agent->env_proxy;
- $agent->agent("Wireshark make-sminmpec.pl");
+ $agent->agent("Wireshark make-sminmpec.pl/$revision");
warn "starting to fetch $in ...\n";
my $request = HTTP::Request->new(GET => $in);
-
if (-f "enterprise-numbers") {
my $mtime;
(undef,undef,undef,undef,undef,undef,undef,undef,undef,$mtime,undef,undef,undef) = stat("enterprise-numbers");
@@ -75,8 +83,6 @@ if($in =~ m/^http:/i) {
}
-open OUT, "> sminmpec.c";
-
my $body = '';
my $code;
my $prev_code = -1; ## Assumption: First code in enterprise file is 0;
@@ -107,9 +113,16 @@ for(@in_lines) {
}
$prev_code = $code;
$body .= " { $code, \"$name\" },\n";
+ $smi_total++;
}
}
+# If this happens check what IANA is serving.
+# XXX We already overwrote enterprise-numbers above.
+if ($smi_total < $smi_total) { die "Too few SMI entries ($smi_total)\n"; }
+
+open OUT, "> sminmpec.c";
+
print OUT <<"_SMINMPEC";
/*
* THIS FILE IS AUTOGENERATED, DO NOT EDIT