make_authors 1.39 KB
Newer Older
Francois Gouget's avatar
Francois Gouget committed
1
#! /usr/bin/perl -w
2
#
3
# Generate AUTHORS
4
#
5 6 7 8 9 10 11 12 13 14 15 16 17 18
# Copyright 1998 Alexandre Julliard
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20
#
Francois Gouget's avatar
Francois Gouget committed
21
use strict;
22

Francois Gouget's avatar
Francois Gouget committed
23
my @authors;
24
open(AUTHORS,"<AUTHORS") or die "Can't open AUTHORS";
25
open(NEWAUTHORS,">AUTHORS.new") or die "Can't open AUTHORS.new";
26 27 28
while(<AUTHORS>)
  {
    print NEWAUTHORS;
29
    last if /^$/;
30 31 32 33 34 35 36 37
  }
while(<AUTHORS>)
  {
    chop;
    push @authors, $_;
  }

# Sort them
Francois Gouget's avatar
Francois Gouget committed
38
sub cmpnames()
39
  {
Francois Gouget's avatar
Francois Gouget committed
40 41 42
    my @anames = split(" ",$a);
    my @bnames = split(" ",$b);
    my $ret;
43 44 45 46 47 48 49
    $ret = $anames[-1] cmp $bnames[-1];
    $ret = $anames[0] cmp $bnames[0] unless $ret;
    return $ret;
  }
@authors = sort cmpnames @authors;

# Print authors
50
print NEWAUTHORS (join "\n", @authors) . "\n";
51
print "Created AUTHORS.new\n";