recordings in postnews, BSD version revisited
Chuq Von Rospach
chuqui at nsc.UUCP
Wed May 30 05:40:30 AEST 1984
Per hedeland (erix!per) dropped me a note which pointed out some
shortcomings of my version of postnews that I posted a while back. Among
other things, if you install it and don't support recordings you get
spurious error messages. Also, posting to 'general' when there is a
recording for 'net.general' will get the recording message. He was nice
enough to ship me fixes for all of this which I have installed and am now
sending to the rest of reality. I am also enclosing a couple of small
patches to inews. The first removes recordings from inews, the other
removes some dead code that is still hanging around but is never used.
chuq
--- postnews ---
#! /bin/sh
:
: 'modified 12/8/83 by Prentiss Riddle (riddle at ut-sally.UUCP) not to '
: ' ignore a Distribution specification when invoked with a '
: ' filename argument. '
:
: 'modified 4/7/84 by chuq von rospach (nsc!chuqui) to print out '
: 'recordings where appropriate. Based on version posted for usg by'
: 'nwuxd!dbaker'
:
: ' modified 5/25/84 by chuq von rospach (nsc!chuqui) with modifications'
: 'suggested by mcvax!enea!erix!per (Per Hedeland) to handle recordings'
: 'more intelligently and also handle no recordings at all'
:
_NEWSLIB=/usr/lib/news
if test $# -gt 1 ; then
/bin/echo "$0: Too many args"
exit 1
fi
if test $# -eq 1 -a ! -r "$1" ; then
/bin/echo "$0: Can't read $1"
exit 1
fi
/bin/echo -n "Subject: "
read title
/bin/echo -n "Newsgroups (general): "
read ng
if test x$ng = x ; then
ng=general
fi
: play recorded message
if test -s ${_NEWSLIB}/recording ; then
_rec1=${_NEWSLIB}/`sed -n "/^$ng/s/^.* //p" ${_NEWSLIB}/recording`
_tmp=`echo $ng |sed "s/\..*//"`
_rec2=${_NEWSLIB}/`cat -s ${_NEWSLIB}/recording|grep ${_tmp}.all|sed "s/^.* //"`
if test -f ${_rec1} ; then
cat -s ${_rec1}
fi
if test -f ${_rec2} ; then
cat -s ${_rec2}
fi
fi
/bin/echo -n "Distribution ($ng): "
read dist
if test x$dist = x; then
dist=$ng
fi
t=/tmp/pn$$
trap "sleep 1; cp $t $HOME/dead.article ; echo saved in $HOME/dead.article ; rm -f $t; exit" 1
trap "" 2
/bin/echo "Subject: $title" > $t
/bin/echo "Newsgroups: $ng" >> $t
if test $dist != $ng; then
/bin/echo "Distribution: $dist" >> $t
fi
/bin/echo "" >> $t
case $# in
0)
${EDITOR-vi} $t
cd /tmp
if inews -h <$t
then
:
else
if cat $t >>$HOME/dead.article
then
/bin/echo Article saved in $HOME/dead.article
fi
fi
;;
1)
cat $1 >>$t
cd /tmp
inews -h < $t
;;
esac
sleep 1
rm -f $t
--- end of postnews ---
--- beginning of inews fix ---
------- inews.c -------
250,258d249
< tty = isatty(fileno(stdin));
< if (!Dflag && mode != PROC && mode != CREATENG) {
< if (recording(header.nbuf)) {
< if (!tty)
< fwait(fsubr(newssave, stdin, NULL));
< xerror("aborted due to recording");
< }
< }
<
662,667d652
< if (*filename) {
< tty = FALSE;
< infp = xfopen(filename, "r");
< } else {
< infp = stdin;
< }
702,703d686
< if (*filename)
< fclose(infp);
--- end of inews fix ---
--
>From the closet of anxieties of: Chuq Von Rospach
{amd70,fortune,hplabs,ihnp4}!nsc!chuqui (408) 733-2600 x242
I'm sure I have my death ray in here somewhere...
More information about the Comp.sources.unix
mailing list