[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-ports
Subject:    Re: speeding up INDEX generation
From:       sada () rr ! IIJ4U ! OR ! JP (SADA Kenji)
Date:       1999-06-30 15:00:07
[Download RAW message or body]

This is sada from Nagoya.

>> The order of INDEX lines are totally scrambled so we need to change
>> Tools/make_index to sort it by the second field or something.  (Steve,
>> did we ever find out a way to sort it so that "x11/foo" comes before
>> "x11-toolkits/bar"?)

Does this work well ?

#!/usr/bin/perl
while (<>) {
	my $line = $_;
	@F = split(/\|/);
	my $k = $F[1];
	$index{$k} = $line;
}
foreach $key (sort compare (keys %index)) {
	print $index{$key};
}
sub compare {
	my @a = split(/\//, $a);
	my @b = split(/\//, $b);
	my $a0, $b0;
	do {
		$a0 = shift(@a);
		$b0 = shift(@b);
	} until $a0 ne $b0;
	$a0 cmp $b0;
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic