DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T s

⟦7711c2d6e⟧ TextFile

    Length: 3109 (0xc25)
    Types: TextFile
    Names: »sendnewsmail«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/news/misc/sendnewsmail« 

TextFile

From cbosg!ucbvax!decvax!ittvax!swatt Thu Mar 25 07:06:53 1982
Date: Wed Mar 24 20:29:56 1982
From: cbosg!ucbvax!decvax!ittvax!swatt
Subject: sendnewsmail script
Via: cbosgd.uucp (V3.73 [1/5/82]); 25-Mar-82 07:06:53-EST (Thu)
Mail-From: cbosg received by cbosgd at 25-Mar-82 07:06:51-EST (Thu)
To: cbosgd!mark
Status: R


Mark:

I find the following handy as a mail interface to news; you don't have
to remake the aliases database everytime a new newsgroup gets formed.

	- Alan
=======================================================================
#! /bin/sh
: '/*********************************************************************
   program:	sendnewsmail
   description:	Send news items from mail
   programmer:	Alan S. Watt
		(ittvax!swatt)
   
   Sccsid=@W@

   usage:
	Not invoked by user: called as program mail alias
	News item title and newsgroup(s) are specified on the
	mail subject line by:

	Subj: <news item title> : <newsgroup> ...

	Several (blank separated) newsgroups may be specified;
	the news article will be submitted to each.  There is
	no way to embed a colon character in the title, so there
	can only be one colon on the subject line.

   arguments:
	None
   
   notes:
	To install this, put it someplace safe from system updates
	(I use /usr/lib/news), and put an alias in the system
	mail alias file (/usr/lib/aliases) that names this program
	as the alias for the use "news":

		news:"|/usr/lib/news/sendnewsmail"

   history:
	11/11/81	original version
	11/19/81	fixed to properly handle default newsgroup
	03/13/82	changes to work with "B" netnews
	03/35/82	Modest documentation changes
   *********************************************************************/'

PROGRAM_NAME='sendnewsmail'
VERSION_NUMBER='@I@'
TOOL_LOG='/usr/advanced/logs/testlog'
USAGE='mail news'


: 'mail alias program to send news items through mail(1)'
: 'need to get newsgroup and title from subject line'

tempf=/tmp/news$$.tmp
errorf=/tmp/news$$.err

: 'copy standard input to a temporary file'
cat >$tempf

: 'read the message and grab title and newsgroups from the
   Subject line. Grab the sender from the From line.
   Header ends on first blank line (/^$/).
  '
eval `sed -n '
/^Subj/	{
	s/^Subj[^ :]*[ :] *\([^:]*\):\(.*\)/title="\1";newsgroup="\2"/p
	s/^Subj[^ :]*[ :] *\([^:]*\)$/title="\1"/p
}
/^From/ {
	s/^[fF]rom[: ] *\([^ ]*\).*/sender="\1"/p
}
/^$/	{
	b done
}
: done
' $tempf`

: 'default newsgroup to "general" if unspecified'
case $newsgroup in
'')	newsgroup=general ;;
esac

: 'make up something if the title unspecified'
case $title in
'')	title="News from mail" ;;
esac

: 'Submit the article to news'
if sed "1,/^$/d" $tempf | inews -t "$title" -n $newsgroup >$errorf 2>&1
then
	: 'OK exit, do nothing'
else
	: 'On errors, return article together with error messages to user'
	: 'Change this line if your mailer does not have a -s flag'
	mail -s 'Rejected News Article' $sender <<!EOF

The news article you submitted could not be accepted for the reasons:
`cat $errorf`

The text of the article you submitted was:
`cat $tempf`
!EOF

fi

: 'clean up'
rm -f $tempf $errorf