home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl -- # -*-Perl-*-
-
- # gloop.pl - given a set of newsfroups you want to make visible via
- # gopher, gloop out the descriptions from a copy of
- # /usr/local/lib/news/newsgroups...
-
- # 1st arg: groups you want to make visible
- # 2nd arg: /usr/local/lib/news/newsgroups or equivalent
- # 3rd args: file to stick the results in
-
- ($#ARGV < 2) &&
- die "Usage $0 visible_groups_file newsgroups_file output_file\n";
-
- $g2old_groups = $ARGV[0];
- $newsgroups = $ARGV[1];
- $g2new_groups = $ARGV[2];
-
- open(LONG, $newsgroups) || die "Couldn't open $newsgroups!";
- while(<LONG>) {
- $_ =~ s/\n//g;
- $_ =~ s/\t+/\t/g;
- ($froup,$nov) = /^(\S+)\s+(.*)$/;
-
- # you might want to add or remove some of these...
- next if $nov =~ /^[xy]$/;
- next if $nov =~ /^alternate group$/;
- next if $nov =~ /^local grp$/;
- next if $nov =~ /^local list$/;
- next if $nov =~ /^[\s\t]+$/;
- next if $nov =~ /^$/;
-
- $mold{$froup} = $nov;
- }
- close(LONG);
-
- open(OLD, $g2old_groups) || die "Couldn't open $g2old_groups!";
- open(NEW, ">$g2new_groups") || die "Couldn't open $g2new_groups!";
- while(<OLD>) {
- $_ =~ s/\n//g;
-
- if($mold{$_}) {
- print NEW "$_\t$mold{$_}\n";
- }
- else {
- print NEW "$_\t<No description available>\n";
- }
- }
- close(OLD);
- close(NEW);
-
-