Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-07-05 19:59:39 +0400
committerChristopher Faylor <me@cgf.cx>2006-07-05 19:59:39 +0400
commit03ac0afe48a32d1afc954dc97c67ab2f2134cb4a (patch)
treef415355aa9b7bcff924470c7ab4a94a8dfa8bdc3 /winsup/cygwin/sortdin
parenta25d71a8994fddaa760ca401db1d4146ac8a0185 (diff)
* sortdin: New program.
* cygwin.din: Sort.
Diffstat (limited to 'winsup/cygwin/sortdin')
-rwxr-xr-xwinsup/cygwin/sortdin35
1 files changed, 35 insertions, 0 deletions
diff --git a/winsup/cygwin/sortdin b/winsup/cygwin/sortdin
new file mode 100755
index 000000000..bdb4323aa
--- /dev/null
+++ b/winsup/cygwin/sortdin
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+my %data = ();
+my %code = ();
+
+my @out = ();
+
+my $fn = $ARGV[0];
+
+while (<>) {
+ push(@out, $_);
+ /^\s*exports/i and last;
+}
+
+while (<>) {
+ my $key;
+ $arr = /\sDATA\s*$/o ? \%data : \%code;
+ $_ =~ s/^\s+//;
+ my $key = (split(' ', $_))[0];
+ substr($key, 0, 1) = '' if /^_/o;
+ chomp $key;
+ $arr->{$key}->{$_} = 1;
+}
+
+for my $k (sort keys %data) {
+ push(@out, sort {$b cmp $a} keys %{$data{$k}});
+}
+
+for my $k (sort keys %code) {
+ push(@out, sort {$b cmp $a} keys %{$code{$k}});
+}
+
+open(R, '>', $fn);
+print R @out;
+close R;