Thread View: news.software.nntp
1 messages
1 total messages
Started by Jeff Garzik
Tue, 30 Dec 1997 00:00
ANN: INN -> Cyclone conversion scripts
Author: Jeff Garzik
Date: Tue, 30 Dec 1997 00:00
Date: Tue, 30 Dec 1997 00:00
177 lines
4503 bytes
4503 bytes
This is a multi-part message in MIME format.
--------------328783422496086A43D3772C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In converting an INN box to Cyclone, I wrote these scripts to automate
the config file conversion.
The newsfeeds support is very basic, but should save a good amount of
time. In particular "@"-style "poison newsgroups" are not supported by
the script, even though they ARE supported by Cyclone.
Eventually I would like one single script to support newsfeeds,
nntpsend.ctl, hosts.nntp, and innfeed.conf, and convert them all to
Cyclone-style configuration files.
Script "nf2hw" - convert INN newsfeeds file to a Cyclone feeds.conf
file.
Input into stdin, output to stdout:
./nf2hw < newsfeeds > feeds.conf
Script "hn2hw" - convert INN hosts.nntp file to a Cyclone-style
feeds.conf file.
Input into stdin, output to stdout:
./hn2hw < hosts.nntp >> feeds.conf
Improvements and comments welcome.
--
Jeff Garzik Typhoon, Cyclone, Diablo, and INN
Spinne USENET News Service Fast and efficient news feeds
http://www.spinne.com/usenet/ News tuning and consulting
--------------328783422496086A43D3772C
Content-Type: text/plain; charset=us-ascii; name="nf2hw"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="nf2hw"
#!/usr/bin/perl -w
use strict;
my ($line, $cont, $leading_ws, $s);
$line = '';
while (<STDIN>) {
next if (/^#/);
next if (/^\s*$/);
$leading_ws = 0;
while (($_) && (/^\s/o)) {
($s) = (/^\s+(.*)$/);
$_ = $s;
$leading_ws = 1;
}
while (($_) && (/\s$/o)) { chop; }
$line .= $_;
if ($line =~ m#\\$#) {
chop $line;
while (($line) && ($line =~ /\s$/)) { chop $line; }
}
else {
&process_newsfeed($line);
$line = '';
}
}
exit(0);
sub process_newsfeed {
my ($line) = @_;
my (@nf);
@nf = split(/:/, $line);
if ($#nf != 3) {
print "INVALID LINE: $line\n";
return;
}
my ($fname, $sub, $flags, $out) = @nf;
my ($aliases);
if ($fname =~ m#/#) {
my ($peer, $tmpal) = ($fname =~ m#^([^/]+)/(.*)$#);
$fname = $peer;
$aliases = $tmpal;
}
return if ($fname =~ m#!$#);
print "#\n# $fname\n#\n\n<feed>\n";
print "OutgoingFeedName $fname\n";
print "OutgoingHostname $fname\n" if ($fname =~ /\./);
print "Aliases $aliases\n" if ($aliases);
print "Subscription $sub\n";
&process_flags ($flags);
print "</feed>\n\n";
}
sub process_flags {
my ($flags) = @_;
my (@flags, $flag, $arg1);
@flags = split(/,/, $flags);
foreach $flag (@flags) {
# '<' size flag
if (($arg1) = ($flag =~ m#^<(\d+)$#)) {
print "MaxLength ", $arg1 - 1, "\n";
}
# '>' size flag
elsif (($arg1) = ($flag =~ m#^>(\d+)$#)) {
print "MinLength ", $arg1 + 1, "\n";
}
# 'G' crosspost flag
elsif (($arg1) = ($flag =~ m#^G(\d+)$#)) {
print "MaxCrosspost $arg1\n";
}
# 'H' Path hops flag
elsif (($arg1) = ($flag =~ m#^H(\d+)$#)) {
print "MaxHops $arg1\n";
}
}
}
--------------328783422496086A43D3772C
Content-Type: text/plain; charset=us-ascii; name="hn2hw"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="hn2hw"
#!/usr/bin/perl -w
use strict;
my (@hostline, $streaming);
while (<STDIN>) {
next if (/^\s+$/);
next if (/^#/);
while (($_) && (/\s$/)) { chop; }
@hostline = split(/:/);
if (($hostline[1]) && ($hostline[1] =~ m#/s#)) {
$streaming = "AllowStreaming True\n";
} else {
$streaming = '';
}
print "#\n# $hostline[0]\n#\n\n<feed>\n",
"IncomingHostname $hostline[0]\n",
$streaming,
"</feed>\n\n";
}
--------------328783422496086A43D3772C--
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