Thread View: news.software.b
1 messages
1 total messages
Started by Tod McQuillin
Tue, 22 Feb 1994 06:38
Perl source creates INN's unwanted groups
Author: Tod McQuillin
Date: Tue, 22 Feb 1994 06:38
Date: Tue, 22 Feb 1994 06:38
52 lines
1961 bytes
1961 bytes
Archive-name: unwanted
Author: Tod McQuillin <devin@lm.net>
Version: 1.0
#!/usr/local/bin/perl
#
# unwanted 1.0 - offer to create unwanted newsgroups from INN's news.daily
#
# perl program to scan a mailbox, find INN news.daily reports in it,
# and summarise and offer to create the "Top unwanted newsgroups"
# listed which haven't already been created
#
# I'm not condoning this method of news administration, but here it
# is for those who might benefit from it.
#
# Usage: unwanted mbox-file
#
# Tod McQuillin <devin@lm.com>
$active = '/usr/local/news/active';
$ctlinnd = '/usr/local/news/bin/ctlinnd';
while (<>) {
if (/^From:\s+([^<]+\S)\s+<(.+)>/) {
($name, $addr) = ($1, $2);
$fromnews = ($name =~ /News/i && $addr =~ /^news@/);
}
if (/^Top 20 unwanted newsgroups:/ && $fromnews) {
while (<ARGV>) {
if (/^\s+(\d+)\s+(.+)/) {
$unwanted{$2} += $1;
} elsif (/^\s*$/) {
last;
}
}
}
}
open(ACTIVE, $active) || die "Can't read active file ($!)\n";
while (<ACTIVE>) {
/^(\S+)\s/ && $active{$1}++;
}
close ACTIVE;
for (sort {$unwanted{$b} <=> $unwanted{$a}} keys %unwanted) {
if (!defined($active{$_})) {
print "Create $_ (unwanted $unwanted{$_} times)? ";
if (<STDIN> =~ /^y/i) {
system $ctlinnd, "newgroup", $_;
}
}
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads