/[bfilter]/trunk/bfilter.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bfilter.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29 by dpavlin, Fri Sep 24 15:44:27 2004 UTC revision 35 by dpavlin, Sat Oct 9 21:00:06 2004 UTC
# Line 45  sub escape_js { Line 45  sub escape_js {
45          return $t;          return $t;
46  }  }
47    
48    my @lines;
49    
50  while(<STDIN>) {  while(<STDIN>) {
51          chomp;          chomp;
52    
# Line 53  while(<STDIN>) { Line 55  while(<STDIN>) {
55                  next;                  next;
56          }          }
57    
58            # remove leading spaces (which are ignored if source list was
59            # sorted using locale)
60            s/^\s+//;
61    
62            push @lines, $_;
63    }
64    
65    # spaces will be ignored when sorting using locale. That's why we have
66    # cache of lines with spaces replaced by exclamation mark (!) so that
67    # sort order is strict and not dictionary. For more info, see:
68    # http://archives.postgresql.org/pgsql-sql/2002-04/msg00266.php
69    # http://groups.google.com/groups?selm=handler.82819.D82819.99045085113033.ackdone%40bugs.debian.org&output=gplain
70    
71    my %locale_space_fix;
72    
73    foreach (sort {
74                    unless($locale_space_fix{$a}) {
75                            my $tmp = $a;
76                            $tmp =~ s/ /!/g;
77                            $locale_space_fix{$a} = lc($tmp);
78                    }
79                    unless($locale_space_fix{$b}) {
80                            my $tmp = $b;
81                            $tmp =~ s/ /!/g;
82                            $locale_space_fix{$b} = lc($tmp);
83                    }
84                    $locale_space_fix{$a} cmp $locale_space_fix{$b};
85            } @lines) {
86    
87          my @data = split(/\t+/,$_);          my @data = split(/\t+/,$_);
88    
89          my $headline = shift @data || die "need at least headline!";          my $headline = shift @data || die "need at least headline!";

Legend:
Removed from v.29  
changed lines
  Added in v.35

  ViewVC Help
Powered by ViewVC 1.1.26