make_authors 1.36 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 19 20
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
Francois Gouget's avatar
Francois Gouget committed
21
use strict;
22

Francois Gouget's avatar
Francois Gouget committed
23
my @authors;
24 25 26 27 28
open(AUTHORS,"<AUTHORS") or die "Can't open AUTHORS";
open(NEWAUTHORS,">AUTHORS.new");
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";