updated
[gnutls.git] / doc / scripts / sort1.pl
blobc84315cc95936dc2f1b768071fa1fd9bf6e02a88
1 eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
2 & eval 'exec perl -wST "$0" $argv:q'
3 if 0;
5 # Copyright (C) 2002-2012 Free Software Foundation, Inc.
7 # This file is part of GnuTLS.
9 # This file is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This file is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this file; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 sub key_of_record {
24 local($record) = @_;
26 # Split record into lines:
27 my @lines = split /\n/, $record;
29 my ($i) = 1;
30 my ($key) = $lines[$i];
32 while( !($key =~ m/^\\functionTitle\{(.*)\}/) && ($i < 5)) { $i=$i+1; $key = $lines[$i]; }
34 return $key;
37 $/="\n\\end{function}"; # Records are separated by blank lines.
38 @records = <>; # Read in whole file, one record per array element.
40 @records = sort { key_of_record($a) cmp key_of_record($b) } @records;
41 print @records;