Change return value checking to the true meaning of the spec:
[obnox/wireshark/wip.git] / make-manuf
index 63ed9e8fa31f84845a669660f01df5e0f72d660e..9a68636023a52b5b51cd9e9211fa1de84adf25f2 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# $Id: make-manuf,v 1.10 2003/01/21 20:20:09 jmayer Exp $
+# $Id$
 #
 # Make-manuf - Creates a file containing ethernet OUIs and their
 # company IDs.  It merges the databases at
@@ -45,11 +45,11 @@ sub shorten
   my $origmanuf = shift; 
   my $manuf = " " . $origmanuf . " ";
   # Remove any punctuation
-  $manuf =~ tr/,.()/    /;
+  $manuf =~ tr/',.()/    /;
   # & isn't needed when Standalone
   $manuf =~ s/ \& / /g;
   # Remove any "the", "inc", "plc" ...
-  $manuf =~ s/\s(the|inc|incorporated|plc||systems|corp|corporation|a\/s|ab|ag|kg|gmbh|co|company|limited|ltd)(?= )//gi;
+  $manuf =~ s/\s(the|inc|incorporated|plc||systems|corp|corporation|s\/a|a\/s|ab|ag|kg|gmbh|co|company|limited|ltd)(?= )//gi;
   # Convert to consistent case
   $manuf =~ s/(\w+)/\u\L$1/g;
   # Remove all spaces
@@ -60,7 +60,7 @@ sub shorten
   if ($manuf =~ /\Q$origmanuf\E/i) {
     return $manuf;
   } else {
-    return sprintf("%-22s # %s\n", $manuf, $origmanuf);
+    return sprintf("%-22s # %s", $manuf, $origmanuf);
   }
 }
 
@@ -127,9 +127,10 @@ foreach $line (split(/\n/, $cb_list)) {
     # Ensure OUI is all upper-case
     $oui =~ tr/a-f/A-F/;
     if (exists $oui_list{$oui}) {
-      printf "$oui - Skipping CaveBear \"$manuf\" in favor of \"$oui_list{$oui}\"\n";
+      printf "$oui - Skipping CaveBear \"$manuf\" in favor of \"$oui_list{$oui}\"\n";
       $cb_skipped++;
     } else {
+      printf "$oui - adding \"$manuf\" from CaveBear\n";
       $oui_list{$oui} = &shorten($manuf);
       $cb_added++;
     }
@@ -141,6 +142,8 @@ foreach $line (split(/\n/, $cb_list)) {
 open (OUT, "> $outfile") ||
   die "Couldn't open output file for writing ($outfile)\n";
 
+print(OUT "# This file was generated by running ./make-manuf.\n");
+print(OUT "# Don't change it directly, change manuf.tmpl and wka.tmpl instead.\n#\n");
 print(OUT "$header");
 
 foreach $oui (sort(keys %oui_list)) {