#!/bin/csh -f
# pn
# post current mh mail message as article to whichever newsgroup...
# don't use inews, cheat (direct deliver to nntp port...).
#
# part of MHmod package
# George William Herbert (gwh@crl.com)
# version 0.15 (6/14/94) gwh

###############################################################################
## set these variables to your groups and local setup -gwh

# what's the group?
set group="sci.space.tech"

# what's your moderators/approved address?
set approved="sci-space-tech@isu.isunet.edu"

# where are you putting these files (your personal or local bin directory)
set bindir=/u18/gwh/bin

# what is your nntp server machine?
set nntphost=nntp.crl.com

## that should be the last thing you need to customize
###############################################################################

# setup stuff
alias e0 echo "group $group"
alias e1 echo "post"
alias e2 echo "Approved: $approved"
alias e3 echo "."
alias e4 echo "quit"
alias s sleep 5
alias xnntp nawk -f $bindir/nntp.X.awk

# cd into mail dir
chdir ~/Mail
chdir `grep Current-Folder context | awk '{print $2}'`
set message=`grep cur .mh_sequences | awk '{print $2}'`

# safety check on newsgroups
checkmods $message
echo -n "Sure you want to post this article to these groups? [y for yes] "
if ($< != "y") exit

echo "posting..."

# make tempfile to post
set tmp=/tmp/$$
/bin/rm -f $tmp
cat $message  | xnntp >>& $tmp

# do subshell, all output thru the telnet process 
( e0 ; e1 ; e2 ; cat $tmp ; e3 ; s ; e4) | telnet $nntphost 119

echo "...posted"

# cleanup
/bin/rm -rf $tmp
