2 # fixscript will replace this line with require innshellvars.pl
4 # This script cleans the newsgroups file:
5 # * Groups no longer in the active file are removed.
6 # * Duplicate entries are removed. The last of a set of duplicates
7 # is the one retained. That way, you could simply append the
8 # new/revised entries from a docheckgroups run and then this script
9 # will remove the old ones.
10 # * Groups with no description are removed.
11 # * Groups matching the $remove regexp are removed.
16 open ACT, $inn::active or die "Can't open $inn::active: $!\n";
19 $act{$group} = 1 unless($remove ne "" && $group =~ /$remove/o);
23 open NG, $inn::newsgroups or die "Can't open $inn::newsgroups: $!\n";
26 ($group, $desc) = split /\s+/,$_,2;
27 next unless(defined $act{$group});
29 next if(!defined $desc);
30 next if($desc =~ /^[?\s]*$/);
31 next if($desc =~ /^no desc(ription)?(\.)?$/i);
33 $hist{$group} = $desc;
37 open NG, ">$inn::newsgroups.new" or die "Can't open $inn::newsgroups.new for write: $!\n";
38 foreach $group (sort keys %act) {
39 if(defined $hist{$group}) {
40 print NG "$group\t$hist{$group}\n" or die "Can't write: $!\n";
43 close NG or die "Can't close: $!\n";
45 rename "$inn::newsgroups.new", $inn::newsgroups or die "Can't rename $inn::newsgroups.new to $inn::newsgroups: $!\n";