INN New user....
JG
jg at cms.ac
Fri Oct 22 11:15:02 UTC 2004
hi,
> Hi, the inn-workers list does not like attachments very much; you
> should resend your script pasted into the body of the email.
i saw it, but i also sent the script to him directly, and only CC'ed to
the list.
here it is again for the list.
JG
---
: Use /bin/sh
# This script is used to submit articles to the NetNews system.
# (C) 1989 Dave Taylor, Intuitive Systems <taylor at sunworld.com>
#
# I usually invoke it while reading my email within my mailer,
# as "|submit groupname". -- Dave Taylor
inewscall="/usr/lib/news/bin/inews -h"
approval="email.address at domain"
activefile=/path/to/active/file
followup="group.to.follow.up.postings"
newsgroup=$1
# first off, are we called correctly?
if [ "$newsgroup" = "" ]
then
echo "Usage: $0 newgroup-name"
exit 1
fi
# now is this a valid newsgroup?
if [ ! -f $activefile ]
then
echo No active file\? Where\'s $activefile\?
exit 1
fi
pattern="^$newsgroup"
if [ "`egrep $pattern $activefile`" = "" ]
then
echo Can\'t find newsgroup $newsgroup in $activefile
exit 1
fi
# The next step is to create a temp file that contains the following
# headers and the message body:
#
# From: <the original line from the mail message>
# Subject: <the original subject>
# Distribution: world
# Organization: <the users org, if one exists>
# Approved: taylor at sunworld.com
# let's save the input stream...
cat - > /tmp/submit.$$
# note: we might have more than one, hence the "head -1" addition
from="`egrep '^From:' /tmp/submit.$$ | head -n 1`"
subject="`egrep '^Subject:' /tmp/submit.$$ | head -n 1`"
org="`egrep '^Organization:' /tmp/submit.$$ | head -n 1`"
xnews="`egrep '^X-News' /tmp/submit.$$ | head -n 1`"
xos="`egrep '^X-Operating' /tmp/submit.$$ | head -n 1`"
xicq="`egrep '^X-ICQ' /tmp/submit.$$ | head -n 1`"
if [ "$from" = "" ]
then
from="`head -n 1 /tmp/submit.$$ | awk '{ print \"From: \" $2 }'`"
if [ "$from" = "" ]
then
echo troubles getting a From: line.
from="From: anonymous"
fi
fi
# create the temp file...
echo "$from" > /tmp/inews.$$
if [ "$subject" = "" ]
then
echo "Subject: unknown" >> /tmp/inews.$$
else
echo "$subject" >> /tmp/inews.$$
fi
#echo "Distribution: world" >> /tmp/inews.$$
if [ "$org" != "" ]
then
echo "$org" >> /tmp/inews.$$
else
echo "Organization: " >> /tmp/inews.$$
fi
echo "Approved: $approval" >> /tmp/inews.$$
echo "Followup-To: $followup" >> /tmp/inews.$$
echo "$xnews" >> /tmp/inews.$$
echo "$xos" >> /tmp/inews.$$
echo "$xicq" >> /tmp/inews.$$
# and now copy across the body of the message
cat /tmp/submit.$$ | \
awk '{ if (length($0) == 0) ok++; if (ok) print $0 }' \
>> /tmp/inews.$$
# let's let the user look at it and fix it up, perhaps
vi /tmp/inews.$$ < /dev/tty
# just check that this is what we want to do...
echo " "
/bin/echo -n "Are you sure you want to post this to $newsgroup ? "
read answer < /dev/tty
echo " "
if [ "$answer" = "no" -o "$answer" = "n" ]
then
echo posting cancelled.
/bin/rm -f /tmp/submit.$$ /tmp/inews.$$
exit 0
fi
echo executing the inews call
$inewscall -n $newsgroup < /tmp/inews.$$
/bin/rm -f /tmp/submit.$$ /tmp/inews.$$
echo .. posted without any problems\!
exit 0
-- Attached file included as plaintext by Ecartis --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBeOvGU788cpz6t2kRAh15AJ9+IsEFziEEGOo/y/W/UHy2xbhZTQCfUgmx
oSVmtLG2WZ9nPvvQfrghjCk=
=le/a
-----END PGP SIGNATURE-----
More information about the inn-workers
mailing list