Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / scripts / sortdin
blobdafb329ff98c9a0b3bca14975ea875e2a4cb0081
1 #!/usr/bin/perl
3 my %data = ();
4 my %code = ();
6 my @out = ();
8 my $fn = $ARGV[0];
10 while (<>) {
11 push(@out, $_);
12 /^\s*exports/i and last;
15 while (<>) {
16 my $key;
17 $arr = /\sDATA\s*$/o ? \%data : \%code;
18 $_ =~ s/^\s+//;
19 my $key = (split(' ', $_))[0];
20 substr($key, 0, 1) = '' while $key =~ /^_/o;
21 chomp $key;
22 $arr->{$key}->{$_} = 1;
25 for my $k (sort keys %data) {
26 push(@out, sort {$b cmp $a} keys %{$data{$k}});
29 for my $k (sort keys %code) {
30 push(@out, sort {$b cmp $a} keys %{$code{$k}});
33 open(R, '>', $fn);
34 print R @out;
35 close R;