3 # Copyright 2010, Jeff Morriss <jeff.morriss.ws[AT]gmail.com>
5 # A simple tool to remove bogus blurbs from hf entries.
6 # This has already been run so it may not be necessary any more, but
7 # may as well check it in in case it can serve as a base for other, future,
11 # fixhf.pl file1 [file2 file3 ...]
13 # Wireshark - Network traffic analyzer
14 # By Gerald Combs <gerald@wireshark.org>
15 # Copyright 1998 Gerald Combs
17 # SPDX-License-Identifier: GPL-2.0-or-later
22 # Read through the files
27 my $fileContents = '';
30 die "No such file: \"$filename\"" if (! -e $filename);
33 $filename =~ s{ ^ \. / } {}xo;
35 # Read in the file (ouch, but it's easier that way)
36 open(FC, $filename) || die("Couldn't open $filename");
37 while (<FC>) { $fileContents .= $_; }
40 if ($fileContents =~ s{
43 &\s*[A-Z0-9_\[\]-]+ # &hf
46 ("[A-Z0-9 '\./\(\)_:-]+") # name
48 "[A-Z0-9_\.-]+" # abbrev
50 FT_[A-Z0-9_]+ # field type
52 [A-Z0-9x|_]+ # display
54 [A-Z0-9&_\(\)' -]+ # convert
62 print STDERR "Warning: field with name==blurb found in " .$filename. " FIXING IT!\n";
64 # Trim trailing white space while we're here
65 $fileContents =~ s{[ \t]+$} []gom;
67 open(FC, ">".$filename) || die("Couldn't open $filename");
68 print FC $fileContents;