echo "Extracting Pnews (with variable substitutions)"
$spitshell >Pnews <<!GROK!THIS!
# $Header: Pnews.SH,v 4.3.1.2 85/05/17 10:36:46 lwall Exp $
# Revision 4.3.1.2 85/05/17 10:36:46 lwall
# Removed some extra backslashes.
# Revision 4.3.1.1 85/05/10 11:30:21 lwall
# Revision 4.3 85/05/01 12:20:33 lwall
# Baseline for release with 4.3bsd.
# syntax: Pnews -h headerfile or
# Pnews -h headerfile oldarticle or
# Pnews newsgroup title or just
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
mailer="${mailer-/bin/mail}"
# if you change this to something that does signatures, take out signature code
# where recordings, distributions and moderators are kept
# where important rn things are kept
# where recordings, distributions and moderators are kept
# where important rn things are kept
# what pager you use--if you have kernal paging use cat
# how you derive full names, bsd, usg, or other
# how not to echo with newline
# You should also look at the distribution warnings below marked !DIST!
# to make sure any distribution regions you are a member of are included.
# The following are some prototypical distribution groups. If you do not
# use them all set the unused ones to a non-null string such as 'none'.
$spitshell >>Pnews <<'!NO!SUBS!'
if $test -f ${DOTDIR-${HOME-$LOGDIR}}/.pnewsexpert; then
I see you've never used this version of Pnews before. I will give you extra
help this first time through, but then you must remember what you learned.
If you don't understand any question, type h and a CR (carriage return) for
If you've never posted an article to the net before, it is HIGHLY recommended
that you read the netiquette document found in net.announce.newusers so
that you'll know to avoid the commonest blunders. To do that, interrupt
Pnews, and get to the top-level prompt of rn. Say "g net.announce.newusers"
$cat < $headerfile > $tmpart
rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.article ; $echo saved in ${HOME-$LOGDIR}/dead.article ; $rm -f $tmpart; exit"
set X `$sed < $tmpart -n -e '/^Distribution: /{' -e p -e q -e '}' -e '/^$/q'`
set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
#if $test -s ${lib}/recording ; then
# ng=`$echo $1 | $sed "s/,.*//"`
# _rec1=${lib}/`$sed -n "/^$ng/s/^.* //p" ${lib}/recording`
# _tmp=`$echo $ng |$sed "s/\..*//"`
# _rec2=${lib}/`$cat -s ${lib}/recording|$grep ${_tmp}.all|$sed "s/^.* //"`
# if $test -f ${_rec1} ; then
# if $test -f ${_rec2} ; then
# tell them what we think they are doing... !DIST!
$echo 'This program posts news to many hundreds of machines throughout the world.'
$echo 'This program posts news to many machines throughout the continent.'
$echo 'This program posts news to many machines throughout the country.'
$echo 'This program posts news to many machines throughout the state.'
$echo 'This program posts news to many machines throughout the city.'
$echo 'This program posts news to machines throughout the organization.'
$echo 'This program posts news to machines throughout the local organization.'
$echo 'This program may post news to many machines.'
$echo 'This program posts news to everyone on the machine.'
while $test "$ans" = "" ; do
$echo $n "Are you absolutely sure that you want to do this? [ny] $c"
Type n or CR to exit, y to post.
while $test "$file" = h ; do
$echo $n "Prepared file to include [none]: $c"
If you have already produced the body of your article, type the filename
for it here. If you just want to proceed directly to the editor, type a
RETURN. In any event, you will be allowed to edit as many times as you
want before you send off the article.
$cat </dev/null >${DOTDIR-${HOME-$LOGDIR}}/.pnewsexpert
A temporary file has been created for you to edit. Be sure to leave at
least one blank line between the header and the body of your message.
(And until a certain bug is fixed all over the net, don't start the body of
your message with any indentation, or it may get eaten.)
Within the header may be fields that you don't understand. If you don't
understand a field (or even if you do), you can simply leave it blank, and
it will go away when the article is posted.
Type return to get the default editor, or type the name of your favorite
case "${VISUAL-${EDITOR-}}" in
while $test "$tmp" = h ; do
$echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"
Type a return to get the default editor, or type the name of the editor you
prefer. The default editor depends on the VISUAL and EDITOR environment
${VISUAL-${EDITOR-$defeditor}} $tmpart $oldart
$echo $n "Send, abort, edit, or list? $c"
Type s to send the article, a to abort and append the article to dead.article,
e to edit the article again, or l to list the article.
set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
if $test -f $lib/moderators; then
*,*) set `$echo $1 | tr ',' ' '`;;
# the following screwy sed should prevent Eunice from hanging on no match
moderator=`$sed <$lib/moderators \
-e "/^$newsgroup[ ]/!s/.*//" \
$echo Mailing to moderator $moderator
$echo To: $moderator | $cat - $tmpart | $mailer
$mailer $moderator < $tmpart
$echo Unable to mail to moderator $moderator
if $inews -h < $tmpart ; then
$echo "Malformed Newsgroups line."
$cat $tmpart >> ${HOME-$LOGDIR}/dead.article
$echo "Article saved to ${HOME-$LOGDIR}/dead.article"
$spitshell >Pnews.header <<'!NO!SUBS!'
while $test "$ng" = h ; do
$echo $n "Newsgroup(s): $c"
Type the name of one or more newsgroups to which you wish to post an article.
If you want to post to multiple newsgroups, it is better to do them all at
once than to post to each newsgroup individually, which defeats the news
reading programs' strategies of eliminating duplicates.
Separate multiple newsgroup names with commas.
ng=`$echo "$ng" | $sed 's/[, ] */,/g'`
defdist=`expr "X$ng" : 'X\([a-z0-9]*\)'`
while $test "$dist" = h ; do
if $test -f $lib/distributions; then
$echo "Your local distribution prefixes are:"
$egrep -v '[ ]none$' <<EOM
Your local distribution prefixes are:
$echo $n "Distribution ($defdist): $c"
The Distribution line may be used to limit the distribution of an article
to some subset of the systems that would receive the article based only on
the Newsgroups line. For example, if you want to sell your car in net.auto,
and you live in New Jersey, you might want to put "nj" on the Distribution
line to avoid advertising in California, which has enough problems of its own.
The actual area designators to use depend on where you are, of course.
''|$loc*|$org*|$city*|$state*|$cntry*|$cont*|fa*|mod*)
if $test -f $lib/distributions && \
$egrep "^$dist[ ]" $lib/distributions >$tmpart && \
$echo "Unrecognized distribution prefix--type h for help."
follow=`echo "$ng" | sed 's/net\.general/net.followup/g'`
while $test "$title" = h ; do
$echo $n "Title/Subject: $c"
Type the title for your article. Please make it as informative as possible
(within reason) so that people who aren't interested won't have to read the
article to find out they aren't interested. This includes marking movie
spoilers as (spoiler), and rotated jokes as (rot 13).
# now build a file with a header for them to edit
set X ${USER-${LOGNAME-`who am i`}}
*!*) logname=`expr "$logname" : '!\(.*\)$'` ;;
case ${NAME-$nametype} in
fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
lname=`$echo $logname | $tr 'a-z' 'A-Z'`
lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
fullname=${NAME-`$cat ${HOME-$LOGDIR}/.fullname`}
orgname=${ORGANIZATION-$orgname}
/*) orgname=`$cat $orgname` ;;
$cat > $tmpart <<EOHeader
Reply-To: $logname@$sitename.UUCP ($fullname)