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 # This program is free software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License
19 # as published by the Free Software Foundation; either version 2
20 # of the License, or (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write to the Free Software
29 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 # Read through the files
39 my $fileContents = '';
42 die "No such file: \"$filename\"" if (! -e $filename);
45 $filename =~ s{ ^ \. / } {}xo;
47 # Read in the file (ouch, but it's easier that way)
48 open(FC, $filename) || die("Couldn't open $filename");
49 while (<FC>) { $fileContents .= $_; }
52 if ($fileContents =~ s{
55 &\s*[A-Z0-9_\[\]-]+ # &hf
58 ("[A-Z0-9 '\./\(\)_:-]+") # name
60 "[A-Z0-9_\.-]+" # abbrev
62 FT_[A-Z0-9_]+ # field type
64 [A-Z0-9x|_]+ # display
66 [A-Z0-9&_\(\)' -]+ # convert
74 print STDERR "Warning: field with name==blurb found in " .$filename. " FIXING IT!\n";
76 # Trim trailing white space while we're here
77 $fileContents =~ s{[ \t]+$} []gom;
79 open(FC, ">".$filename) || die("Couldn't open $filename");
80 print FC $fileContents;