Compile problem
Heath Kehoe
heath.kehoe at intermec.com
Thu May 25 20:23:18 UTC 2000
>
>* Some users complained in de.comm.provider.usenet that most news
> servers have more newsgroup descriptions than groups and that
> this could be annoying (download unnecessary stuff) or even
> confusing (more than one and different descriptions for the same
> group). That's true, the newsgroups file on most servers is the
> less maintained file. Some reasons why I mentioned above.
>
> It would be nice if nnrpd lists only descriptions for groups that
> really are in active (with flags y, m and n) on a LIST NEWSGROUPS.
>
> Problem: Duplicates should be eleminated (in most cases the last
> description is the correct one, but not in all, e.g. someone sorted
> the newsgroups file).
>
> But if docheckgroups will take care also of the newsgroups file,
> even the wrong description will only be a matter of time ...
>
I have written a simple perl script that cleans the newsgroups file.
Perhaps this functionality could be added to a perl docheckgroups.
For now, however, we could stick this in the contrib/ dir of the
INN trees.
-heath
[cleannewsgroups.pl]
#! /usr/bin/perl
print "do a fixscript on me to put the appropriate require line in.\n"; exit;
# This script cleans the newsgroups file:
# * Groups no longer in the active file are removed.
# * Duplicate entries are removed. The last of a set of duplicates
# is the one retained. That way, you could simply append the
# new/revised entries from a docheckgroups run and then this script
# will remove the old ones.
# * Groups with no description are removed.
# * Groups matching the $remove regexp are removed.
$remove='';
# $remove='^alt\.';
open ACT, $inn::active or die "Can't open $inn::active: $!\n";
while(<ACT>) {
($group) = split;
$act{$group} = 1 unless($remove ne "" && $group =~ /$remove/o);
}
close ACT;
open NG, $inn::newsgroups or die "Can't open $inn::newsgroups: $!\n";
while(<NG>) {
chomp;
($group, $desc) = split /\s+/,$_,2;
next unless(defined $act{$group});
next if(!defined $desc);
next if($desc =~ /^[?\s]*$/);
next if($desc =~ /^no desc(ription)?(\.)?$/i);
$hist{$group} = $desc;
}
close NG;
open NG, ">$inn::newsgroups.new" or die "Can't open $inn::newsgroups.new for write: $!\n";
foreach $group (sort keys %act) {
if(defined $hist{$group}) {
print NG "$group\t$hist{$group}\n" or die "Can't write: $!\n";
}
}
close NG or die "Can't close: $!\n";
rename "$inn::newsgroups.new", $inn::newsgroups or die "Can't rename $inn::newsgroups.new to $inn::newsgroups: $!\n";
More information about the inn-workers
mailing list