🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #1314

Re: Mailing list to newsgroups?

#1314
From: Joe Ilacqua
Date: Tue, 10 Mar 1992 17:26
114 lines
4014 bytes
	Here is a pare of perl script I use to gateway between mailing
lists and local news groups in conjunction with C News.  The seem to
work fine, but I consider them to be beta versions.

->Spike

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  mail2news news2mail
# Wrapped by spike@world on Tue Mar 10 12:26:02 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f mail2news -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"mail2news\"
else
echo shar: Extracting \"mail2news\" \(815 characters\)
sed "s/^X//" >mail2news <<'END_OF_mail2news'
X#!/usr/local/bin/perl
X
X# Gateway a mailing list to a local news group.
X# Written by Spike (spike@world.std.com)
X# invoked for /etc/aliases with a alias like
X# mailing-list-rdist:
X#  "|/usr/local/lib/news/mail2news local.news.group.name distribution"
X
X$group = shift;
X$dist = shift;
Xopen(INEWS,"|/bin/inews -h");
X
Xwhile (<>) {
X
X    next if (/^From /);
X    last unless (/^[^ \t]*:/ || (/^[ \t]/ && $. > 1));
X    if (/^To: /i || /^Cc: /i || /^Received: /i || /Apparently-To: /i 
X	|| /^Return-Path: /) {
X	$killed_last = 1;
X	next;
X    }
X    next if (/^\s+/ && $killed_last);
X    $killed_last = 0;
X    print INEWS $_;
X}
X
Xprint INEWS "Newsgroups: $group\n";
Xprint INEWS "Distribution: $dist\n";
Xprint INEWS "Approved: usenet@world.std.com\n";
X
Xprint INEWS "\n" if /\S+$/;
X
Xprint INEWS $_;
X
Xwhile (<>) { print INEWS $_ ; }
END_OF_mail2news
if test 815 -ne `wc -c <mail2news`; then
    echo shar: \"mail2news\" unpacked with wrong size!
fi
chmod +x mail2news
# end of overwriting check
fi
if test -f news2mail -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"news2mail\"
else
echo shar: Extracting \"news2mail\" \(770 characters\)
sed "s/^X//" >news2mail <<'END_OF_news2mail'
X#!/usr/local/bin/perl
X
X# Gateway a local news group back to a mailing list
X# Written by Spike (spike@world.std.com)
X# add "local.group.name local-mail-alias" to /usr/lib/news/moderators
X# add then add something like to /etc/aliases:
X# local-mail-alias:
X#  "|/usr/local/lib/news/news2mail list-address@somehost"
X
X$list = shift;
X
Xopen(MAIL,"|/usr/lib/sendmail $list");
X
Xwhile (<>) {
X
X    next if (/^From /);
X    last unless (/^[^ \t]*:/ || (/^[ \t]/ && $. > 1));
X    if (/^Newsgroups: /i || /^Distribution: /i || /Apparently-To: /i
X	|| /^Received: /i) {
X	$killed_last = 1;
X	next;
X    }
X    next if (/^\s+/ && $killed_last);
X    $killed_last = 0;
X    print  MAIL $_;
X}
X
Xprint MAIL "To: $list\n";
X
Xprint MAIL "\n" if /\S+$/;
X
Xprint MAIL  $_;
X
Xwhile (<>) { print MAIL $_ ; }
END_OF_news2mail
if test 770 -ne `wc -c <news2mail`; then
    echo shar: \"news2mail\" unpacked with wrong size!
fi
chmod +x news2mail
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
-- 
The World - Public Access Unix - +1 617-739-9753  24hrs {3,12,24,96,192}00bps
Technical Details
Message-ID: <SPIKE.92Mar10122656@world.std.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!world!spike
References: <1992Mar3.185049.17375@pacdata.uucp>

Show Full Headers
Complete Article Headers
Message-ID: <SPIKE.92Mar10122656@world.std.com>
Subject: Re: Mailing list to newsgroups?
Date: Tue, 10 Mar 1992 17:26:56 GMT
From: spike@world.std.com (Joe Ilacqua)
References: <1992Mar3.185049.17375@pacdata.uucp>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!world!spike
Newsgroups: news.software.readers
In-Reply-To: jimh@pacdata.com's message of Tue, 3 Mar 1992 18:50:49 GMT
Sender: spike@world.std.com (Joe Ilacqua)
Organization: Software Tool & Die