4 # Generate the AUTHORS file combining existing AUTHORS file with
7 # Usage: generate_authors.pl AUTHORS.src
10 # Copyright 2016 Michael Mann (see AUTHORS file)
12 # Wireshark - Network traffic analyzer
13 # By Gerald Combs <gerald@wireshark.org>
14 # Copyright 1998 Gerald Combs
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation; either version 2
19 # of the License, or (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 use Encode qw(encode decode);
36 my %contributors = ();
37 my $is_contributing = 0;
43 Gerald Combs <gerald[AT]wireshark.org>
52 Dan Lasley <dlasley[AT]promus.com> gave permission for his
53 dumpit() hex-dump routine to be used.
55 Mattia Cazzola <mattiac[AT]alinet.it> provided a patch to the
56 hex dump display routine.
58 We use the exception module from Kazlib, a C library written by
59 Kaz Kylheku <kaz[AT]ashi.footprints.net>. Thanks go to him for
60 his well-written library. The Kazlib home page can be found at
61 http://users.footprints.net/~kaz/kazlib.html
63 We use Lua BitOp, written by Mike Pall, for bitwise operations
64 on numbers in Lua. The Lua BitOp home page can be found at
65 http://bitop.luajit.org/
67 Henrik Brix Andersen <brix[AT]gimp.org> gave permission for his
68 webbrowser calling routine to be used.
70 Christophe Devine <c.devine[AT]cr0.net> gave permission for his
71 SHA1 routines to be used.
73 snax <snax[AT]shmoo.com> gave permission to use his(?) weak key
74 detection code from Airsnort.
76 IANA gave permission for their port-numbers file to be used.
78 We use the natural order string comparison algorithm, written by
79 Martin Pool <mbp[AT]sourcefrog.net>.
81 Emanuel Eichhammer <support[AT]qcustomplot.com> granted permission
90 # Perl trim function to remove whitespace from the start and end of the string
99 sub parse_author_name {
100 my $full_name = $_[0];
103 if ($full_name =~ /^([\w\.\-\'\x80-\xff]+(\s*[\w+\.\-\'\x80-\xff])*)\s+<([^>]*)>/) {
104 #Make an exception for Gerald because he's part of the header
105 if ($3 ne "gerald[AT]wireshark.org") {
107 $contributors{$email_key} = $1;
108 print encode('UTF-8', "$full_name\n");
110 } elsif ($full_name =~ /^([\w\.\-\'\x80-\xff]+(\s*[\w+\.\-\'\x80-\xff])*)\s+\(/) {
111 $contributors{"<no_email>"} = $1;
112 print encode('UTF-8', "$full_name\n");
117 my $full_name = $_[0];
125 # 4321 Navin R. Johnson <nrjohnson@example.com>
126 if ($full_name =~ /^\s*\d+\s+([^<]*)\s*<([^>]*)>/) {
128 #Convert real email address to "spam proof" one
130 $email =~ s/@/[AT]/g;
131 $email_key = lc($email);
133 if (!exists($contributors{ $email_key })) {
134 #Make an exception for Gerald because he's part of the header
135 if ($email ne "gerald[AT]wireshark.org") {
137 if ($len >= 8 * $ntab) {
138 $line = "$name <$email>";
141 $ntab +=1 if ($len % 8);
142 $line = $name . "\t" x $ntab . "<$email>";
144 $contributors{$email_key} = $1;
145 print encode('UTF-8', "$line\n");
151 # ---------------------------------------------------------------------
158 open( my $author_fh, '<', $ARGV[0] ) or die "Can't open $ARGV[0]: $!";
159 while ( my $line = decode('UTF-8', <$author_fh>) ) {
162 last if ($line =~ "Acknowledgements");
164 if ($line =~ "Contributors") {
165 $is_contributing = 1;
166 } elsif ($is_contributing == 0) {
170 if ($line =~ /([^\{]*)\{/) {
171 parse_author_name($line);
172 $state = "s_in_bracket";
173 } elsif ($state eq "s_in_bracket") {
174 if ($line =~ /([^\}]*)\}/) {
175 print encode('UTF-8', "$line\n");
178 print encode('UTF-8', "$line\n");
180 } elsif ($line =~ /</) {
181 parse_author_name($line);
182 } elsif ($line =~ "(e-mail address removed at contributor's request)") {
183 parse_author_name($line);
185 print encode('UTF-8', "$line\n");
192 open( my $git_author_fh, 'git --no-pager shortlog -se HEAD|')
193 or die "Can't execute git shortlog: $!";
195 while ( my $git_line = decode('UTF-8', <$git_author_fh>) ) {
198 parse_git_name($git_line);
200 close $git_author_fh;