v23i063: TRN, version of RN that follows conversation threads, Part04/14

Rich Salz rsalz at bbn.com
Sat Dec 1 08:40:15 AEST 1990


Submitted-by: Wayne Davison <davison at dri.com>
Posting-number: Volume 23, Issue 63
Archive-name: trn/part04

---- Cut Here and unpack ----
#!/bin/sh
# this is part 4 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file Pnews.1 continued
#
CurArch=4
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file Pnews.1"
sed 's/^X//' << 'SHAR_EOF' >> Pnews.1
X.SH ENVIRONMENT
X.IP AUTHORCOPY 8
XIf defined, contains the name of a file to which the finished article will
Xbe appended.
X.Sp
XDefault: article not saved
X.IP DOTDIR 8
XWhere to find your dot files, if they aren't in your home directory.
XThis is primarily for accounts which are shared by more than one person.
X.Sp
XDefault: $HOME
X.IP EDITOR 8
XThe editor you want to use, if VISUAL is undefined.
X.Sp
XDefault: whatever your news administrator installed, usually vi.
X.IP HOME 8
XYour home directory.
X.Sp
XDefault: $LOGDIR
X.IP LOGDIR 8
XYour home directory if HOME is undefined.
X.IP LOGNAME 8
XYour login name, if USER is undefined.
X.Sp
XDefault: value of \*(L"whoami\*(R".
X.IP NAME 8
XYour full name.
X.Sp
XDefault: name from /etc/passwd, or ~/.fullname.
X.IP ORGANIZATION 8
XEither the name of your organization, or the name of a file containing the
Xname of your organization.
X.Sp
XDefault: whatever your news administrator chose.
X.IP REPLYTO 8
XThe contents of a \*(L"Reply-To:\*(R" header line to insert into your message.
X.Sp
XDefault: header line not inserted.
X.IP USER 8
XYour login name.
X.Sp
XDefault: $LOGNAME
X.IP VISUAL 8
XThe editor you want to use.
X.Sp
XDefault: $EDITOR
X.SH FILES
X$DOTDIR/.article
X.br
X~/dead.article
X.SH SEE ALSO
Xrn(1), Rnmail(1), inews(1)
X.SH DIAGNOSTICS
X.SH BUGS
XNot the speediest program in the world, but maybe that's a blessing to the
Xnet.
SHAR_EOF
echo "File Pnews.1 is complete"
chmod 0660 Pnews.1 || echo "restore of Pnews.1 fails"
echo "x - extracting Pnews.SH (Text)"
sed 's/^X//' << 'SHAR_EOF' > Pnews.SH &&
Xcase $CONFIG in
X    '') . ./config.sh ;;
Xesac
Xecho "Extracting Pnews (with variable substitutions)"
X$spitshell >Pnews <<!GROK!THIS!
X$startsh
X# $Header: Pnews.SH,v 4.3.3.1 90/07/24 22:01:25 davison Trn $
X#
X# $Log:	Pnews.SH,v $
X# Revision 4.3.3.1  90/07/24  22:01:25  davison
X# Initial Trn Release
X# 
X# Revision 4.3.2.7  90/05/04  23:14:45  sob
X# Expires: line removed from Pnews.header.
X# 
X# Revision 4.3.2.6  90/04/21  16:53:43  sob
X# Corrected a typo pointed out by Bill Aten.
X# 
X# Revision 4.3.2.5  89/12/17  01:53:48  sob
X# Changed from using ypcat to using ypmatch
X# 
X# Revision 4.3.2.4  89/12/09  01:48:30  sob
X# Reply-To: field removed. This makes all the headers created by rn
X# look roughly the same.
X# 
X# Revision 4.3.2.3  89/11/26  22:20:04  sob
X# Added support for some of the top level names that are not part of
X# the mainstream.
X# 
X# Revision 4.3.2.2  89/11/06  00:25:39  sob
X# Some minor changes to make the help messages more accurate
X# 
X# Revision 4.3.2.1  89/11/06  00:21:30  sob
X# Added RRN support from NNTP 1.5
X# 
X# Revision 4.3.1.4  86/09/05  15:21:10  lwall
X# Changes for new top-level newsgroup names.
X# 
X# Revision 4.3.1.3  85/08/01  14:24:06  lwall
X# Added AUTHORCOPY.  Temp file is no longer in /tmp.  'e editor' added.
X# 
X# Revision 4.3.1.2  85/05/17  10:36:46  lwall
X# Removed some extra backslashes.
X# 
X# Revision 4.3.1.1  85/05/10  11:30:21  lwall
X# Branch for patches.
X# 
X# Revision 4.3  85/05/01  12:20:33  lwall
X# Baseline for release with 4.3bsd.
X# 
X#
X# syntax: Pnews -h headerfile			or
X#	  Pnews -h headerfile oldarticle	or
X#         Pnews newsgroup title			or just
X#         Pnews
X
Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
X
X# System dependencies
X
Xmailer="${mailer-/bin/mail}"
X# if you change this to something that does signatures, take out signature code
X
Xcase $portable in
Xdefine)
X# your site name
Xsitename=\`$hostcmd\`
Xcase \$sitename in
X	*.*)
X		;;
X	*)
X		sitename=\${sitename}.$domain
X		;;
Xesac
X# where recordings, distributions and moderators are kept
Xlib=\`$filexp $lib\`
X# where important rn things are kept
Xrnlib=\`$filexp $rnlib\`
X;;
Xundef)
X# your site name
Xsitename="$sitename"
X# where recordings, distributions and moderators are kept
Xlib="$lib"
X# where important rn things are kept
Xrnlib="$rnlib"
X;;
Xesac
X
X# your organization name
Xorgname="$orgname"
X# what pager you use--if you have kernal paging use cat
Xpager="\${PAGER-$pager}"
X# how you derive full names, bsd, usg, or other
Xnametype="$nametype"
X# default editor
Xdefeditor="$defeditor"
X# how not to echo with newline
Xn="$n"
Xc="$c"
X
X# You should also look at the distribution warnings below marked !DIST!
X# to make sure any distribution regions you are a member of are included.
X# The following are some prototypical distribution groups.  If you do not
X# use them all set the unused ones to a non-null string such as 'none'.
Xloc="$locpref"
Xorg="$orgpref"
Xcity="$citypref"
Xstate="$statepref"
Xcntry="$cntrypref"
Xcont="$contpref"
X
Xtest=${test-test}
Xsed=${sed-sed}
Xecho=${echo-echo}
Xcat=${cat-cat}
Xegrep=${egrep-egrep}
Xgrep=${grep-grep}
Xrm=${rm-rm}
Xtr=${tr-tr}
Xinews=${inews-inews}
Xypmatch=${ypmatch}
X
X!GROK!THIS!
X$spitshell >>Pnews <<'!NO!SUBS!'
Xdotdir=${DOTDIR-${HOME-$LOGDIR}}
Xtmpart=$dotdir/.article
X
Xif $test -f $dotdir/.pnewsexpert; then
X    expertise=expert
Xelse
X    $cat <<'EOM'
XI see you've never used this version of Pnews before.  I will give you extra
Xhelp this first time through, but then you must remember what you learned.
XIf you don't understand any question, type h and a CR (carriage return) for
Xhelp.
X
XIf you've never posted an article to the net before, it is HIGHLY recommended
Xthat you read the netiquette document found in news.announce.newusers so
Xthat you'll know to avoid the commonest blunders.  To do that, interrupt
XPnews, and get to the top-level prompt of rn.  Type "g news.announce.newusers"
Xand you are on your way.
X
XEOM
X    expertise=beginner
Xfi
X
Xcase $cntry in
X  can) stpr=Province ;;
X  *)   stpr=State ;;
Xesac
X
Xheaderfile=""
Xcase $# in
X0) ;;
X*)  case $1 in
X    -h)
X	headerfile="$2"
X	shift
X	shift
X	case $# in
X	0)
X	    oldart=""
X	    ;;
X	*)
X	    oldart="$1"
X	    shift
X	    ;;
X	esac
X	;;
X    esac
X    ;;
Xesac
X
Xcase $headerfile in
X'')
X    . $rnlib/Pnews.header
X    ;;
X*)
X    $cat < $headerfile  > $tmpart
X    ;;
Xesac
X    rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.article ; $echo Article appended to ${HOME-$LOGDIR}/dead.article ; exit"
X    trap "$rescue" 1
X    trap "$rescue" 2
X
X$echo ""
X
X# extract the newsgroups list and distribution
Xhdr_newsgroups=`$sed -n -e '/^Newsgroups:/{' -e 's///' -e 's/,/ /g' -e p -e q -e '}' $tmpart`
Xhdr_distribution=`$sed -n -e '/^Distribution:/{' -e 's///' -e p -e q -e '}' $tmpart`
X
X# check for "poster" magic cookie
Xflag=0
Xfor ng in $hdr_newsgroups ; do
X    case "$ng" in
X	poster)	flag=1 ;;
X	*)	;;
X    esac
Xdone
Xcase $flag in
X1)
X    $echo " "
X    $echo "The original author has requested that messages be sent back via"
X    $echo "mail rather than posting to news.  Do you want to jump out of this"
X    $echo $n "and mail your reply instead? [yn] $c"
X    read ans
X    case $ans in
X	n*) ;;
X	*)  exit ;;
X    esac
X    $echo " "
X    $echo "OK, but you will have to edit the 'Newsgroups:' line in the message."
X    ;;
Xesac
X  
X# play recorded message
Xif $test -s ${lib}/recording ; then
X     for ng in $hdr_newsgroups ; do
X	_rec1=${lib}/`$sed -n "/^$ng/s/^.*	//p" ${lib}/recording`
X	_tmp=`$echo $ng |$sed "s/\..*//"`
X	_rec2=${lib}/`$cat -s ${lib}/recording|$grep ${_tmp}.all|$sed "s/^.*	//"`
X	if $test -f ${_rec1} ; then
X	    $cat -s ${_rec1}
X	fi
X	if $test -f ${_rec2} ; then
X	    $cat -s ${_rec2}
X	fi
X    done
Xfi
X
X# determine the distribution of this message
Xset X $hdr_distribution
Xshift
Xif $test $# -gt 0 ; then
X    dist=$1
Xelse
X    set X $hdr_newsgroups
X    shift
X    if $test $# -gt 0 ; then
X	dist=$1
X    else
X	dist=misc.whatever
X    fi
Xfi
X
X# tell them what we think they are doing... !DIST!
Xcase $dist in
Xworld.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*|alt.*)
X    $cat <<'EOM'
XThis program posts news to thousands of machines throughout the entire
Xcivilized world.  Your message will cost the net hundreds if not thousands of
Xdollars to send everywhere.  Please be sure you know what you are doing.
X
XEOM
X    ;;
Xvmsnet.*)
X    $echo 'This program posts news to many machines.'
X    ;;
Xbit.*)
X    $echo 'This program posts news to many machines on BITNET.'
X    ;;
Xddn.*)
X    $echo 'This program posts news to many machines throughout the internet.'
X    ;;
X$cont.*)
X    $echo 'This program posts news to many machines throughout the continent.'
X    ;;
X$cntry.*)
X    $echo 'This program posts news to many machines throughout the country.'
X    ;;
X$state.*)
X    $echo 'This program posts news to many machines throughout the state.'
X    ;;
X$city.*)
X    $echo 'This program posts news to many machines throughout the city.'
X    ;;
X$org.*)
X    $echo 'This program posts news to machines throughout the organization.'
X    ;;
X$loc.*)
X    $echo 'This program posts news to machines throughout the local organization.'
X    ;;
X*.*)
X    $echo 'This program may post news to many machines.'
X    ;;
Xto.*)
X    $echo 'This program may post news to a partcular machine.'
X    ;;
X*)
X    $echo 'This program posts news to everyone on the machine.'
X    ;;
Xesac
Xans=""
Xwhile $test "$ans" = "" ; do
X    $echo $n "Are you absolutely sure that you want to do this? [ny] $c"
X    read ans
X    case $ans in
X    y*) ;;
X    f*) ;;
X    h*) $cat <<'EOH'
X
XType n or CR to exit, y to post.
X
XEOH
X	ans="" ;;
X    *) exit ;;
X    esac
Xdone
X
Xfile=h
Xwhile $test "$file" = h ; do
X    $echo ""
X    $echo $n "Prepared file to include [none]: $c"
X    read file
X    case $file in
X    h)
X	$cat <<'EOH'
X
XIf you have already produced the body of your article, type the filename
Xfor it here.  If you just want to proceed directly to the editor, type a
XRETURN.  In any event, you will be allowed to edit as many times as you
Xwant before you send off the article.
XEOH
X	;;
X    '')
X	$echo "" >> $tmpart
X	state=edit
X	;;
X    *)
X	$cat $file >>$tmpart
X	state=ask
X	;;
X    esac
Xdone
X
X$echo ""
X
Xwhile true ; do
X    case $state in
X    edit)
X	case $expertise in
X	beginner)
X	    $cat </dev/null >$dotdir/.pnewsexpert
X	    $cat <<'EOMessage'
XA temporary file has been created for you to edit.  Be sure to leave at
Xleast one blank line between the header and the body of your message.
X(And until a certain bug is fixed all over the net, don't start the body of
Xyour message with any indentation, or it may get eaten.)
X
XWithin the header may be fields that you don't understand.  If you don't
Xunderstand a field (or even if you do), you can simply leave it blank, and
Xit will go away when the article is posted.
X
XType return to get the default editor, or type the name of your favorite
Xeditor.
X
XEOMessage
X	    ;;
X	esac
X	case "${VISUAL-${EDITOR-}}" in
X	'')
X	    tmp=h
X	    ;;
X	*)
X	    tmp=''
X	    ;;
X	esac
X	while $test "$tmp" = h ; do
X	    $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"
X	    read tmp
X	    case $tmp in
X	    h)
X		$cat <<'EOH'
X
XType a return to get the default editor, or type the name of the editor you
Xprefer.  The default editor depends on the VISUAL and EDITOR environment
Xvariables.
X
XEOH
X		;;
X	    '')
X		;;
X	    *)
X		VISUAL=$tmp
X		export VISUAL
X		;;
X	    esac
X	done
X	trap : 2
X	${VISUAL-${EDITOR-$defeditor}} $tmpart $oldart
X	trap "$rescue" 2
X	state=ask
X	;;
X	
X    ask)
X	$echo ""
X	$echo $n "Send, abort, edit, or list? $c"
X	read ans
X	
X	case "$ans" in
X	a*)
X	    state=rescue
X	    ;;
X	e*)
X	    set $ans
X	    case $# in
X	    2)  VISUAL="$2" ;;
X	    esac
X	    state=edit
X	    ;;
X	l*)
X	    $pager $tmpart
X	    state=ask
X	    ;;
X	s*)
X	    state=send
X	    ;;
X	h*)
X	    $cat <<'EOH'
X
XType s to send the article, a to abort and append the article to dead.article,
Xe to edit the article again, or l to list the article.
X
XTo invoke an alternate editor, type 'e editor'.
XEOH
X	esac
X	;;
X    
X    send)
X	set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
X	shift
X	case $# in
X	2)
X	    state=cleanup
X	    if $test -f $lib/moderators; then
X		tryinews=no
X		shift
X		case "$1" in
X		*,*) set `$echo $1 | tr ',' ' '`;;
X		esac
X		for newsgroup in $*; do
X# the following screwy sed should prevent Eunice from hanging on no match
X		    moderator=`$sed <$lib/moderators \
X		    -e "/^$newsgroup[ 	]/!s/.*//" \
X		    -e "s/^$newsgroup[ 	]//"`
X		    case ${moderator}X in
X		    X)  tryinews=yes
X			;;
X		    *)
X			$echo Mailing to moderator $moderator
X			case "$sign" in
X			n*) ;;
X			*)
X			    if $test -f $dotdir/.signature; then
X				echo $n "Append .signature file? [y] $c"
X				read ans
X				case $ans in
X				''|y*)
X				    echo "-- " >> $tmpart
X				    cat $dotdir/.signature >> $tmpart
X				    ;;
X				esac
X			    fi
X			    sign=no
X			    ;;
X			esac
X			case "$mailer" in
X			*recmail)
X			    $echo To: $moderator | $cat - $tmpart | $mailer
X			    ;;
X			*)
X			    $mailer $moderator < $tmpart
X			    ;;
X			esac
X			case $? in
X			0) ;;
X			*)
X			    $echo Unable to mail to moderator $moderator
X			    state=rescue
X			    ;;
X			esac
X			;;
X		    esac
X		done
X	    else
X		tryinews=yes
X	    fi
X	    case "$tryinews" in
X	    yes)
X		if $inews -h < $tmpart ; then
X		    : null
X		else
X		    state=rescue
X		fi
X		;;
X	    esac
X	    ;;
X	*)
X	    $echo ""
X	    $echo "Malformed Newsgroups line."
X	    $echo ""
X	    sleep 1
X	    state=edit
X	    ;;
X	esac
X	;;
X    rescue)
X	$cat $tmpart >> ${HOME-$LOGDIR}/dead.article
X	$echo "Article appended to ${HOME-$LOGDIR}/dead.article"
X	$echo "A copy may be temporarily found in $tmpart"
X	exit
X	;;
X    cleanup)
X	case "${AUTHORCOPY-none}" in
X	none)
X	    ;;
X	*)
X	    set X ${USER-${LOGNAME-`who am i`}} unknown
X	    shift
X	    logname=$1
X	    if $echo "From $logname `date`" >> $AUTHORCOPY; then
X		$cat $tmpart >> $AUTHORCOPY
X		$echo "Article appended to $AUTHORCOPY"
X		$echo "" >> $AUTHORCOPY
X		$echo "" >> $AUTHORCOPY
X	    else
X		$echo "Cannot append to $AUTHORCOPY"
X	    fi
X	    ;;
X	esac
X	exit
X	;;
X    esac
Xdone
X!NO!SUBS!
X$eunicefix Pnews
Xchmod 755 Pnews
X$spitshell >Pnews.header <<'!NO!SUBS!'
Xcase $# in
X0)
X    ng=h
X    while $test "$ng" = h ; do
X	$echo ""
X	$echo $n "Newsgroup(s): $c"
X	read ng
X	case $ng in
X	h)
X	    $cat <<'EOH'
X
XType the name of one or more newsgroups to which you wish to post an article.
XIf you want to post to multiple newsgroups, it is better to do them all at
Xonce than to post to each newsgroup individually, which defeats the news
Xreading programs' strategies of eliminating duplicates.
X
XSeparate multiple newsgroup names with commas.
XEOH
X	    ;;
X	esac
X    done
X    ;;
X*)
X    ng=$1
X    shift
X    ;;
Xesac
Xcase $ng in
X*\ *)
X    ng=`$echo "$ng" | $sed 's/[, ] */,/g'`
X    ;;
Xesac
Xcase $ng in
Xbit.*|pubnet.*|bionet.*|vmsnet.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*|alt.*)
X    defdist=world
X    dist=h
X    ;;
Xddn.*)
X    defdist=inet
X    dist=h
X    ;;
Xto.*)
X    defdist=''
X    dist=''
X    ;;
X*.*)
X    defdist=`expr "X$ng" : 'X\([a-z0-9]*\)'`
X    dist=h
X    ;;
X*)
X    defdist=''
X    dist=''
X    ;;
Xesac
X
Xwhile $test "$dist" = h ; do
X    if $test -f $lib/distributions; then
X	$echo " "
X	$echo "Your local distribution prefixes are:"
X	$cat $lib/distributions
X	$echo " "
X    else
X	$egrep -v '[	 ]none$' <<EOM
X
XYour local distribution prefixes are:
X    Local organization:	$loc
X    Organization:	$org
X    City:		$city
X    $stpr:  		$state
X    Country:		$cntry
X    Continent:		$cont
X    Everywhere:		world
X
XEOM
X    fi
X    $echo $n "Distribution ($defdist): $c"
X    read dist
X    case $dist in
X    '') dist=$defdist ;;
X    esac
X    case $dist in
X    h)
X	$cat <<'EOH'
X
XThe Distribution line may be used to limit the distribution of an article
Xto some subset of the systems that would receive the article based only on
Xthe Newsgroups line.  For example, if you want to sell your car in talk.auto,
Xand you live in New Jersey, you might want to put "nj" on the Distribution
Xline to avoid advertising in California, which has enough problems of its own.
XThe actual area designators to use depend on where you are, of course.
XEOH
X	;;
X    ''|$loc*|$org*|$city*|$state*|$cntry*|$cont*|$defdist)
X	;;
X    world*|comp*|news*|sci*|rec*|misc*|soc*|talk*|alt*)
X	dist=''
X	;;
X    *)  
X	if $test -f $lib/distributions && \
X	  $egrep "^$dist[ 	]" $lib/distributions >$tmpart && \
X	  $test -s $tmpart; then
X	    : null
X	else
X	    $echo "Unrecognized distribution prefix--type h for help, CR to use anyway."
X	    defdist=$dist
X	    dist=h
X	fi
X	;;
X    esac
Xdone
X
Xfollow=""
X
Xcase $# in
X0)
X    title=h
X    while $test "$title" = h ; do
X	$echo ""
X	$echo $n "Title/Subject: $c"
X	read title
X	case $title in
X	h)
X	    $cat <<'EOH'
X
XType the title for your article.  Please make it as informative as possible
X(within reason) so that people who aren't interested won't have to read the
Xarticle to find out they aren't interested.  This includes marking movie
Xspoilers as (spoiler), and rotated jokes as (rot 13).
XEOH
X	;;
X	esac
X    done
X    ;;
X*)
X    title="$*"
X    ;;
Xesac
X
X# now build a file with a header for them to edit
X
Xset X ${USER-${LOGNAME-`who am i`}}
Xshift
Xlogname=$1
Xcase $logname in
X*!*) logname=`expr "$logname" : '!\(.*\)$'` ;;
Xesac
Xcase ${NAME-$nametype} in
Xbsd)
X 	if $test "$ypmatch" != ""; then
X 		fullname=`$ypmatch $logname passwd 2>/dev/null | $sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/"`
X 	fi
X     if $test "$fullname" = ""; then
X 		fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
X 	fi
X    case $fullname in
X    *'&'*) : GACK
X	lname=`$echo $logname | $tr 'a-z' 'A-Z'`
X	lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
X	fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
X	;;
X    esac
X    ;;
Xusg)
X 	if $test "$ypmatch" != ""; then
X 		fullname=`$ypmatch $logname passwd 2>/dev/null | $sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"`
X 	fi
X     if $test "$fullname" = ""; then
X    fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
X 	fi
X    ;;
X*)
X    fullname=${NAME-`$cat $dotdir/.fullname`}
X    ;;
Xesac
X
Xorgname=${ORGANIZATION-$orgname}
Xcase $orgname in
X/*) orgname=`$cat $orgname` ;;
Xesac
X
X$sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
XNewsgroups: $ng
XSubject: $title
XReply-To: $REPLYTO
XFollowup-To: $follow
XDistribution: $dist
XOrganization: $orgname
XKeywords: 
X
XEOHeader
X
X!NO!SUBS!
Xcase "$isrrn" in
Xdefine) sed < Pnews.header -e '/^#NORMAL/d' > Pnews.h.new ;;
X*)  sed < Pnews.header -e '/^#NORMAL/s/^#NORMAL//' > Pnews.h.new ;;
Xesac
Xmv Pnews.h.new Pnews.header
X$eunicefix Pnews.header
SHAR_EOF
chmod 0770 Pnews.SH || echo "restore of Pnews.SH fails"
echo "x - extracting Rnmail.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > Rnmail.1 &&
X''' $Header: Rnmail.1,v 4.3.3.1 90/07/21 19:57:27 davison Trn $
X''' 
X''' $Log:	Rnmail.1,v $
X''' Revision 4.3.3.1  90/07/21  19:57:27  davison
X''' Initial Trn Release
X''' 
X''' Revision 4.3.1.2  85/08/01  14:22:08  lwall
X''' Added MAILRECORD, DOTDIR.
X''' 
X''' Revision 4.3.1.1  85/05/10  11:30:44  lwall
X''' Branch for patches.
X''' 
X''' Revision 4.3  85/05/01  11:34:28  lwall
X''' Baseline for release with 4.3bsd.
X''' 
X.de Sh
X.br
X.ne 5
X.PP
X\fB\\$1\fR
X.PP
X..
X.de Sp
X.if t .sp .5v
X.if n .sp
X..
X'''
X'''     Set up \*(-- to give an unbreakable dash;
X'''     string Tr holds user defined translation string.
X'''     Bell System Logo is used as a dummy character.
X'''
X.ie n \{\
X.tr \(bs-\*(Tr
X.ds -- \(bs-
X.if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
X.if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
X.ds L" ""
X.ds R" ""
X.ds L' '
X.ds R' '
X'br\}
X.el\{\
X.ds -- \(em\|
X.tr \*(Tr
X.ds L" ``
X.ds R" ''
X.ds L' `
X.ds R' '
X'br\}
X.TH RNMAIL 1 LOCAL
X.SH NAME
XRnmail - a program for replying via mail
X.SH SYNOPSIS
X.B Rnmail destination_list
X.br
X  or
X.br
X.B Rnmail -h headerfile [oldarticle]
X.br
X  or
X.br
X.B Rnmail
X.SH DESCRIPTION
XRnmail is a friendly interface for mailing replies to news articles.
XIt will ask several questions, then allow you to enter your letter,
Xand then mail it off.
XIf you type h and a carriage return at any point,
X.I Rnmail
Xwill tell you what it wants to know.
X.PP
XThe -h form is used when invoked from
X.IR rn .
XIf your editor can edit multiple files, and you want the article to which
Xyou are replying to show up as an alternate file, define the environment
Xvariable MAILPOSTER as \*(L"Rnmail -h %h %A\*(R".
XYou can also modify the the MAILHEADER environment variable to change the
Xheader file that
X.I rn
Xpasses to Rnmail.
X.SH ENVIRONMENT
X.IP DOTDIR 8
XIf defined, specifies a place other than your home directory where 'dot' files
Xmay be stored.
XThis is primarily for accounts which are shared by more than one person.
X.Sp
XDefault: $HOME
X.IP EDITOR 8
XThe editor you want to use, if VISUAL is undefined.
X.Sp
XDefault: whatever your news administrator installed, usually vi.
X.IP HOME 8
XYour home directory.
X.Sp
XDefault: $LOGDIR
X.IP LOGDIR 8
XYour home directory if HOME is undefined.
X.IP LOGNAME 8
XYour login name, if USER is undefined.
X.Sp
XDefault: value of \*(L"whoami\*(R".
X.IP MAILRECORD 8
XIf defined, contains the name of a file to which the finished message will
Xbe appended.
X.Sp
XDefault: message not saved
X.IP ORGANIZATION 8
XEither the name of your organization, or the name of a file containing the
Xname of your organization.
X.Sp
XDefault: whatever your news administrator chose.
X.IP REPLYTO 8
XThe contents of a \*(L"Reply-To:\*(R" header line to insert into your message.
X.Sp
XDefault: header line not inserted.
X.IP USER 8
XYour login name.
X.Sp
XDefault: $LOGNAME
X.IP VISUAL 8
XThe editor you want to use.
X.Sp
XDefault: $EDITOR
X.SH FILES
X$DOTDIR/.letter
X.br
X~/dead.letter
X.SH SEE ALSO
Xrn(1), Pnews(1), mail(1)
X.SH DIAGNOSTICS
X.SH BUGS
XUses /bin/mail in the absence of sendmail.
SHAR_EOF
chmod 0660 Rnmail.1 || echo "restore of Rnmail.1 fails"
echo "x - extracting Rnmail.SH (Text)"
sed 's/^X//' << 'SHAR_EOF' > Rnmail.SH &&
Xcase $CONFIG in
X    '') . ./config.sh ;;
Xesac
Xecho "Extracting Rnmail (with variable substitutions)"
X$spitshell >Rnmail <<!GROK!THIS!
X$startsh
X# $Header: Rnmail.SH,v 4.3.3.1 90/07/24 22:02:49 davison Trn $
X# 
X# $Log:	Rnmail.SH,v $
X# Revision 4.3.3.1  90/07/24  22:02:49  davison
X# Initial Trn Release
X# 
X# Revision 4.3.2.1  89/11/06  00:30:54  sob
X# Added RRN support from NNTP 1.5
X# 
X# Revision 4.3.1.4  85/08/01  14:23:05  lwall
X# Added MAILRECORD.  Temp file is no longer in /tmp.  'e editor' added.
X# 
X# Revision 4.3.1.3  85/05/20  16:25:17  lwall
X# Shouldn't ask editor if EDITOR or VISUAL defined.
X# 
X# Revision 4.3.1.2  85/05/17  10:36:19  lwall
X# Added "-- " before .signature.
X# 
X# Revision 4.3.1.1  85/05/10  11:30:38  lwall
X# Branch for patches.
X# 
X# Revision 4.3  85/05/01  11:34:18  lwall
X# Baseline for release with 4.3bsd.
X# 
X#
X# syntax: Rnmail -h headerfile [oldart]		or
X#         Rnmail destination-list 		or just
X#         Rnmail
X
Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
X
X# System dependencies
X
Xmailer="${mailer-/bin/mail}"
X# if you change this to something that does signatures, take out signature code
X
X# your site name
Xcase $portable in
Xdefine)
X	sitename=\`$hostcmd\`
X	case \$sitename in
X		*.*)
X			;;
X		*)
X			sitename=\${sitename}.$domain
X			;;
X	esac
X	;;
Xundef) sitename="$sitename" ;;
Xesac
X# your organization name
Xorgname="$orgname"
X# what pager you use--if you have kernal paging use cat
Xpager="\${PAGER-$pager}"
X# how you derive full names, bsd, usg, or other
Xnametype="$nametype"
X# default editor
Xdefeditor="$defeditor"
X# how not to do a newline with echo
Xn="$n"
Xc="$c"
X
Xtest=${test-test}
Xsed=${sed-sed}
Xecho=${echo-echo}
Xcat=${cat-cat}
Xgrep=${grep-grep}
Xrm=${rm-rm}
X
X!GROK!THIS!
X$spitshell >>Rnmail <<'!NO!SUBS!'
Xdotdir=${DOTDIR-${HOME-$LOGDIR}}
Xtmpart=$dotdir/.letter
X
Xheaderfile=""
Xcase $# in
X0) ;;
X*)  case $1 in
X    -h)
X	headerfile="$2"
X	case $# in
X	3) oldart=$3 ;;
X	esac
X	;;
X    esac
X    ;;
Xesac
X
Xcase $headerfile in
X'')
X    case $# in
X    0)
X	to=h
X	while $test "$to" = h ; do
X	    $echo ""
X	    $echo $n "To: $c"
X	    read to
X	    case $to in
X	    h)
X		$cat <<'EOH'
X
XType the net address of those people that you wish the message sent to.
XAdditional recipients may be added on the Cc: line when you edit.
X
XSeparate multiple addresses with spaces.
X
XEOH
X		;;
X	    esac
X	done
X	;;
X    *)
X	to="$*"
X	;;
X    esac
X    to=`$echo "$to" | $sed 's/  */ /g'`
X
X    title=h
X    while $test "$title" = h ; do
X	$echo ""
X	$echo $n "Title/Subject: $c"
X	read title
X	case $title in
X	h)
X	    $cat <<'EOH'
X
XType the title for your message.  
XEOH
X	    ;;
X	esac
X    done
X
X# now build a file with a header for them to edit
X    
X    orgname=${ORGANIZATION-$orgname}
X    case $orgname in
X    /*) orgname=`$cat $orgname` ;;
X    esac
X
X    $sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
XTo: $to
XSubject: $title
XOrganization: $orgname
XReply-To: $REPLYTO
XCc:
XBcc:
X
XEOHeader
X
X    ;;
X*)
X    $cat < $headerfile  > $tmpart
X    ;;
Xesac
X
X
Xfile=h
Xwhile $test "$file" = h ; do
X    $echo ""
X    $echo $n "Prepared file to include [none]: $c"
X    read file
X    case $file in
X    h)
X	$cat <<'EOH'
X
XIf you have already produced the body of your message, type the filename
Xfor it here.  If you just want to proceed directly to the editor, type a
XRETURN.  In any event, you will be allowed to edit as many times as you
Xwant before you send off the message.
XEOH
X	;;
X    '')
X	$echo "" >> $tmpart
X	state=edit
X	;;
X    *)
X	$cat $file >>$tmpart
X	state=ask
X	;;
X    esac
Xdone
X
X$echo ""
X
Xwhile true ; do
X    case $state in
X    edit)
X	rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.letter ; $echo Message appended to ${HOME-$LOGDIR}/dead.letter ; exit"
X	trap "$rescue" 1
X	trap : 2
X	case "${VISUAL-${EDITOR-}}" in
X	'')
X	    tmp=h
X	    ;;
X	*)
X	    tmp=''
X	    ;;
X	esac
X	while $test "$tmp" = h ; do
X	    $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"
X	    read tmp
X	    case $tmp in
X	    h)
X		$cat <<'EOH'
X
XType a return to get the default editor, or type the name of the editor you
Xprefer.  The default editor depends on the VISUAL and EDITOR environment
Xvariables.
X
XEOH
X		;;
X	    '')
X		;;
X	    *)
X		VISUAL=$tmp
X		export VISUAL
X		;;
X	    esac
X	done
X	${VISUAL-${EDITOR-$defeditor}} $tmpart $oldart
X	trap "$rescue" 2
X	state=ask
X	;;
X	
X    ask)
X	$echo ""
X	$echo $n "Send, abort, edit, or list? $c"
X	read ans
X	
X	case $ans in
X	a*)
X	    state=rescue
X	    ;;
X	e*)
X	    set $ans
X	    case $# in
X	    2)  VISUAL="$2" ;;
X	    esac
X	    state=edit
X	    ;;
X	l*)
X	    $pager $tmpart
X	    state=ask
X	    ;;
X	s*)
X	    state=send
X	    ;;
X	h*)
X	    $cat <<'EOH'
X
XType s to send the message, a to abort and append the message to dead.letter,
Xe to edit the message again, or l to list the message.
X
XTo invoke an alternate editor, type 'e editor'.
XEOH
X	esac
X	;;
X    
X    send)
X	if $test -f $dotdir/.signature; then
X	    echo $n "Append .signature file? [y] $c"
X	    read ans
X	    case $ans in
X	    ''|y*)
X		echo "-- " >> $tmpart
X		cat $dotdir/.signature >> $tmpart
X		;;
X	    esac
X	fi
X	case $mailer in
X	*sendmail)
X	    $mailer -t <$tmpart
X	    ;;
X# but recmail does not know about Bcc, alas
X	*recmail)
X	    $mailer <$tmpart
X	    ;;
X	*)
X	    set X `$sed <$tmpart -n -e '/^To:/{' -e 's/To: *//p' -e q -e '}'`
X	    shift
X	    set X "$@" `$sed <$tmpart -n -e '/^Cc:/{' -e 's/Cc: *//p' -e q -e '}'`
X	    shift
X	    set X "$@" `$sed <$tmpart -n -e '/^Bcc:/{' -e 's/Bcc: *//p' -e q -e '}'`
X	    shift
X	    $grep -v "^Bcc:"  <$tmpart | $mailer "$@"
X	    ;;
X	esac
X	case $? in
X	0)
X	    state=cleanup
X	    ;;
X	*)
X	    state=rescue
X	    ;;
X	esac
X	;;
X    rescue)
X	$cat $tmpart >> ${HOME-$LOGDIR}/dead.letter
X	$echo "Message appended to ${HOME-$LOGDIR}/dead.letter"
X	$echo "A copy may be temporarily found in $tmpart"
X	exit
X	;;
X    cleanup)
X	case "${MAILRECORD-none}" in
X	none)
X	    ;;
X	*)
X	    (
X		set X ${USER-${LOGNAME-`who am i`}} unknown
X		shift
X		$echo "From $1 `date`"
X		$cat $tmpart
X		$echo ""
X		$echo ""
X	    ) >> $MAILRECORD
X	    if $test $? -eq 0 ; then
X		$echo "Message appended to $MAILRECORD"
X	    else
X		$echo "Cannot append to $MAILRECORD"
X	    fi
X	    ;;
X	esac
X	exit
X	;;
X    esac
Xdone
X!NO!SUBS!
X$eunicefix Rnmail
Xchmod 755 Rnmail
SHAR_EOF
chmod 0770 Rnmail.SH || echo "restore of Rnmail.SH fails"
echo "x - extracting addng.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > addng.c &&
X/* $Header: addng.c,v 4.3.3.1 90/06/20 22:35:43 davison Trn $
X *
X * $Log:	addng.c,v $
X * Revision 4.3.3.1  90/06/20  22:35:43  davison
X * Initial Trn Release
X * 
X * Revision 4.3.2.4  90/03/17  17:11:36  sob
X * Added support for CNEWS active file flags.
X * 
X * Revision 4.3.2.4  89/12/20  00:30:00  tale
X * Added support for C News active file flags.
X *
X * Revision 4.3.2.3  89/11/08  02:33:28  sob
X * Added include for server.h
X * 
X * Revision 4.3.2.2  89/11/08  01:23:49  sob
X * Added GROUP check when SERVER defined.
X * 
X * Revision 4.3.2.1  89/11/06  00:34:11  sob
X * Added RRN support from NNTP 1.5
X * 
X * Revision 4.3.1.2  85/05/29  09:06:24  lwall
X * New newsgroups without spool directories incorrectly classified as "ancient".
X * 
X * Revision 4.3.1.1  85/05/10  11:30:50  lwall
X * Branch for patches.
X * 
X * Revision 4.3  85/05/01  11:34:41  lwall
X * Baseline for release with 4.3bsd.
X * 
X */
X
X#include "EXTERN.h"
X#include "common.h"
X#include "rn.h"
X#include "ngdata.h"
X#include "last.h"
X#include "util.h"
X#include "intrp.h"
X#include "only.h"
X#include "rcstuff.h"
X#ifdef SERVER
X#include "server.h"
X#endif
X#include "INTERN.h"
X#include "addng.h"
X
Xvoid
Xaddng_init()
X{
X    ;
X}
X
X#ifdef FINDNEWNG
X/* generate a list of new newsgroups from active file */
X
Xbool
Xnewlist(munged,checkinlist)
Xbool munged;				/* are we scanning the whole file? */
Xbool checkinlist;
X{
X    char *tmpname;
X    register char *s, *status;
X    long birthof();
X
X    tmpname = savestr(filexp("/tmp/rnew.%$"));
X    tmpfp = fopen(tmpname,"w");
X    if (tmpfp == Nullfp) {
X	printf(cantcreate,tmpname) FLUSH;
X	return FALSE;
X    }
X    while (fgets(buf,LBUFLEN,actfp) != Nullch) {
X	if (s = index(buf,' ')) {
X	    status=s;
X	    while (isdigit(*status) || isspace(*status)) status++;
X	    *s++ = '\0';
X	    if (strnEQ(buf,"to.",3) || *status == 'x' || *status == '=')
X	        /* since = groups are refiling to another group, just
X		   ignore their existence */
X		continue;
X	    if (find_ng(buf) == nextrcline &&
X		    (checkinlist ?
X			(inlist(buf)) :
X			(birthof(buf,(ART_NUM)atol(s)) > lasttime)
X		    )
X		) {
X					/* if not in .newsrc and younger */
X					/* than the last time we checked */
X		fprintf(tmpfp,"%s\n",buf);
X					/* then remember said newsgroup */
X	    }
X#ifdef FASTNEW
X	    else {			/* not really a new group */
X		if (!munged) {		/* did we assume not munged? */
X		    fclose(tmpfp);	/* then go back, knowing that */
X		    UNLINK(tmpname);
X		    free(tmpname);
X		    return TRUE;	/* active file was indeed munged */
X		}
X	    }
X#endif
X	}
X#ifdef DEBUGGING
X	else
X	    printf("Bad active record: %s\n",buf) FLUSH;
X#endif
X    }
X
X    /* we have successfully generated the list */
X
X    fclose(tmpfp);
X    tmpfp = fopen(tmpname,"r");
X    UNLINK(tmpname);			/* be nice to the world */
X    if (tmpfp == Nullfp) {
X	printf(cantopen,tmpname) FLUSH;
X	return FALSE;
X    }
X    while (fgets(buf,LBUFLEN,tmpfp) != Nullch) {
X	buf[strlen(buf)-1] = '\0';
X	get_ng(buf,TRUE);		/* add newsgroup, maybe */
X    }
X    fclose(tmpfp);			/* be nice to ourselves */
X    free(tmpname);
X    return FALSE;			/* do not call us again */
X}
X
X/* return creation time of newsgroup */
X
Xlong
Xbirthof(ngnam,ngsize)
Xchar *ngnam;
XART_NUM ngsize;
X{
X    char tst[128];
X    long time();
X 
X#ifdef SERVER
X    int x,tot,min,max;
X    if (ngsize < 2) {
X          sprintf(tst,"GROUP %s",ngnam);
X          put_server(tst);
X          (void) get_server(tst, sizeof(tst));
X          if (*tst != CHAR_OK) return(0); /* not a real group */
X          (void) sscanf(tst,"%d%d%d%d",&x,&tot,&min,&max);
X          if (tot == 1 && min == 1 && max == 1) return(time(Null(long *)));
X     } else return(0);
X#else /* not SERVER */
X
X    sprintf(tst, ngsize ? "%s/%s/1" : "%s/%s" ,spool,getngdir(ngnam));
X    if (stat(tst,&filestat) < 0)
X	return (ngsize ? 0L : time(Null(long *)));
X	/* not there, assume something good */
X    else
X	return filestat.st_mtime;
X
X#endif
X}
X
Xbool
Xscanactive()
X{
X    NG_NUM oldnext = nextrcline;	/* remember # lines in newsrc */
X
X    fseek(actfp,0L,0);
X    newlist(TRUE,TRUE);
X    if (nextrcline != oldnext) {	/* did we add any new groups? */
X	return TRUE;
X    }
X    return FALSE;
X}
X
X#endif
X
SHAR_EOF
chmod 0660 addng.c || echo "restore of addng.c fails"
echo "x - extracting addng.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > addng.h &&
X/* $Header: addng.h,v 4.3 85/05/01 11:34:48 lwall Exp $
X *
X * $Log:	addng.h,v $
X * Revision 4.3  85/05/01  11:34:48  lwall
X * Baseline for release with 4.3bsd.
X * 
X */
X
Xvoid	addng_init();
X#ifdef FINDNEWNG
X    bool	newlist();
X    long	birthof();
X    bool	scanactive();
X#endif
SHAR_EOF
chmod 0660 addng.h || echo "restore of addng.h fails"
echo "x - extracting art.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > art.c &&
X/* $Header: art.c,v 4.3.3.1 90/06/20 22:35:51 davison Trn $
X *
X * $Log:	art.c,v $
X * Revision 4.3.3.1  90/06/20  22:35:51  davison
X * Initial Trn Release
X * 
X * Revision 4.3.2.3  90/04/21  14:43:27  sob
X * Revised previous patch insure that it does not decrement below zero.
X * 
X * Revision 4.3.2.2  90/03/22  23:03:25  sob
X * Fixes provided by Wayne Davison <drivax!davison>
X * 
X * Revision 4.3.2.1  89/11/07  23:20:57  sob
X * Bug fixes for NNTP
X * 
X * Revision 4.3.1.5  85/09/10  11:07:18  lwall
X * %m not restored on some returns.
X * 
X * Revision 4.3.1.4  85/05/23  12:13:31  lwall
X * shouldn't display article that's really a subdirectory.
X * 
X * Revision 4.3.1.3  85/05/13  09:29:55  lwall
X * Added CUSTOMLINES option.
X * 
X * Revision 4.3.1.2  85/05/10  13:46:07  lwall
X * Fixed header reparse bug on backpage.
X * 
X * Revision 4.3.1.1  85/05/10  11:30:56  lwall
X * Branch for patches.
X * 
X * Revision 4.3  85/05/01  11:34:51  lwall
X * Baseline for release with 4.3bsd.
X * 
X */
X
X#include "EXTERN.h"
X#include "common.h"
X#include "rn.h"
X#include "ngstuff.h"
X#include "ngdata.h"
X#include "head.h"
X#include "cheat.h"
X#include "help.h"
X#include "search.h"
X#include "artio.h"
X#include "ng.h"
X#include "bits.h"
X#include "final.h"
X#include "artstate.h"
X#include "rcstuff.h"
X#include "term.h"
X#include "sw.h"
X#include "util.h"
X#include "backpage.h"
X#include "intrp.h"
X#ifdef USETHREADS
X#include "rthreads.h"
X#endif
X#include "INTERN.h"
X#include "art.h"
X
X/* page_switch() return values */
X
X#define PS_NORM 0
X#define PS_ASK 1
X#define PS_RAISE 2
X#define PS_TOEND 3
X
Xbool special = FALSE;		/* is next page special length? */
Xint slines = 0;			/* how long to make page when special */
XART_LINE highlight = -1;	/* next line to be highlighted */
Xchar *restart = Nullch;		/* if nonzero, the place where last */
X				/* line left off on line split */
Xchar *blinebeg;			/* where in buffer current line began */
XART_POS alinebeg;		/* where in file current line began */
X
X#ifdef INNERSEARCH
XART_POS innersearch = 0;	/* artpos of end of line we found */
X				/* for 'g' command */
XART_LINE isrchline = 0;			/* last line to display */
Xbool hide_everything = FALSE;
X				/* if set, do not write page now, */
X				/* but refresh when done with page */
XCOMPEX gcompex;				/* in article search pattern */
X#endif
X
Xbool firstpage;			/* is this the 1st page of article? */
X
Xchar art_buf[LBUFLEN];		/* place for article lines */
X
Xvoid
Xart_init()
X{
X    ;
X}
X
Xint
Xdo_article()
X{
X    register char *s;
X    ART_POS artsize;			/* size in bytes of article */
X    bool hide_this_line = FALSE;	/* hidden header line? */
X    ART_LINE linenum;	/* line # on page, 1 origin */
X#ifdef ULSMARTS
X    bool under_lining = FALSE;
X			    /* are we underlining a word? */
X#endif
X    register char *bufptr = art_buf;
X			    /* pointer to input buffer */
X    register int outpos;	/* column position of output */
X    static char prompt_buf[64];		/* place to hold prompt */
X    bool notesfiles = FALSE;		/* might there be notesfiles junk? */
X    char oldmode = mode;
X
X#ifdef INNERSEARCH
X    register int outputok;
X#endif
X
X    if (fstat(artfp->_file,&filestat))
X			    /* get article file stats */
X	return DA_CLEAN;
X    if ((filestat.st_mode & S_IFMT) != S_IFREG)
X	return DA_NORM;
X    artsize = filestat.st_size;
X			    /* from that get article size */
X    sprintf(prompt_buf,
X	"%%sEnd of article %ld (of %ld)--what next? [%%s]",
X	(long)art,(long)lastart);	/* format prompt string */
X    prompt = prompt_buf;
X    int_count = 0;		/* interrupt count is 0 */
X    firstpage = (topline < 0);
X    for (;;) {			/* for each page */
X#ifdef USETHREADS
X	if (max_tree_lines)
X	    init_tree();	/* init tree display */
X#endif
X	assert(art == openart);
X	if (do_fseek) {
X#ifdef ASYNC_PARSE
X	    parse_maybe(art);		/* make sure header is ours */
X#endif
X	    artpos = vrdary(artline);
X	    if (artpos < 0)
X		artpos = -artpos;	/* labs(), anyone? */
X	    if (firstpage)
X		artpos = (ART_POS)0;
X	    fseek(artfp,artpos,0);
X	    if (artpos < htype[PAST_HEADER].ht_minpos)
X		in_header = SOME_LINE;
X	    do_fseek = FALSE;
X	    restart = Nullch;
X	}
X	linenum = 1;
X	if (firstpage) {
X	    if (firstline) {
X		interp(art_buf, (sizeof art_buf), firstline);
X#ifdef USETHREADS
X		linenum += tree_puts(art_buf,linenum+topline,0);
X#else
X#ifdef CLEAREOL
X		maybe_eol();	
X#endif /* CLEAREOL */
X		fputs(art_buf,stdout) FLUSH;
X		linenum++;
X#endif
X		artopen(art);		/* rewind article in case interp */
X					/* forced a header parse */
X	    }
X	    else {
X		ART_NUM i;
X
X#ifdef USETHREADS
X		if (ThreadedGroup) {
X		    int sel, unseen;
X
X		    sel = curr_p_art && (selected_roots[curr_p_art->root] & 1);
X		    unseen = !was_read(art);
X		    sprintf(art_buf,"%s%s #%ld",ngname,moderated,(long)art);
X		    if (selected_root_cnt) {
X			i = selected_count - (unseen && sel);
X			sprintf(art_buf+strlen(art_buf)," (%ld + %ld more)",
X			    (long)i,(long)toread[ng] - selected_count
X					- unthreaded - (!sel && unseen));
X		    }
X		    else if ((i = (ART_NUM)(toread[ng]-unthreaded-unseen)) != 0)
X			sprintf(art_buf+strlen(art_buf)," (%ld more)",(long)i);
X		    linenum += tree_puts(art_buf,linenum+topline,0);
X		}
X		else
X#endif
X		{
X#ifdef CLEAREOL
X		    maybe_eol();	
X#endif /* CLEAREOL */
X		    printf("Article %ld",(long)art);
X		    i = (ART_NUM)(toread[ng] - 1 + was_read(art));
X#ifdef DELAYMARK
X		    if (i || dmcount) {
X			printf(" (%ld more",(long)i);
X			if (dmcount)
X			    printf(" + %ld Marked to return)",(long)dmcount);
X			putchar(')');
X		    }
X#else
X		    if (i)
X			printf(" (%ld more)",(long)i);
X#endif
X		    if (htype[NGS_LINE].ht_flags & HT_HIDE)
X			printf(" in %s", ngname);
X		    fputs(moderated,stdout);
X		    fputs(":\n",stdout) FLUSH;
X		    linenum++;
X		}
X	    }
X	    start_header(art);
X	    forcelast = FALSE;		/* we will have our day in court */
X	    restart = Nullch;
X	    artline = 0;		/* start counting lines */
X	    artpos = 0;
X	    vwtary(artline,artpos);	/* remember pos in file */
X	}
X	for (;				/* linenum already set */
X	  in_header || (
X#ifdef INNERSEARCH
X	  innersearch ? innermore() :
X#endif
X	  linenum<(firstpage?initlines:(special?slines:LINES)) );
X	  linenum++) {		/* for each line on page */
X	    if (int_count) {	/* exit via interrupt? */
X		putchar('\n') FLUSH;	/* get to left margin */
X		int_count = 0;	/* reset interrupt count */
X		mode = oldmode;
X		special = FALSE;
X		return DA_NORM;	/* skip out of loops */
X	    }
X	    if (restart) {		/* did not finish last line? */
X		bufptr = restart;	/* then start again here */
X		restart = Nullch;	/* and reset the flag */
X	    }
X	    else {			/* not a restart */
X		if (fgets(art_buf,LBUFLEN,artfp)==Nullch) {
X					/* if all done */
X		    mode = oldmode;
X		    special = FALSE;
X		    return DA_NORM;	/* skip out of loops */
X		}
X		bufptr = art_buf;	/* so start at beginning */
X		art_buf[LBUFLEN-1] = '\0';
X					/* make sure string ends */
X	    }
X	    blinebeg = bufptr;	/* remember where we began */
X	    alinebeg = artpos;	/* both in buffer and file */
X	    if (in_header && bufptr == art_buf) {
X		hide_this_line =
X		    parseline(art_buf,do_hiding,hide_this_line);
X#ifdef USETHREADS
X		if (!in_header) {
X		    linenum += finish_tree(linenum+topline);
X		}
X#endif
X	    } else if (notesfiles && do_hiding &&
X	      bufptr == art_buf && *art_buf == '#' &&
X	      isupper(art_buf[1]) && art_buf[2] == ':' ) {
X		fgets(art_buf,sizeof(art_buf),artfp);
X		if (index(art_buf,'!') != Nullch)
X		    fgets(art_buf,sizeof(art_buf),artfp);
X		htype[PAST_HEADER].ht_minpos = ftell(artfp);
X					/* exclude notesfiles droppings */
X		hide_this_line = TRUE;	/* and do not print either */
X		notesfiles = FALSE;
X	    }
X#ifdef CUSTOMLINES
X	    if (hideline && bufptr == art_buf &&
X		  execute(&hide_compex,art_buf) )
X		hide_this_line = TRUE;
X#endif
X	    if (in_header && htype[in_header].ht_flags & HT_MAGIC) {
X		if (in_header == NGS_LINE) {
X		    hide_this_line = (index(art_buf,',') == Nullch);
X		}
X		else if (in_header == EXPIR_LINE) {
X		    if (!(htype[EXPIR_LINE].ht_flags & HT_HIDE))
X		    hide_this_line = (strlen(art_buf) < 10);
X		}
X		else if (in_header == FROM_LINE) {
X		    if (do_hiding && (s = index(art_buf+6,'(')) != Nullch) {
X			strcpy(art_buf+6,s+1);
X			if((s = rindex(art_buf+6,')')) != Nullch)
X			    *s = '\0';
X		    }
X		}
X#ifdef USETHREADS
X		else if (in_header == DATE_LINE && curr_p_art && do_hiding) {
X		    strcpy(art_buf+6,ctime(&curr_p_art->date));
X		}
X#endif
X	    }
X	    if (in_header == SUBJ_LINE &&
X		htype[SUBJ_LINE].ht_flags & HT_MAGIC) {
X			    /* is this the subject? */
X		int length;
X
X		length = strlen(art_buf)-1;
X		artline++;
X		art_buf[length] = '\0';		/* wipe out newline */
X#ifdef NOFIREWORKS
X		no_ulfire();
X#endif
X		notesfiles =
X		    (instr(&art_buf[length-10]," - (nf") != Nullch);
X#ifdef USETHREADS
X		/* tree_puts(, ,1) underlines subject */
X		linenum += tree_puts(art_buf,linenum+topline,1)-1;
X#else
X		if (oldsubject) {
X		    length += 7;
X		    fputs("(SAME) ",stdout);
X		    oldsubject = FALSE;
X		}
X		if (length+UG > COLS) {		/* rarely true */
X		    linenum++;
X		    vwtary(artline,vrdary(artline-1)+COLS);
X		    artline++;
X		}
X		s = art_buf + 8;
X		*s++ = '\0';	/* make into 2 strings */
X#ifdef CLEAREOL
X		maybe_eol();	
X#endif /* CLEAREOL */
X		fputs(art_buf,stdout) FLUSH;
X				/* print up through : */
X		if (!UG)
X		    putchar(' ');
X		underprint(s);	/* print subject underlined */
X		putchar('\n') FLUSH;	/* and finish the line */
X#endif
X	    }
X	    else if (hide_this_line && do_hiding) {
X					/* do not print line? */
X		linenum--;		/* compensate for linenum++ */
X		if (!in_header)
X		    hide_this_line = FALSE;
X	    }
X#ifdef USETHREADS
X	    else if (in_header) {
X		artline++;
X		linenum += tree_puts(art_buf,linenum+topline,0)-1;
X	    }
X#endif
X	    else {			/* just a normal line */
X		if (highlight==artline) {	/* this line to be highlit? */
X		    if (marking == STANDOUT) {
X#ifdef NOFIREWORKS
X			if (erase_screen)
X			    no_sofire();
X#endif
X			standout();
X		    }
X		    else {
X#ifdef NOFIREWORKS
X			if (erase_screen)
X			    no_ulfire();
X#endif
X			underline();
X		    }
X		    if (*bufptr == '\n')
X			putchar(' ');
X		}
X#ifdef INNERSEARCH
X		outputok = !hide_everything;
X					/* get it into register, hopefully */
X#endif
X#ifdef CLEAREOL
X#ifdef INNERSEARCH
X		if (outputok)
X#endif
X		maybe_eol();	
X#endif /* CLEAREOL */
X#ifdef CUSTOMLINES
X		if (pagestop && bufptr == art_buf && 
X		  execute(&page_compex,art_buf) )
X		    linenum = 32700;
X#endif
X		for (outpos = 0; outpos < COLS; ) {
X				    /* while line has room */
X		    if (*bufptr >= ' ') {	/* normal char? */
X#ifdef ULSMARTS
X			if (*bufptr == '_') {
X			    if (bufptr[1] == '\b') {
X				if (!under_lining && highlight!=artline
X#ifdef INNERSEARCH
X				    && outputok
X#endif
X				    ) {
X				    under_lining++;
X				    if (UG) {
X					if (bufptr != buf &&
X					  bufptr[-1] == ' ') {
X					    outpos--;
X					    backspace();
X					}
X				    }
X				    underline();
X				}
X				bufptr += 2;
X			    }
X			}
X			else {
X			    if (under_lining) {
X				under_lining = 0;
X				un_underline();
X				if (UG) {
X				    if (*bufptr == ' ')
X					goto skip_put;
X				    outpos++;
X				}
X			    }
X			}
X#endif
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			{
X#ifdef ROTATION
X			    if (rotate && !in_header
X			      && isalpha(*bufptr)) {
X				if ((*bufptr & 31) <= 13)
X				    putchar(*bufptr+13);
X				else
X				    putchar(*bufptr-13);
X			    }
X			    else
X#endif
X				putchar(*bufptr);
X			}
X			if (*UC && ((highlight==artline && marking == 1)
X#ifdef ULSMARTS
X			    || under_lining
X#endif
X			    )) {
X			    backspace();
X			    underchar();
X			}
X		    skip_put:
X			bufptr++;
X			outpos++;
X		    }
X		    else if (*bufptr == '\n' || !*bufptr) {
X						    /* newline? */
X#ifdef ULSMARTS
X			if (under_lining) {
X			    under_lining = 0;
X			    un_underline();
X			}
X#endif
X#ifdef DEBUGGING
X			if (debug & DEB_INNERSRCH && outpos < COLS - 6) {
X			    standout();
X			    printf("%4d",artline); 
X			    un_standout();
X			}
X#endif
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			    putchar('\n') FLUSH;
X			restart = 0;
X			outpos = 1000;	/* signal normal \n */
X		    }
X		    else if (*bufptr == '\t') {	/* tab? */
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			    putchar(*bufptr);
X			bufptr++;
X			outpos += 8 - outpos % 8;
X		    }
X		    else if (*bufptr == '\f') {	/* form feed? */
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			    fputs("^L",stdout);
X			if (bufptr == blinebeg && highlight != artline)
X			    linenum = 32700;
X			    /* how is that for a magic number? */
X			bufptr++;
X			outpos += 2;
X		    }
X		    else {		/* other control char */
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			{
X			    putchar('^');
X			    if (highlight == artline && *UC && marking == 1) {
X				backspace();
X				underchar();
X				putchar(*bufptr+64);
X				backspace();
X				underchar();
X			    }
X			    else
X				putchar(*bufptr+64);
X			}
X			bufptr++;
X			outpos += 2;
X		    }
X		    
X		} /* end of column loop */
X
X		if (outpos < 1000) {/* did line overflow? */
X		    restart = bufptr;
X				    /* restart here next time */
X		    if (AM) {	/* automatic margins on tty? */
X			if (!XN && *bufptr == '\n')
X				    /* need we simulate XN? */
X			    restart = 0;
X				    /* skip the newline */
X		    }
X		    else {		/* cursor just hangs there */
X#ifdef INNERSEARCH
X			if (outputok)
X#endif
X			    putchar('\n') FLUSH;
X				    /* so move it down ourselves */
X			if (*bufptr == '\n')
X			    restart = 0;
X				    /* simulate XN if need be */
X		    }
X#ifdef CLEAREOL
X/* #ifdef INNERSEARCH
X		    if (outputok)
X#endif
X		    maybe_eol(); */	/* comment this out for now
X						    until I am sure it is
X						    needed*/
X
X#endif /* CLEAREOL */
X		}
X
X		/* handle normal end of output line formalities */
X
X		if (highlight == artline) {
X					/* were we highlighting line? */
X		    if (marking == STANDOUT)
X			un_standout();
X		    else
X			un_underline();
X		    highlight = -1;	/* no more we are */
X		}
X		artline++;	/* count the line just printed */
X		if (artline - LINES + 1 > topline)
X			    /* did we just scroll top line off? */
X		    topline = artline - LINES + 1;
X			    /* then recompute top line # */
X	    }
X
X	    /* determine actual position in file */
X
X	    if (restart)	/* stranded somewhere in the buffer? */
X		artpos += restart - blinebeg;
X			    /* just calculate position */
X	    else		/* no, ftell will do */
X		artpos = ftell(artfp);
X			    /* so do ftell */
X	    vwtary(artline,artpos);	/* remember pos in file */
X	} /* end of line loop */
X
X#ifdef INNERSEARCH
X	innersearch = 0;
X	if (hide_everything) {
X	    hide_everything = FALSE;
X	    *buf = Ctl('l');
X	    goto fake_command;
X	}
X#endif
X	if (linenum >= 32700)/* did last line have formfeed? */
X	    vwtary(artline-1,-vrdary(artline-1));
X			    /* remember by negating pos in file */
X
X	special = FALSE;	/* end of page, so reset page length */
X	firstpage = FALSE;	/* and say it is not 1st time thru */
X
X	/* extra loop bombout */
X
X	if (artpos == artsize) {/* did we just now reach EOF? */
X	    mode = oldmode;
X	    return DA_NORM;	/* avoid --MORE--(100%) */
X	}
X
X/* not done with this article, so pretend we are a pager */
X
Xreask_pager:		    
X	unflush_output();	/* disable any ^O in effect */
X	standout();		/* enter standout mode */
X	printf("--MORE--(%ld%%)",(long)(artpos*100/artsize));
X	un_standout();	/* leave standout mode */
X	fflush(stdout);
X/* reinp_pager:     			/* unused, commented for lint */
X	eat_typeahead();
X#ifdef DEBUGGING
X	if (debug & DEB_CHECKPOINTING) {
X	    printf("(%d %d %d)",checkcount,linenum,artline);
X	    fflush(stdout);
X	}
X#endif
X	if (checkcount >= docheckwhen &&
X	  linenum == LINES &&
X	  (artline > 40 || checkcount >= docheckwhen+10) ) {
X			    /* while he is reading a whole page */
X			    /* in an article he is interested in */
X	    checkcount = 0;
X	    checkpoint_rc();	/* update .newsrc */
X	}
X	collect_subjects();		/* loads subject cache until */
X					/* input is pending */
X	mode = 'p';
X	getcmd(buf);
X	if (errno) {
X	    if (LINES < 100 && !int_count)
X		*buf = '\f';/* on CONT fake up refresh */
X	    else {
X		*buf = 'q';	/* on INTR or paper just quit */
X	    }
X	}
X	carriage_return();
X#ifndef CLEAREOL
X	erase_eol();	/* and erase the prompt */
X#else
X	if (erase_screen && can_home_clear)	
X	    clear_rest();
X	else
X	    erase_eol();	/* and erase the prompt */
X#endif /* CLEAREOL */
X	carriage_return();	/* Resets kernel's tab column counter to 0 */
X	fflush(stdout);
X
X    fake_command:		/* used by innersearch */
X
X	/* parse and process pager command */
X
X	switch (page_switch()) {
X	case PS_ASK:	/* reprompt "--MORE--..." */
X	    goto reask_pager;
X	case PS_RAISE:	/* reparse on article level */
X	    mode = oldmode;
X	    return DA_RAISE;
X	case PS_TOEND:	/* fast pager loop exit */
X	    mode = oldmode;
X	    return DA_TOEND;
X	case PS_NORM:	/* display more article */
X	    break;
X	}
X    } /* end of page loop */
X}
X
X/* process pager commands */
X
Xint
Xpage_switch()
X{
X    register char *s;
X    
X    switch (*buf) {
X    case 'd':
X    case Ctl('d'):	/* half page */
X	special = TRUE;
X	slines = LINES / 2 + 1;
X	if (marking && *blinebeg != '\f'
X#ifdef CUSTOMLINES
X	  && (!pagestop || blinebeg != art_buf ||
X	      !execute(&page_compex,blinebeg))
X#endif
X	  ) {
X	    up_line();
X	    highlight = --artline;
X	    restart = blinebeg;
X	    artpos = alinebeg;
X	}
X	return PS_NORM;
X    case '!':			/* shell escape */
X	escapade();
X	return PS_ASK;
X#ifdef INNERSEARCH
X    case Ctl('i'):
X	gline = 3;
X	sprintf(cmd_buf,"^[^%c]",*blinebeg);
X	compile(&gcompex,cmd_buf,TRUE,TRUE);
X	goto caseG;
X    case Ctl('g'):
X	gline = 3;
X	compile(&gcompex,"^Subject:",TRUE,TRUE);
X	goto caseG;
X    case 'g':		/* in-article search */
X	if (!finish_command(FALSE))/* get rest of command */
X	    return PS_ASK;
X	s = buf+1;
X	if (isspace(*s))
X	    s++;
X	if ((s = compile(&gcompex,s,TRUE,TRUE)) != Nullch) {
X			    /* compile regular expression */
X	    printf("\n%s\n",s) FLUSH;
X	    return PS_ASK;
X	}
X	carriage_return();
X	erase_eol();	/* erase the prompt */
X	carriage_return();	/* Resets kernel's tab column counter to 0 */
X	/* FALL THROUGH */
X    caseG:
X    case 'G': {
X	/* ART_LINE lines_to_skip = 0; */
X	ART_POS start_where;
X
X	if (gline < 0 || gline > LINES-2)
X	    gline = LINES-2;
X#ifdef DEBUGGING
X	if (debug & DEB_INNERSRCH)
X	    printf("Start here? %d  >=? %d\n",topline + gline + 1,artline)
X	      FLUSH;
X#endif
X	if (*buf == Ctl('i') || topline+gline+1 >= artline)
X	    start_where = artpos;
X			/* in case we had a line wrap */
X	else {
X	    start_where = vrdary(topline+gline+1);
X	    if (start_where < 0)
X		start_where = -start_where;
X	}
X	if (start_where < htype[PAST_HEADER].ht_minpos)
X	    start_where = htype[PAST_HEADER].ht_minpos;
X	fseek(artfp,(long)start_where,0);
X	innersearch = 0; /* assume not found */
X	while (fgets(buf, sizeof buf, artfp) != Nullch) {
X	    /* lines_to_skip++; 		NOT USED NOW */
X#ifdef DEBUGGING
X	    if (debug & DEB_INNERSRCH)
X		printf("Test %s",buf) FLUSH;
X#endif
X	    if (execute(&gcompex,buf) != Nullch) {
X		innersearch = ftell(artfp);
X		break;
X	    }
X	}
X	if (!innersearch) {
X	    fseek(artfp,artpos,0);
X	    fputs("(Not found)",stdout) FLUSH;
X	    return PS_ASK;
X	}
X#ifdef DEBUGGING
X	if (debug & DEB_INNERSRCH)
X	    printf("On page? %ld <=? %ld\n",(long)innersearch,(long)artpos)
X	      FLUSH;
X#endif
X	if (innersearch <= artpos) {	/* already on page? */
X	    if (innersearch < artpos) {
X		artline = topline+1;
X		while (vrdary(artline) < innersearch)
X		    artline++;
X	    }
X	    highlight = artline - 1;
X#ifdef DEBUGGING
X	    if (debug & DEB_INNERSRCH)
X		printf("@ %d\n",highlight) FLUSH;
X#endif
X	    topline = highlight - gline;
X	    if (topline < -1)
X		topline = -1;
X	    *buf = '\f';		/* fake up a refresh */
X	    innersearch = 0;
X	    return page_switch();
X	}
X	else {				/* who knows how many lines it is? */
X	    do_fseek = TRUE;
X	    hide_everything = TRUE;
X	}
X	return PS_NORM;
X    }
X#else
X    case 'g': case 'G': case Ctl('g'):
X	notincl("g");
X	return PS_ASK;
X#endif
X    case '\n':		/* one line */
X	special = TRUE;
X	slines = 2;
X	return PS_NORM;
X#ifdef ROTATION
X    case 'X':
X	rotate = !rotate;
X	/* FALL THROUGH */
X#endif
X    case 'l':
X    case '\f':		/* refresh screen */
X#ifdef DEBUGGING
X	if (debug & DEB_INNERSRCH) {
X	    printf("Topline = %d",topline) FLUSH;
X	    gets(buf);
X	}
X#endif
X	clear();
X	carriage_return();	/* Resets kernel's tab column counter to 0 */
X	do_fseek = TRUE;
X	artline = topline;
X	if (artline < 0)
X	    artline = 0;
X	firstpage = (topline < 0);
X	return PS_NORM;
X    case 'b':
X    case '\b':
X    case Ctl('b'): {	/* back up a page */
X	ART_LINE target;
X
X#ifndef CLEAREOL
X	clear();
X#else
X	if (can_home_clear)	/* if we can home do it */
X	    home_cursor();
X	else
X	    clear();
X
X#endif /* CLEAREOL */
X	carriage_return();	/* Resets kernel's tab column counter to 0 */
X	do_fseek = TRUE;	/* reposition article file */
X	target = topline - (LINES - 2);
X	artline = topline;
X	while (artline >= 0 && artline > target && vrdary(artline-1) >= 0)
X	    artline--;
X	topline = artline;
X			/* remember top line of screen */
X			/*  (line # within article file) */
X	if (artline < 0)
X	    artline = 0;
X	firstpage = (topline < 0);
X	return PS_NORM;
X    }
X    case 'h': {		/* help */
X	int cmd;
X
X	if ((cmd = help_page()) > 0)
X	    pushchar(cmd);
X	return PS_ASK;
X    }
X#ifdef USETHREADS
X    case 't':		/* output thread data */
X	page_line = 1;
X	p_art = curr_p_art;
X	entire_tree();
X	return PS_ASK;
X#endif
X    case '\177':
X    case '\0':		/* treat del,break as 'n' */
X	*buf = 'n';
X	/* FALL THROUGH */
X    case 'k':	case 'K':
X#ifdef USETHREADS
X    case 'T':	case 'J':
X#endif
X    case 'n':	case 'N':	case Ctl('n'):
X    case 's':	case 'S':
X    case 'e':
X    case 'u':
X    case 'w':	case 'W':
X    case '|':
X	mark_as_read();		/* mark article as read */
X	/* FALL THROUGH */
X#ifdef USETHREADS
X    case 'U':	case ',':
X    case '<':	case '>':
X    case '[':	case ']':
X    case '{':	case '}':
X    case '+':   case ':':
X#endif
X    case '#':
X    case '$':
X    case '&':
X    case '-':
X    case '.':
X    case '/':
X    case '1': case '2': case '3': case '4': case '5':
X    case '6': case '7': case '8': case '9':
X    case '=':
X    case '?':
X    case 'c':	case 'C':	
X#ifdef DEBUGGING
X    case 'D':
X#endif
X    case 'E':
X    case 'f':	case 'F':	
X    case 'j':
X				case Ctl('k'):
X    case 'm':	case 'M':	
X    case 'p':	case 'P':	case Ctl('p'):	
X		case 'Q':
X    case 'r':	case 'R':	case Ctl('r'):
X    case 'v':
X		case 'Y':
X#ifndef ROTATION
X    case 'x':	case 'X':
X#endif
X    case Ctl('x'):
X    case '^':
X
X#ifdef ROTATION
X	rotate = FALSE;
X#endif
X	reread = FALSE;
X	do_hiding = TRUE;
X	if (index("nNpP",*buf) == Nullch &&
X	  index("wWsSe:!&|/?123456789.",*buf) != Nullch) {
X	    setdfltcmd();
X	    standout();		/* enter standout mode */
X	    printf(prompt,mailcall,dfltcmd);
X			    /* print prompt, whatever it is */
X	    un_standout();	/* leave standout mode */
X	    putchar(' ');
X	    fflush(stdout);
X	}
X	return PS_RAISE;	/* and pretend we were at end */
X#ifdef ROTATION
X    case 'x':
X	rotate = TRUE;
X	/* FALL THROUGH */
X#endif
X    case 'y':
X    case Ctl('v'):
X					/* Leaving it undocumented in case */
X					/* I want to steal the key--LAW */
X    case ' ':	/* continue current article */
X	if (erase_screen) {	/* -e? */
X#ifndef CLEAREOL
X	    clear();		/* clear screen */
X#else
X	    if (can_home_clear)	/* if we can home do it */
X		home_cursor();
X	    else
X		clear();	/* else clear screen */
X
X#endif /* CLEAREOL */
X	    if (*blinebeg != '\f'
X#ifdef CUSTOMLINES
X	      && (!pagestop || blinebeg != art_buf ||
X	          !execute(&page_compex,blinebeg))
X#endif
X	      ) {
X		restart = blinebeg;
X		artline--;	 /* restart this line */
X		artpos = alinebeg;
X		if (marking)	/* and mark repeated line */
X		    highlight = artline;
X	    }
X	    topline = artline;
X			/* and remember top line of screen */
X			/*  (line # within article file) */
X	}
X	else if (marking && *blinebeg != '\f'
X#ifdef CUSTOMLINES
X	  && (!pagestop || blinebeg != art_buf ||
X	      !execute(&page_compex,blinebeg))
X#endif
X	  ) {
X				/* are we marking repeats? */
X	    up_line();		/* go up one line */
X	    highlight = --artline;/* and get ready to highlight */
X	    restart = blinebeg;	/*   the old line */
X	    artpos = alinebeg;
X	}
X	return PS_NORM;
X    case 'q':	/* quit this article? */
X	do_hiding = TRUE;
X	return PS_TOEND;
X    default:
X	fputs(hforhelp,stdout) FLUSH;
X	settle_down();
X	return PS_ASK;
X    }
X}
X
X#ifdef INNERSEARCH
Xbool
Xinnermore()
X{
X    if (artpos < innersearch) {		/* not even on page yet? */
X#ifdef DEBUGGING
X	if (debug & DEB_INNERSRCH)
X	    printf("Not on page %ld < %ld\n",(long)artpos,(long)innersearch)
SHAR_EOF
echo "End of part 4"
echo "File art.c is continued in part 5"
echo "5" > s2_seq_.tmp
exit 0
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.sources.unix mailing list