🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #41075

Re: A couple of questions about slrn

#41075
From: Dawn Owens-Nicholson
Date: Fri, 22 May 1998 00:00
81 lines
2988 bytes
On 21 May 1998 21:58:50 GMT, Dawn Owens-Nicholson <bluemoon@ux6.cso.uiuc.edu> wrote:
> I've included a short perl script to help do this.

Here's the script I promised.

#! /usr/local/bin/perl -w
# -*- perl -*-

# Make a description file out of an active file + a description file

use strict;
use Getopt::Long;

my (%description, %option, $newsgroup, $description_text, $separator) = ();

GetOptions (\%option, qw(prefer_first list_description_groups help dnews));

if (@ARGV == 0
    or (exists $option{"help"}
        and $option{"help"})) { die <<"USAGE"
Usage: makedesc [options] [active file [description file(s)]]

Options:
  --prefer_first 

    Use the first description listed (default is to prefer the last
    description listed).

  --list_description_groups

    Include groups listed only in the description data (default is to
    include only groups that appear in the active data).

  --dnews

    Output for DNews (separate group and description pair with a tab instead
    of a colon).

  --help

    Get this syntax listing.
USAGE
}

my ($active_file) = (shift || "active");

open (ACTIVE, $active_file) or die ("Couldn't open $active_file: $!");
while (<ACTIVE>) {
    ($newsgroup) = split;
    if ($newsgroup =~ /[-+\w]+\.[-+\w]+/) { $description{$newsgroup} = '?'; }
    else { warn ("Invalid group ($newsgroup) in active file. Newsgroup skipped.\n"); }
}
close (ACTIVE);

while (<>) {
   chomp;
   ($newsgroup, $description_text) = split (/[:\s]/, $_, 2);
   $description_text =~ s/^\s+//;          # delete leading whitespace from description

   if ($newsgroup =~ /[-+\w]+\.[-+\w]+/) {
       if (not exists $description{$newsgroup}
           and exists $option{"list_description_groups"}
	   and $option{"list_description_groups"}) {
	 $description{$newsgroup} = '?';
       }

       if (exists $description{$newsgroup}
           and $description{$newsgroup} eq '?'
           or ((exists $option{"prefer_first"})
	       and $option{"prefer_first"}
	       and ($description{$newsgroup} eq '?')))
	  { $description{$newsgroup} = $description_text; }
   }
}

if (exists $option{"dnews"} and $option{"dnews"}) { $separator = "\t"; }
else { $separator = ':'; }
foreach (keys %description) { print "$_$separator$description{$_}\n"; }

Technical Details
Message-ID: <slrn6ma8il.jeo.bluemoon@ux6.cso.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <35646258.1493330@news.online.no> <slrn6m98sq.8ak.bluemoon@ux6.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Message-ID: <slrn6ma8il.jeo.bluemoon@ux6.cso.uiuc.edu>
Subject: Re: A couple of questions about slrn
Date: Fri, 22 May 1998 00:00:00 +0000
From: bluemoon@ux6.cso.uiuc.edu (Dawn Owens-Nicholson)
References: <35646258.1493330@news.online.no> <slrn6m98sq.8ak.bluemoon@ux6.cso.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 355478819
Organization: University of Illinois at Urbana-Champaign
Newsgroups: news.software.readers