home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1465
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
63KB
From: sob@lib.tmc.edu (Stan Barber)
Newsgroups: alt.sources
Subject: rrn/rn combo kit part 8 of 9
Message-ID: <434@lib.tmc.edu>
Date: 14 Jun 90 03:29:24 GMT
#! /bin/sh
# Make a new directory for the rn sources, cd to it, and run kits 1 thru 9
# through sh. When all 9 kits have been run, read README.
echo "This is rn kit 8 (of 9). If kit 8 is complete, the line"
echo '"'"End of kit 8 (of 9)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
echo Extracting MANIFEST
cat >MANIFEST <<'!STUFFY!FUNK!'
After all the rn kits are run you should have the following files:
Filename Kit Description
-------- --- -----------
Configure 2 A shell script that installs everything system dependent.
EXTERN.h 9 When included, makes other includes not belong to me.
HACKERSGUIDE 8 A brief guide to the contorted innards of rn.
INIT 5 Sample system-wide switch file. (NEW)
INTERN.h 9 When included, makes other includes belong to me.
MANIFEST 8 This list of files.
Makefile.SH 8 The makefile.
NEW 8 List of new features with 4.3 rn.
Pnews.1 8 Manual page for Pnews.
Pnews.SH 6 A news posting shell script that knows about -h.
README 8 Installation instructions.
Rnmail.1 8 Manual page for Rnmail.
Rnmail.SH 7 A mailer that knows about -h.
Wishlist 9 What the next version wants in it.
addng.c 1 Routines for scanning the active file for new newsgroups.
addng.h 9 Public info regarding addng.c.
art.c 5 Routines to display an article.
art.h 7 Public info regarding art.c.
art.help.SH 8 Shell script for help at the article level.
artio.c 8 Reserved for the article abstract type, someday.
artio.h 9 Public info regarding artio.c.
artsrch.c 7 Routines for searching among articles.
artsrch.h 4 Public info regarding artsrch.c.
artstate.h 9 Info on the current state of the article.
backpage.c 9 Routines for paging backwards in articles.
backpage.h 9 Public info regarding backpage.c.
bits.c 5 Bitmap management functions.
bits.h 9 Public info regarding bits.c.
cheat.c 8 Routines to do lookahead of several types.
cheat.h 9 Public info regarding cheat.c.
common.h 3 Global info.
final.c 8 Finalization (exit) routines.
final.h 9 Public info regarding final.c.
getactive.c 9 Program used by shell scripts to the active file (RRN only)
head.c 7 Header parsing routines.
head.h 8 Public info regarding head.c.
help.c 7 Help routines.
help.h 9 Public info regarding help.c.
init.c 7 Initialization (startup) routines.
init.h 9 Public info regarding init.c.
intrp.c 4 Filename expansion and % interpretation routines.
intrp.h 9 Public info regarding intrp.c.
kfile.c 7 KILL file routines.
kfile.h 9 Public info regarding kfile.c.
kitleader 2 Shell script to produce front of kit.
kitlists.c 9 Knapsack packer.
kittrailer 9 Shell script to produce end of kit.
last.c 9 Routines for handling the .rnlast file.
last.h 9 Public info regarding last.c.
makedepend.SH 8 Shell script to generate make dependencies.
makedir.SH 9 Shell script to make nested subdirectories.
makedist 9 Shell script to make a distribution kit.
makekit 9 Shell script to make a kit file.
manifake 9 Shell script to make MANIFEST.new file.
manimake 9 Shell script to make MANIFEST file.
mbox.saver.SH 9 Shell script to save an article to a mailbox.
ndir.c 9 4.2 directory routine emulation.
ndir.h 8 Public info regarding ndir.c.
newsetup.1 6 Manual page for newsetup.
newsetup.SH 8 Shell script to create a .newsrc file.
newsgroups.1 9 Manual page for newsgroups.
newsgroups.SH 8 Shell script to list unsubscribed newsgroups.
newsnews.SH 9 A motd-like file that rn may print at startup.
ng.c 3 Routines to display a newsgroup.
ng.h 9 Public info regarding ng.c.
ng.help.SH 9 Shell script to do newsgroup selection help.
ngdata.c 7 General data fetching routines for a newsgroup.
ngdata.h 9 Public info regarding ngdata.c.
ngsrch.c 8 Routines to search among newsgroups.
ngsrch.h 9 Public info regarding ngsrch.c.
ngstuff.c 2 Support routines for ng.c.
ngstuff.h 3 Public info regarding ng.c.
norm.saver.SH 9 Shell script to save an article to a normal file.
only.c 9 Routines to perform newsgroup restriction.
only.h 9 Public info regarding only.c.
pager.help.SH 9 Shell script for help at the pager level.
patchlevel 2 Indicates current patch level.
range.c 9 Used when rebuilding the rn kit.
rcln.c 3 Routines to mung a .newsrc line.
rcln.h 9 Public info regarding rcln.c.
rcstuff.c 5 Routines to mung the .newsrc file.
rcstuff.h 9 Public info regarding rcstuff.c.
respond.c 6 Various routines for doing things with articles.
respond.h 9 Public info regarding respond.c.
rn.1 1 Manual pages for rn. PLEASE READ.
rn.c 6 Main program.
rn.h 9 Public info regarding rn.c.
search.c 4 Regular expression processing ala emacs.
search.h 9 Public info regarding search.c.
subs.help.SH 9 Shell script for help for escape substitutions.
sw.c 6 Switch processing routines.
sw.h 9 Public info regarding switch.c.
term.c 4 Terminal interface routines.
term.h 7 Public info regarding term.c.
util.c 6 Utility routines.
util.h 9 Public info regarding util.c.
!STUFFY!FUNK!
echo Extracting Makefile.SH
cat >Makefile.SH <<'!STUFFY!FUNK!'
case $CONFIG in
'') . ./config.sh ;;
esac
echo "Extracting Makefile (with variable substitutions)"
cat >Makefile <<!GROK!THIS!
# $Header: Makefile.SH,v 4.3.2.10 90/05/04 00:44:51 sob Exp $
#
# $Log: Makefile.SH,v $
# Revision 4.3.2.10 90/05/04 00:44:51 sob
# Added socketlib to list of libs.
#
# Revision 4.3.2.9 90/04/23 00:27:12 sob
# Added better support for XENIX
#
# Revision 4.3.2.8 89/12/20 23:20:14 sob
# Added "hp-ux" to the list of files created by Configure.
#
# Revision 4.3.2.7 89/12/09 01:49:48 sob
# make clean cleans up better.
#
# Revision 4.3.2.6 89/12/08 22:43:45 sob
# Added suggestions by weening@gang-of-four.stanford.edu and
# jik@pit-manager.mit.edu. rrn manual page is now created when
# doing an installation. getactive will only be made when rrn is being
# created.
#
# Revision 4.3.2.5 89/11/08 04:47:38 sob
# Added VOIDSIG handling for SunOS 4.X
#
# Revision 4.3.2.4 89/11/08 03:16:29 sob
# Added server.h to list of things created by Configure
#
# Revision 4.3.2.3 89/11/08 01:05:52 sob
# Updated to work with RRN or RN
#
# Revision 4.3.2.2 89/11/06 00:03:19 sob
# Added RRN support originally distributed with NNTP 1.5
#
# Revision 4.3.2.1 89/11/05 23:55:09 sob
# RRN support branch
#
# Revision 4.3.1.2 85/05/13 17:21:18 lwall
# System V make needs space before line-continuing backslash.
#
# Revision 4.3.1.1 85/05/10 11:30:15 lwall
# Branch for patches.
#
# Revision 4.3 85/05/01 11:33:26 lwall
# Baseline for release with 4.3bsd.
#
CC = $cc
rnbin = $rnbin
rnlib = $rnlib
mansrc = $mansrc
manext = $manext
#NNTPNNTPDIR = $NNTPSRC
#NNTPNNTPINC = $rrninclude
CFLAGS = $iandd -O $include
LDFLAGS = $iandd
NDIRC = $ndirc
NDIRO = $ndiro
libs = $ndirlib $termlib $jobslib $socketlib
!GROK!THIS!
cat >>Makefile <<'!NO!SUBS!'
#NNTPnntp=getactive
public = rn newsetup newsgroups Pnews Rnmail
private = norm.saver mbox.saver ng.help art.help pager.help subs.help makedir filexp Pnews.header $(nntp)
manpages = rn.1 Pnews.1 Rnmail.1 newsetup.1 newsgroups.1
util = Makefile makedepend newsnews
h1 = addng.h art.h artio.h artsrch.h backpage.h bits.h cheat.h common.h
h2 = final.h head.h help.h init.h intrp.h kfile.h last.h ndir.h ng.h
h3 = ngdata.h ngsrch.h ngstuff.h only.h rcln.h rcstuff.h
h4 = respond.h rn.h search.h sw.h term.h util.h
#NNTPh5 = server.h
h = $(h1) $(h2) $(h3) $(h4) $(h5)
c1 = addng.c art.c artio.c artsrch.c backpage.c bits.c cheat.c
c2 = final.c head.c help.c init.c intrp.c kfile.c last.c $(NDIRC) ng.c
c3 = ngdata.c ngsrch.c ngstuff.c only.c rcln.c rcstuff.c
c4 = respond.c rn.c search.c sw.c term.c util.c
#NNTPc5 = $(NNTPDIR)/common/clientlib.c
c = $(c1) $(c2) $(c3) $(c4) $(c5)
obj1 = addng.o art.o artio.o artsrch.o backpage.o bits.o cheat.o
obj2 = final.o head.o help.o init.o intrp.o kfile.o last.o $(NDIRO) ng.o
obj3 = ngdata.o ngsrch.o ngstuff.o only.o rcln.o rcstuff.o
obj4 = respond.o rn.o search.o sw.o term.o util.o
#NNTPobj5 = $(NNTPDIR)/common/clientlib.o
obj = $(obj1) $(obj2) $(obj3) $(obj4) $(obj5)
lintflags = -phbvxac
add1 = Makefile.old Pnews Rnmail art.help
add2 = bsd config.h config.sh eunice filexp
add3 = loc makedepend makedir mbox.saver newsetup
add4 = newsgroups newsnews ng.help norm.saver pager.help
add5 = pdp11 rn subs.help usg v7 ultrix sun hp-ux sgi xenix server.h
addedbyconf = $(add1) $(add2) $(add3) $(add4) $(add5)
# grrr
SHELL = /bin/sh
.c.o:
$(CC) -c $(CFLAGS) $*.c
all: $(public) $(private) $(util)
touch all
rn: $(obj)
$(CC) $(LDFLAGS) $(obj) $(libs) -o rn
#NNTPgetactive: getactive.o $(NNTPDIR)/common/clientlib.o
#NNTP $(CC) $(LDFLAGS) getactive.o $(NNTPDIR)/common/clientlib.o -o getactive $(libs)
# Eek! This is gross.
$(NNTPDIR)/common/clientlib.o:
$(CC) -c $(CFLAGS) $(NNTPINC) $(NNTPDIR)/common/clientlib.c
mv clientlib.o $(NNTPDIR)/common/clientlib.o
# if a .h file depends on another .h file...
$(h):
touch $@
install: rn
# won't work with csh
export PATH || exit 1
- mv $(rnbin)/rn $(rnbin)/rn.old
#NNTP - ln -s rn $(rnbin)/rrn
- if test `pwd` != $(rnbin); then cp $(public) $(rnbin); fi
cd $(rnbin); chmod 755 $(public)
chmod 755 makedir
- ./makedir `./filexp $(rnlib)`
- if test `pwd` != `./filexp $(rnlib)`; then cp INIT $(private) `./filexp $(rnlib)`; fi
cd `./filexp $(rnlib)`; chmod 755 $(private)
- if test ! -f `./filexp $(rnlib)/newsnews`; then cp newsnews `./filexp $(rnlib)`; fi
- if test `pwd` != $(mansrc); then \
for page in $(manpages); do \
cp $$page $(mansrc)/`basename $$page .1`.$(manext); \
done; \
#NNTPecho ".so man$(manext)/rn.$(manext)" > $(mansrc)/rrn.$(manext) ; \
fi
clean:
rm -f *.o
realclean:
rm -f rn *.o core $(addedbyconf)
#NNTP rm -f $(NNTPDIR)/common/clientlib.o getactive
# The following lint has practically everything turned on. Unfortunately,
# you have to wade through a lot of mumbo jumbo that can't be suppressed.
# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
# for that spot.
lint:
lint $(lintflags) $(defs) $(c) > rn.fuzz
depend:
./makedepend
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
$(obj):
@ echo "You haven't done a "'"make depend" yet!'; exit 1
!NO!SUBS!
case "$isrrn" in
define) sed < Makefile -e '/^#NNTP/s/^#NNTP//' > Makefile.new ;;
*) sed < Makefile -e '/^#NNTP/d' > Makefile.new ;;
esac
mv Makefile.new Makefile
$eunicefix Makefile
!STUFFY!FUNK!
echo Extracting newsetup.SH
cat >newsetup.SH <<'!STUFFY!FUNK!'
case $CONFIG in
'') . ./config.sh ;;
esac
echo "Extracting newsetup (with variable substitutions)"
$spitshell >newsetup <<!GROK!THIS!
$startsh
# $Header: newsetup.SH,v 4.3.2.7 90/03/17 20:34:48 sob Exp $
#
# $Log: newsetup.SH,v $
# Revision 4.3.2.7 90/03/17 20:34:48 sob
# Remove the /tmp/n.* files created when generating the .newsrc.
#
# Revision 4.3.2.6 90/03/17 17:26:42 sob
# Some versions of sed only take 9 wfiles.
#
# Revision 4.3.2.5 89/11/28 01:15:32 sob
# Fixed a bug that caused the active file to be removed on non-NNTP-based
# systems.
#
# Revision 4.3.2.4 89/11/28 00:31:20 sob
# Changed news.announce.newuser to news.announce.newusers.
#
# Revision 4.3.2.3 89/11/08 01:13:15 sob
# Finished modifications to make work with RN and RRN
#
# Revision 4.3.2.2 89/11/07 23:25:50 sob
#
# Added support such that RN and RRN can be made from the same sources.
#
# Revision 4.3.1.2 86/09/05 15:41:04 lwall
# Changes for newsgroup renaming.
#
# Revision 4.3.1.1 85/05/10 11:35:43 lwall
# Branch for patches.
#
# Revision 4.3 85/05/01 11:43:05 lwall
# Baseline for release with 4.3bsd.
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
: syntax: newsetup
: System dependencies
: You will want to change the definitions below to reflect the distribution
: areas around you. If you have more areas than this you will need to modify
: the sed below.
locorg="$locpref"
organization="$orgpref"
city="$citypref"
state="$statepref"
cntry="$cntrypref"
cont="$contpref"
#NORMALactive="${active-/usr/lib/news/active}"
#NNTPactive="/tmp/active.\$\$"
dotdir="\${DOTDIR-\${HOME-\$LOGDIR}}"
$rm -f \$dotdir/.oldnewsrc
$echo "Creating .newsrc in \$dotdir to be used by news programs."
#NNTPrnlib=$rnlib
#NNTPcase \$rnlib in
#NNTP~*) rnlib=\`$filexp \$rnlib\` ;;
#NNTPesac
#NNTP\$rnlib/getactive \$active
#NORMALcase \$active in
#NORMAL~*) active=\`$filexp \$active\` ;;
#NORMALesac
: NOTE: SED WILL NOT TAKE MORE THAN 9 WFILES, SO BEWARE
$sort <\$active | $sed >/tmp/n.tmp\$\$ \\
-e 's/^\([^ ]*\) .*\$/\1:/' \\
-e '/^control:/{' \\
-e " s/:/!/" \\
-e " w /tmp/n.test\$\$" \\
-e ' d' \\
-e '}' \\
-e '/^junk:/{' \\
-e " s/:/!/" \\
-e " w /tmp/n.test\$\$" \\
-e ' d' \\
-e '}' \\
-e '/test:/{' \\
-e " s/:/!/" \\
-e " w /tmp/n.test\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^\$locorg\./{" \\
-e " w /tmp/n.\$locorg\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^\$organization\./{" \\
-e " w /tmp/n.\$organization\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^\$city\./{" \\
-e " w /tmp/n.\$city\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^\$cntry\./{" \\
-e " w /tmp/n.\$cntry\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^\$state\./{" \\
-e " w /tmp/n.\$state\$\$" \\
-e ' d' \\
-e '}'
$sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$ \\
-e "/^\$cont\./{" \\
-e " w /tmp/n.\$cont\$\$" \\
-e ' d' \\
-e '}'
$sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$ \\
-e "/^to\./{" \\
-e " s/:/!/" \\
-e " w /tmp/n.to\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^comp\./{" \\
-e " w /tmp/n.comp\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^news\./{" \\
-e " w /tmp/n.news\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^rec\./{" \\
-e " w /tmp/n.rec\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^sci\./{" \\
-e " w /tmp/n.sci\$\$" \\
-e ' d' \\
-e '}' \\
-e "/^soc\./{" \\
-e " w /tmp/n.soc\$\$" \\
-e ' d' \\
-e '}' \\
-e "/\./{" \\
-e " w /tmp/n.misc\$\$" \\
-e ' d' \\
-e '}'
if $test -s \$dotdir/.newsrc ; then
$echo "Saving your current .newsrc as .oldnewsrc..."
$mv -f \$dotdir/.newsrc \$dotdir/.oldnewsrc
fi
: newsrc order determined here
$sed <\$active '
/^to\./d
s/ .*//
s/^/ /
s/^ '\$locorg'\./01&/
s/^ '\$organization'\./02&/
s/^ '\$city'\./03&/
s/^ '\$state'\./04&/
s/^ '\$cntry'\./05&/
s/^ '\$cont'\./06&/
s/^ news\./07&/
s/^ comp\./08&/
s/^ sci\./09&/
s/^ rec\./10&/
s/^ soc\./11&/
s/^ talk\./13&/
s/^ control\$/14&/
s/^ junk\$/14&/
s/^ test\$/14&/
/\.test\$/s/^[0-9]*/14/
s/^ .*\./12&/
s/^ /00&/
' |
$sort -u |
$sed '
/^14 /!s/\$/:/
/^14 /s/\$/!/
s/^[0-9][0-9] //
' >\$dotdir/.newsrc
#NNTP$rm -f \$active
$rm -f /tmp/n.misc\$\$ /tmp/n.sci\$\$ /tmp/n.soc\$\$ /tmp/n.news\$\$ /tmp/n.comp\$\$
$rm -f /tmp/n.\$cont\$\$ /tmp/n.\$city\$\$ /tmp/n.\$cntry\$\$ /tmp/n.\$state\$\$
$rm -f /tmp/n.to\$\$ /tmp/n.\$organization\$\$ /tmp/n.\$locorg\$\$ /tmp/n.test\$\$
$rm -f /tmp/n.tmp\$\$ /tmp/n.local\$\$ /tmp/n.rec\$\$
$cat <<'EOH'
Done.
If you have never used the news system before, you may find the articles
in news.announce.newusers to be helpful. There is also a manual entry for rn.
To get rid of newsgroups you aren't interested in, use the 'u' command.
Type h for help at any time while running rn.
EOH
!GROK!THIS!
case "$isrrn" in
define) sed < newsetup -e '/^#NNTP/s/^#NNTP//' -e '/^#NORMAL/d' > newsetup.new ;;
*) sed < newsetup -e '/^#NNTP/d' -e '/^#NORMAL/s/^#NORMAL//' > newsetup.new ;;
esac
mv newsetup.new newsetup
$eunicefix newsetup
chmod 755 newsetup
!STUFFY!FUNK!
echo Extracting final.c
cat >final.c <<'!STUFFY!FUNK!'
/* $Header: final.c,v 4.3.2.8 90/04/14 19:37:14 sob Exp $
*
* $Log: final.c,v $
* Revision 4.3.2.8 90/04/14 19:37:14 sob
* Added better support for the NeXT.
*
* Revision 4.3.2.7 90/03/17 21:33:49 sob
* cleaned up a bit
*
* Revision 4.3.2.6 90/03/17 16:48:25 sob
* Added changes to insure that rrn cleans up its temporary files when
* exiting.
*
* Revision 4.3.2.5 89/11/28 01:51:28 sob
* Now handles SIGWINCH correctly.
*
* Revision 4.3.2.4 89/11/27 01:30:24 sob
* Altered NNTP code per ideas suggested by Bela Lubkin
* <filbo@gorn.santa-cruz.ca.us>
*
* Revision 4.3.2.3 89/11/08 02:25:07 sob
* Integrated modifications from other RRN patches colleceted from USENET
*
* Revision 4.3.2.2 89/11/07 23:26:31 sob
* Added some fixes that relate to SIGSTP
*
* Revision 4.3.2.1 89/11/06 00:16:08 sob
* Added RRN support from NNTP 1.5
*
* Revision 4.3 85/05/01 11:38:08 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#include "util.h"
#include "term.h"
#include "ng.h"
#include "init.h"
#include "bits.h"
#include "last.h"
#include "rcstuff.h"
#include "ngdata.h"
#include "artio.h"
#include "INTERN.h"
#include "final.h"
void
final_init()
{
#ifdef SIGTSTP
sigset(SIGTSTP, stop_catcher); /* job control signals */
sigset(SIGTTOU, stop_catcher); /* job control signals */
sigset(SIGTTIN, stop_catcher); /* job control signals */
#endif
sigset(SIGINT, int_catcher); /* always catch interrupts */
sigset(SIGHUP, sig_catcher); /* and hangups */
#ifndef lint
sigignore(SIGEMT);
#endif lint
sigset(SIGILL, sig_catcher);
sigset(SIGTRAP, sig_catcher);
sigset(SIGFPE, sig_catcher);
sigset(SIGBUS, sig_catcher);
sigset(SIGSEGV, sig_catcher);
sigset(SIGSYS, sig_catcher);
sigset(SIGTERM, sig_catcher);
#ifdef SIGXCPU
sigset(SIGXCPU, sig_catcher);
#endif
#ifdef SIGXFSZ
sigset(SIGXFSZ, sig_catcher);
#endif
#ifdef SIGWINCH
sigset(SIGWINCH, winch_catcher);
#endif
}
void /* very much void */
finalize(status)
int status;
{
#ifdef SERVER
char artname[32];
#endif SERVER
if (bizarre)
resetty();
if (lockname && *lockname)
UNLINK(lockname);
#ifdef SERVER
if (*active_name)
UNLINK(active_name);
if (openart) {
char artname[32];
sprintf(artname, "/tmp/rrn%ld.%d", (long)openart, getpid());
UNLINK(artname);
}
close_server();
#endif SERVER
if (status < 0) {
chdir("/usr/tmp");
sigset(SIGILL,SIG_DFL);
abort();
}
exit(status);
}
/* come here on interrupt */
int
int_catcher()
{
sigset(SIGINT,int_catcher);
#ifdef DEBUGGING
if (debug)
write(2,"int_catcher\n",12);
#endif
if (!waiting) {
if (int_count) { /* was there already an interrupt? */
write(2,"\nBye-bye.\n",10);
sig_catcher(0); /* emulate the other signals */
}
int_count++;
}
}
/* come here on signal other than interrupt, stop, or cont */
int
sig_catcher(signo)
{
#ifdef VERBOSE
static char *signame[] = {
"",
"HUP",
"INT",
"QUIT",
"ILL",
"TRAP",
"IOT",
"EMT",
"FPE",
"KILL",
"BUS",
"SEGV",
"SYS",
"PIPE",
"ALRM",
"TERM",
"???"
#ifdef SIGTSTP
,"STOP",
"TSTP",
"CONT",
"CHLD",
"TTIN",
"TTOU",
"TINT",
"XCPU",
"XFSZ"
#ifdef SIGPROF
,"VTALARM",
"PROF"
#endif
#endif
};
#endif
#ifdef DEBUGGING
if (debug) {
printf("\nSIG%s--.newsrc not restored in debug\n",signame[signo]);
finalize(-1);
}
#endif
if (panic)
abort();
(void) sigset(SIGILL,SIG_DFL);
panic = TRUE; /* disable terminal I/O */
if (doing_ng) { /* need we reconstitute rc line? */
yankback();
restore_ng(); /* then do so (hope this works) */
}
doing_ng = FALSE;
if (rc_changed) /* need we write .newsrc out? */
write_rc(); /* then do so */
rc_changed = FALSE;
if (signo != SIGHUP)
#ifdef VERBOSE
IF(verbose)
printf("\nCaught %s%s--.newsrc restored\n",
signo ? "a SIG" : "an internal error", signame[signo]);
ELSE
#endif
#ifdef TERSE
printf("\nSignal %d--bye bye\n",signo);
#endif
switch (signo) {
case SIGBUS:
case SIGILL:
case SIGSEGV:
finalize(-signo);
}
finalize(1); /* and blow up */
}
#ifdef SIGTSTP
/* come here on stop signal */
int
stop_catcher(signo)
int signo;
{
if (!waiting) {
checkpoint_rc(); /* good chance of crash while stopped */
resetty(); /* this is the point of all this */
#ifdef DEBUGGING
if (debug)
write(2,"stop_catcher\n",13);
#endif
sigset(signo,SIG_DFL); /* enable stop */
#ifdef SIGBLOCK
sigsetmask(sigblock(0) & ~(1 << (signo-1)));
#endif
kill(0,signo); /* and do the stop */
savetty();
#ifdef MAILCALL
mailcount = 0; /* force recheck */
#endif
if (!panic) {
if (!waiting) {
noecho(); /* set no echo */
crmode(); /* set cbreak mode */
forceme("\f"); /* cause a refresh */
/* (defined only if TIOCSTI defined) */
errno = 0; /* needed for getcmd */
}
}
}
sigset(signo,stop_catcher); /* unenable the stop */
}
#endif
!STUFFY!FUNK!
echo Extracting artio.c
cat >artio.c <<'!STUFFY!FUNK!'
/* $Header: artio.c,v 4.3.2.5 90/03/22 23:04:04 sob Exp $
*
* $Log: artio.c,v $
* Revision 4.3.2.5 90/03/22 23:04:04 sob
* Fixes provided by Wayne Davison <drivax!davison>
*
* Revision 4.3.2.4 89/11/27 01:29:57 sob
* Altered NNTP code per ideas suggested by Bela Lubkin
* <filbo@gorn.santa-cruz.ca.us>
*
* Revision 4.3.2.3 89/11/26 22:55:31 sob
* Add nntpopen() and nntpclose() routines to cut down on size of rrn
*
* Revision 4.3.2.2 89/11/08 01:17:12 sob
* Added changes to insure that this will compile for RN or RRN with no
* changes to the source code.
*
* Revision 4.3.2.1 89/11/06 00:07:25 sob
* Added RRN support from NNTP 1.5
*
* Revision 4.3 85/05/01 11:35:39 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#ifdef SERVER
#include "server.h"
#endif
#include "INTERN.h"
#include "artio.h"
void
artio_init()
{
;
}
/* open an article, unless it's already open */
FILE *
artopen(artnum)
ART_NUM artnum;
{
#ifdef SERVER
nntpopen(artnum,ARTICLE);
#else
char artname[32]; /* filename of current article */
if (artnum < 1)
return Nullfp;
if (openart == artnum) { /* this article is already open? */
fseek(artfp,0L,0); /* just get to the beginning */
return artfp; /* and say we succeeded */
}
if (artfp != Nullfp) { /* it was somebody else? */
fclose(artfp); /* put them out of their misery */
openart = 0; /* and remember them no more */
}
sprintf(artname,"%ld",(long)artnum);
/* produce the name of the article */
if (artfp = fopen(artname,"r")) /* if we can open it */
openart = artnum; /* remember what we did here */
#endif SERVER
#ifdef LINKART
{
char tmpbuf[256];
char *s;
if (fstat(artfp->_file,&filestat))
return artfp;
if (filestat.st_size < (sizeof tmpbuf)) {
fgets(tmpbuf,(sizeof tmpbuf),artfp);
if (*tmpbuf == '/') { /* is a "link" to another article */
fclose(artfp);
if (s=index(tmpbuf,'\n'))
*s = '\0';
if (!(artfp = fopen(tmpbuf,"r")))
openart = 0;
else {
if (*linkartname)
free(linkartname);
linkartname = savestr(tmpbuf);
}
}
else
fseek(artfp,0L,0); /* get back to the beginning */
}
}
#endif
return artfp; /* and return either fp or NULL */
}
#ifdef SERVER
static long our_pid;
FILE *
nntpopen(artnum,function)
ART_NUM artnum;
ART_PART function;
{
char ser_line[256];
char artname[32]; /* filename of current article */
if (our_pid == 0)
our_pid = getpid();
if (artnum < 1)
return Nullfp;
if ((openart == artnum) && (openpart >= function))
{ /* this article is already open? */
fseek(artfp,0L,0); /* just get to the beginning */
return artfp; /* and say we succeeded */
}
if (artfp != Nullfp) { /* it was somebody else? */
fclose(artfp); /* put them out of their misery */
nntpclose();
openart = 0; /* and remember them no more */
}
sprintf(artname,"/tmp/rrn%ld.%ld", (long) artnum, our_pid);
artfp = fopen(artname, "w+"); /* create the temporary article */
if (artfp == Nullfp) {
UNLINK(artname);
return Nullfp;
}
switch (function){
case STAT:
function = HEAD; /* fall through */
case HEAD:
sprintf(ser_line, "HEAD %ld", (long)artnum);
break;
case ARTICLE:
sprintf(ser_line, "ARTICLE %ld", (long)artnum);
break;
}
put_server(ser_line); /* ask the server for the article */
if (get_server(ser_line, sizeof(ser_line)) < 0) {
fprintf(stderr, "rrn: Unexpected close of server socket.\n");
finalize(1);
}
if (*ser_line != CHAR_OK) { /* and get it's reaction */
fclose(artfp);
artfp = Nullfp;
UNLINK(artname);
errno = ENOENT; /* Simulate file-not-found */
return Nullfp;
}
for (;;) {
if (get_server(ser_line, sizeof(ser_line)) < 0) {
fprintf(stderr, "rrn: Unexpected close of server socket.\n");
finalize(1);
}
if (ser_line[0] == '.' && ser_line[1] == '\0')
break;
fputs((ser_line[0] == '.' ? ser_line + 1 : ser_line), artfp);
putc('\n', artfp);
}
openpart = function;
if (function == HEAD)
putc('\n', artfp); /* req'd blank line after header */
fseek(artfp, 0L, 0); /* Then get back to the start */
openart = artnum;
return artfp; /* and return either fp or NULL */
}
void
nntpclose()
{
char artname[32]; /* filename of current article */
if (our_pid == 0)
our_pid = getpid();
sprintf(artname, "/tmp/rrn%ld.%ld", (long) openart, our_pid);
UNLINK(artname);
}
#endif
!STUFFY!FUNK!
echo Extracting HACKERSGUIDE
cat >HACKERSGUIDE <<'!STUFFY!FUNK!'
Hacking Notes
If you aren't interested in mucking with the innards of rn, don't read this.
In the interests of both space and time optimization, things are done inside
rn that don't always conform to the highest ideals of programming. To the
extent I felt it was practical, I've tried to conform to good programming
practice, but you must realize that my goal was to make a better mousetrap,
so certain conscious tradeoffs were made in the design of rn right from the
start. In particular, if you want to hack on rn (and I wouldn't blame you,
it's fun), beware of the following:
* buf and cmd_buf are reused all over the place. 11-squishing is a good
term for it. No, I'm on a Vax now, but I've been there.
* The article header is parsed on the fly, while it is being displayed.
In fact, practically everything is done on the fly within the article
display loop, and there are plenty of state variables. The header
is never explicitly stored in memory; rather, pointers are kept into
the file. The information required to backup pages is not stored in
memory, except for 1 buffer's worth. The information required to do
the delayed mark as unread (M) is not stored in memory either.
* Lots of contortions are gone through to avoid using static memory, or
allocating unnecessary memory, or losing track of allocated memory,
while at the same time allowing .newsrc lines and header lines to be
ANY length up to the amount of memory you have. Rn spends a great deal
of effort being lazy. Do not use a static buffer when you can use
growstr().
* Lots of contortions are gone through to try to do things when people
aren't waiting, or have only been waiting a very short time. Guessing
the next article to be opened and opening it, searching ahead for the
next article with the same subject, delaying the look up of the number
of articles in a newsgroup, writing the rest of the page while the
reader is examining the header, cacheing up subjects while the user
is reading, checkpointing the .newsrc only while the reader is in the
middle of an interesting article, are some of the strategies employed.
* There are plenty of goto's. Most of them involve going back to reprompt,
to reask for input, or to just plain do the unstructured things people
want to do when they are glaring at a terminal. If they bother you
too much, just think of rn as a big state machine. If they don't bother
you at all, I don't want you hacking on rn.
* Put all includes at the front of the file, before the first function,
or makedepend will not work right. I could relax this, but makedepend
would take about 5 times longer to run.
In general then, feel free to hack on rn. Just don't broadcast untested
patches to the net. Remember that there are people with limited address
spaces and limited cpu cycles. If you add a wonderful new feature and
want to publish a patch, put #ifdef's around it so that people who don't
want it or can't afford it can work around it. THIS MEANS YOU. We don't
need 57 varieties of mutually incompatible and incomprehensible rn floating
about the net. Consider telling me about your patch so that I can consider
including it in the standard version. A COMPLETE PATCH TAKES INTO ACCOUNT
SYSTEM DEPENDENCIES AS DETERMINED BY THE CONFIGURE SCRIPT.
* Don't use ints where rn uses typedefs, in particular, for article numbers.
* Don't use %d anywhere that someone might need a %ld. (Just because YOU
typedefed it as an int doesn't mean someone else won't need a long.)
* Don't use %D, that's archaic.
* Put FLUSHes after printf()s, fputs()es and putchar('\n')s for our poor
brethern and sistern without line buffering.
* Declare the type of every function. Use void, even if your C compiler
doesn't.
* Follow the style that rn already uses! This is my pet peeve. Well, one of
them, anyway. I follow other people's strange styles when modifying
their programs, so I'd be much obliged if you did likewise.
* Use lint.
* Use RCS. Start a new branch, like 4.3.[2-9]. (I will use 4.3.1 myself.)
* Be structured wherever it doesn't interfere with practicality.
* Long live paranoid programming. The rest of the program is out to get you.
The world is out to destroy the program, not to mention the .newsrc.
And then there's always bitrot...
* Stop reading this lugubrious trash and start thinking for yourself.
* Thank you and good night.
!STUFFY!FUNK!
echo Extracting README
cat >README <<'!STUFFY!FUNK!'
Rn Kit, Version 4.3
Copyright (c) 1985, Larry Wall
You may copy the rn kit in whole or in part as long as you don't try to
make money off it, or pretend that you wrote it.
--------------------------------------------------------------------------
Please read all the directions below before you proceed any further, and
then follow them carefully. Failure to do so may void your warranty. :-)
After you have unpacked your kit, you should have all the files listed
in MANIFEST.
Installation
1) Run Configure. This will figure out various things about your system.
Some things Configure will figure out for itself, other things it will
ask you about. It will then proceed to make config.h, config.sh, Makefile,
and a bunch of shell scripts. It will also do a make depend for you.
You might possibly have to trim # comments from the front of Configure
if your sh doesn't handle them, but all other # comments will be taken
care of.
2) Glance through config.h and common.h to make sure system dependencies
are correct. Most of them should have been taken care of by running
the Configure script.
If you have any additional changes to make to the C definitions, they
can be done in the Makefile, in config.h, or in common.h. If you have
strange mailboxes on your system you should modify mbox.saver to correctly
append an article to a mailbox or folder.
If you are on a machine with limited address space, you may have to
remove some of the special functions of rn to make it fit. This is
easily done by undefining symbols in the System Dependencies section
of common.h. You should run "make depend" again to be safe.
3) make
This will attempt to make rn in the current directory.
4) make install
This will put rn, newsetup, newsgroups, Pnews, and Rnmail into a public
directory (normally /usr/local/bin), and put a number of files into the
private rn library (normally /usr/lib/news/rn). It will also try to put
the man pages in a reasonable place.
5) Read the manual entry before running rn. It's quite different from
readnews.
6) If you are trying to make it work with NNTP, be sure you have
installed the NNTP inews and the file that contains the name of the
NNTP server. RRN expects that the NNTP is at least version 1.5.
7) Try rn, and play with some of the switches. You may want to make -/
default on your system. This is done in common.h. You may want to modify
which header lines are displayed by default--this is done in head.h.
To change default values of enviroment variables on a system-wide basis
without recompiling rn, put switches into file INIT in the rn library.
8) IMPORTANT! Help save the world! Communicate any problems and
suggested patches to my faithful servant, sob@bcm.tmc.edu, so we can
keep the world in sync. If you have a problem, there's someone else
out there who either has had or will have the same problem.
If possible, send in patches such that the patch program will apply them.
Context diffs are the best, then normal diffs. Don't send ed scripts--
I've probably changed my copy since the version you have.
Watch for rn patches in news.software.b. Patches will generally be
applyable (is that a word?) by the patch program. If you are just
now bringing up news and aren't sure how many patches there are, write
to sob@bcm.tmc.edu and he'll send any you don't have.
9) If you are going to hack on rn, please read the HACKERSGUIDE first.
!STUFFY!FUNK!
echo Extracting head.h
cat >head.h <<'!STUFFY!FUNK!'
/* $Header: head.h,v 4.3 85/05/01 11:38:31 lwall Exp $
*
* $Log: head.h,v $
* Revision 4.3 85/05/01 11:38:31 lwall
* Baseline for release with 4.3bsd.
*
*/
#define HEAD_FIRST 1
/* types of header lines (if only C really believed in enums)
* (These must stay in alphabetic order at least in the first letter.
* Within each letter it helps to arrange in increasing likelihood.)
*/
#define PAST_HEADER 0 /* body */
#define SOME_LINE 1 /* unrecognized */
#define ARTID_LINE 2 /* article-i.d. */
#define APPR_LINE 3 /* approved */
#define DIST_LINE 4 /* distribution */
#define DATE_LINE 5 /* date */
#define RECEIVED_LINE 6 /* date-received */
#define EXPIR_LINE 7 /* expires */
#define FOLLOW_LINE 8 /* followup-to */
#define FROM_LINE 9 /* from */
#define KEYW_LINE 10 /* keywords */
#define LINES_LINE 11 /* lines */
#define MESSID_LINE 12 /* message-id */
#define NFFR_LINE 13 /* nf-from */
#define NFID_LINE 14 /* nf-id */
#define NGS_LINE 15 /* newsgroups */
#define ORG_LINE 16 /* organization */
#define PATH_LINE 17 /* path */
#define POSTED_LINE 18 /* posted */
#define PVER_LINE 19 /* posting-version */
#define REPLY_LINE 20 /* reply-to */
#define REFS_LINE 21 /* references */
#define RVER_LINE 22 /* relay-version */
#define SENDER_LINE 23 /* sender */
#define SUMRY_LINE 24 /* summary */
#define SUBJ_LINE 25 /* subject */
#define XREF_LINE 26 /* xref */
#define HEAD_LAST 27 /* one more than the last one above */
struct headtype {
char *ht_name; /* header line identifier */
#ifdef pdp11
short ht_minpos;
short ht_maxpos;
#else
ART_POS ht_minpos; /* pointer to beginning of line in article */
ART_POS ht_maxpos; /* pointer to end of line in article */
#endif
char ht_length; /* could make these into nybbles but */
char ht_flags; /* it wouldn't save space normally */
}; /* due to alignment considerations */
#define HT_HIDE 1 /* -h on this line */
#define HT_MAGIC 2 /* do any special processing on this line */
/* This array must stay in the same order as the list above */
#ifndef DOINIT
EXT struct headtype htype[HEAD_LAST];
#else
struct headtype htype[HEAD_LAST] = {
/* name minpos maxpos length flag */
{"BODY", 0, 0, 4, 0 },
{"unrecognized", 0, 0, 12, 0 },
{"article-i.d.", 0, 0, 12, HT_HIDE },
{"approved", 0, 0, 8, HT_HIDE },
{"distribution", 0, 0, 12, 0 },
{"date", 0, 0, 4, 0 },
{"date-received", 0, 0, 13, 0 },
{"expires", 0, 0, 7, HT_HIDE|HT_MAGIC},
{"followup-to", 0, 0, 11, 0 },
{"from", 0, 0, 4, 0 },
{"keywords", 0, 0, 8, 0 },
{"lines", 0, 0, 5, 0 },
{"message-id", 0, 0, 10, 0 },
{"nf-from", 0, 0, 7, HT_HIDE },
{"nf-id", 0, 0, 5, HT_HIDE },
{"newsgroups", 0, 0, 10, HT_MAGIC|HT_HIDE},
{"organization", 0, 0, 12, 0 },
{"path", 0, 0, 4, HT_HIDE },
{"posted", 0, 0, 6, HT_HIDE },
{"posting-version", 0, 0, 15, HT_HIDE },
{"reply-to", 0, 0, 8, 0 },
{"references", 0, 0, 10, 0 },
{"relay-version", 0, 0, 13, HT_HIDE },
{"sender", 0, 0, 6, 0 },
{"summary", 0, 0, 7, 0 },
{"subject", 0, 0, 7, HT_MAGIC },
{"xref", 0, 0, 4, HT_HIDE }
};
#endif
#ifdef ASYNC_PARSE
EXT ART_NUM parsed_art INIT(0);
#endif
EXT char in_header INIT(0); /* are we decoding the header? */
#ifdef CACHESUBJ
EXT char **subj_list INIT(Null(char **));
#endif
void head_init();
int set_line_type();
void start_header();
bool parseline();
#ifdef ASYNC_PARSE
int parse_maybe();
#endif
char *fetchsubj();
char *fetchlines();
!STUFFY!FUNK!
echo Extracting cheat.c
cat >cheat.c <<'!STUFFY!FUNK!'
/* $Header: cheat.c,v 4.3.2.2 89/11/27 01:30:18 sob Locked $
*
* $Log: cheat.c,v $
* Revision 4.3.2.2 89/11/27 01:30:18 sob
* Altered NNTP code per ideas suggested by Bela Lubkin
* <filbo@gorn.santa-cruz.ca.us>
*
* Revision 4.3.2.1 89/11/26 22:54:21 sob
* Added RRN support
*
* Revision 4.3 85/05/01 11:36:46 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#include "intrp.h"
#include "search.h"
#include "ng.h"
#include "bits.h"
#include "artio.h"
#include "term.h"
#include "artsrch.h"
#include "head.h"
#include "INTERN.h"
#include "cheat.h"
/* see what we can do while they are reading */
#ifdef PENDING
# ifdef ARTSEARCH
COMPEX srchcompex; /* compiled regex for searchahead */
# endif
#endif
void
cheat_init()
{
;
}
#ifdef PENDING
void
look_ahead()
{
#ifdef ARTSEARCH
register char *h, *s;
#ifdef DEBUGGING
if (debug && srchahead) {
printf("(%ld)",(long)srchahead);
fflush(stdout);
}
#endif
if (srchahead && srchahead < art) { /* in ^N mode? */
char *pattern;
pattern = buf+1;
strcpy(pattern,": *");
h = pattern + strlen(pattern);
interp(h,(sizeof buf) - (h-buf),"%s");
h[24] = '\0'; /* compensate for notesfiles */
while (*h) {
if (index("\\[.^*$'\"",*h) != Nullch)
*h++ = '.';
else
h++;
}
#ifdef DEBUGGING
if (debug & DEB_SEARCH_AHEAD) {
fputs("(hit CR)",stdout);
fflush(stdout);
gets(buf+128);
printf("\npattern = %s\n",pattern);
}
#endif
if ((s = compile(&srchcompex,pattern,TRUE,TRUE)) != Nullch) {
/* compile regular expression */
printf("\n%s\n",s);
srchahead = 0;
}
if (srchahead) {
srchahead = art;
for (;;) {
srchahead++; /* go forward one article */
if (srchahead > lastart) { /* out of articles? */
#ifdef DEBUGGING
if (debug)
fputs("(not found)",stdout);
#endif
break;
}
if (!was_read(srchahead) &&
wanted(&srchcompex,srchahead,0)) {
/* does the shoe fit? */
#ifdef DEBUGGING
if (debug)
printf("(%ld)",(long)srchahead);
#endif
#ifdef SERVER
nntpopen(srchahead,HEAD);
#else
artopen(srchahead);
#endif
break;
}
if (input_pending())
break;
}
fflush(stdout);
}
}
else
#endif
{
if (art+1 <= lastart)/* how about a pre-fetch? */
#ifdef SERVER
nntpopen(art+1,HEAD); /* look for the next article */
#else
artopen(art+1); /* look for the next article */
#endif
}
}
#endif
/* see what else we can do while they are reading */
void
collect_subjects()
{
#ifdef PENDING
# ifdef CACHESUBJ
ART_NUM oldart = openart;
ART_POS oldartpos;
if (!in_ng || !srchahead)
return;
if (oldart) /* remember where we were in art */
oldartpos = ftell(artfp);
if (srchahead >= subj_to_get)
subj_to_get = srchahead+1;
while (!input_pending() && subj_to_get <= lastart)
fetchsubj(subj_to_get++,FALSE,FALSE);
if (oldart) {
artopen(oldart);
fseek(artfp,oldartpos,0); /* do not screw the pager */
}
# endif
#endif
}
!STUFFY!FUNK!
echo Extracting Pnews.1
cat >Pnews.1 <<'!STUFFY!FUNK!'
''' $Header: Pnews.1,v 4.3.1.2 85/08/01 14:22:48 lwall Exp $
'''
''' $Log: Pnews.1,v $
''' Revision 4.3.1.2 85/08/01 14:22:48 lwall
''' Added AUTHORCOPY.
'''
''' Revision 4.3.1.1 85/05/10 11:30:30 lwall
''' Branch for patches.
'''
''' Revision 4.3 85/05/01 11:33:50 lwall
''' Baseline for release with 4.3bsd.
'''
.de Sh
.br
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.ie n \{\
.tr \(bs-\*(Tr
.ds -- \(bs-
.if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
.TH PNEWS 1 LOCAL
.SH NAME
Pnews - a program for posting news articles
.SH SYNOPSIS
.B Pnews newsgroup title
.br
or
.br
.B Pnews -h headerfile [oldarticle]
.br
or
.br
.B Pnews
.SH DESCRIPTION
Pnews is a friendly interface for posting news articles.
It will ask several questions, then allow you to enter your article,
and then post it using the inews(1) program.
If you type h and a carriage return at any point,
.I Pnews
will tell you what it wants to know.
.PP
The -h form is used when invoked from
.IR rn .
If your editor can edit multiple files, and you want the article to which
you are replying to show up as an alternate file, define the environment
variable NEWSPOSTER as \*(L"Pnews -h %h %A\*(R".
You can also modify the the NEWSHEADER environment variable to change the
header file that
.I rn
passes to Pnews.
.SH ENVIRONMENT
.IP AUTHORCOPY 8
If defined, contains the name of a file to which the finished article will
be appended.
.Sp
Default: article not saved
.IP DOTDIR 8
Where to find your dot files, if they aren't in your home directory.
This is primarily for accounts which are shared by more than one person.
.Sp
Default: $HOME
.IP EDITOR 8
The editor you want to use, if VISUAL is undefined.
.Sp
Default: whatever your news administrator installed, usually vi.
.IP HOME 8
Your home directory.
.Sp
Default: $LOGDIR
.IP LOGDIR 8
Your home directory if HOME is undefined.
.IP LOGNAME 8
Your login name, if USER is undefined.
.Sp
Default: value of \*(L"whoami\*(R".
.IP NAME 8
Your full name.
.Sp
Default: name from /etc/passwd, or ~/.fullname.
.IP ORGANIZATION 8
Either the name of your organization, or the name of a file containing the
name of your organization.
.Sp
Default: whatever your news administrator chose.
.IP USER 8
Your login name.
.Sp
Default: $LOGNAME
.IP VISUAL 8
The editor you want to use.
.Sp
Default: $EDITOR
.SH FILES
$DOTDIR/.article
.br
~/dead.article
.SH SEE ALSO
rn(1), Rnmail(1), inews(1)
.SH DIAGNOSTICS
.SH BUGS
Not the speediest program in the world, but maybe that's a blessing to the
net.
!STUFFY!FUNK!
echo Extracting NEW
cat >NEW <<'!STUFFY!FUNK!'
NEW FEATURES WITH RN/RRN 4.3
New commands
TAB (pager) scan for end of quoted text.
&& (anywhere) set or display macros.
Q (art level) exit this newsgroup but stay on it.
x (ng level) exit rn without changing .newsrc.
New switch
-=TERM-switch apply switch if terminal is TERM.
New environment variables
RNMACRO name of your macro and keymap file, if any.
SUBJLINE controls format of = article listing.
New % interpolations.
%I inclusion indicator (-F argument).
%m current mode of rn (newsgroup, pager, etc.)
%z length of current article.
%"prompt" prompt for input from keyboard.
%`command` same as shell backquotes.
^char now produces control-char.
Macros and Keymaps
You may now define macros of any reasonable length and map those
macros onto your keyboard in any way. You can completely remap the
keyboard if you wish. Macros may contain % interpolations.
Global RNINIT file
You can now set pseudo-environment variables on a system-wide basis
in the file %X/INIT. You don't have to recompile rn when you want
to try something different.
Pnews
Can append your .signature if you like.
Now knows how to mail to moderators.
Runs somewhat faster now when invoked with -h.
Will use %x/distributions if it exists.
Doesn't ask for Distribution on local newsgroups.
Doesn't ask for editor if EDITOR or VISUAL is set.
Terminal handling
-L switch uses erase-to-end-of-line to leave info on screen as long
as possible.
rn -c will not flush typeahead in your login script now.
In multi-character commands, \ now quotes the next character.
Support for non-line-buffered machines. Certain V7 machines will
appreciate the speedup.
Configure
Lets the poor people without job control do shell escapes.
Now remembers your old answers and uses them for defaults.
Searches much more widely for libraries.
Looks for Mcc or cc -M if it needs to.
Finds pg if it needs to. (Note, pg users: you can use macros to
reverse the sense of CR and SP in rn now.)
Figures out where manual pages go.
Figures out where mail is spooled.
Looks for ioctl.h, if any.
Determines if you have a builtin echo that works differently than
/bin/echo.
Asks if your mail takes Internet addresses.
Works reasonably on more systems, such as "Pyramids".
Miscellaneous
Commands may be typed directly to a help menu or subject list without
having to type 'q' first.
- command on first displayed article of a newsgroup takes you out to
the previous newsgroup. (Someday it will take you to the
previous article in the previous newsgroup.)
You can now easily get into a newsgroup with a KILL file and no
unread articles.
The catchup command at the top level now asks for confirmation.
Interpretation routines now check for output buffer overflow.
The pager no longer get hung up on non-initial ^L.
The negative unread articles bug was fixed.
Numerous small bug fixes.
!STUFFY!FUNK!
echo Extracting Rnmail.1
cat >Rnmail.1 <<'!STUFFY!FUNK!'
''' $Header: Rnmail.1,v 4.3.1.2 85/08/01 14:22:08 lwall Exp $
'''
''' $Log: Rnmail.1,v $
''' Revision 4.3.1.2 85/08/01 14:22:08 lwall
''' Added MAILRECORD, DOTDIR.
'''
''' Revision 4.3.1.1 85/05/10 11:30:44 lwall
''' Branch for patches.
'''
''' Revision 4.3 85/05/01 11:34:28 lwall
''' Baseline for release with 4.3bsd.
'''
.de Sh
.br
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.ie n \{\
.tr \(bs-\*(Tr
.ds -- \(bs-
.if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
.TH RNMAIL 1 LOCAL
.SH NAME
Rnmail - a program for replying via mail
.SH SYNOPSIS
.B Rnmail destination_list
.br
or
.br
.B Rnmail -h headerfile [oldarticle]
.br
or
.br
.B Rnmail
.SH DESCRIPTION
Rnmail is a friendly interface for mailing replies to news articles.
It will ask several questions, then allow you to enter your letter,
and then mail it off.
If you type h and a carriage return at any point,
.I Rnmail
will tell you what it wants to know.
.PP
The -h form is used when invoked from
.IR rn .
If your editor can edit multiple files, and you want the article to which
you are replying to show up as an alternate file, define the environment
variable MAILPOSTER as \*(L"Rnmail -h %h %A\*(R".
You can also modify the the MAILHEADER environment variable to change the
header file that
.I rn
passes to Rnmail.
.SH ENVIRONMENT
.IP DOTDIR 8
If defined, specifies a place other than your home directory where 'dot' files
may be stored.
This is primarily for accounts which are shared by more than one person.
.Sp
Default: $HOME
.IP EDITOR 8
The editor you want to use, if VISUAL is undefined.
.Sp
Default: whatever your news administrator installed, usually vi.
.IP HOME 8
Your home directory.
.Sp
Default: $LOGDIR
.IP LOGDIR 8
Your home directory if HOME is undefined.
.IP LOGNAME 8
Your login name, if USER is undefined.
.Sp
Default: value of \*(L"whoami\*(R".
.IP MAILRECORD 8
If defined, contains the name of a file to which the finished message will
be appended.
.Sp
Default: message not saved
.IP ORGANIZATION 8
Either the name of your organization, or the name of a file containing the
name of your organization.
.Sp
Default: whatever your news administrator chose.
.IP USER 8
Your login name.
.Sp
Default: $LOGNAME
.IP VISUAL 8
The editor you want to use.
.Sp
Default: $EDITOR
.SH FILES
$DOTDIR/.letter
.br
~/dead.letter
.SH SEE ALSO
rn(1), Pnews(1), mail(1)
.SH DIAGNOSTICS
.SH BUGS
Uses /bin/mail in the absence of sendmail.
!STUFFY!FUNK!
echo Extracting ngsrch.c
cat >ngsrch.c <<'!STUFFY!FUNK!'
/* $Header: ngsrch.c,v 4.3 85/05/01 11:44:51 lwall Exp $
*
* $Log: ngsrch.c,v $
* Revision 4.3 85/05/01 11:44:51 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#include "rcstuff.h"
#include "final.h"
#include "search.h"
#include "rn.h"
#include "util.h"
#include "term.h"
#include "rcln.h"
#include "INTERN.h"
#include "ngsrch.h"
#ifdef NGSORONLY
COMPEX ngcompex;
#endif
void
ngsrch_init()
{
#ifdef ZEROGLOB
init_compex(&ngcompex);
#endif /* ZEROGLOB */
;
}
#ifdef NGSEARCH
int
ng_search(patbuf,get_cmd)
char *patbuf; /* if patbuf != buf, get_cmd must */
int get_cmd; /* be set to FALSE!!! */
{
char *pattern; /* unparsed pattern */
register char cmdchr = *patbuf; /* what kind of search? */
register char *s;
bool backward = cmdchr == '?'; /* direction of search */
int_count = 0;
if (get_cmd && buf == patbuf)
if (!finish_command(FALSE)) /* get rest of command */
return NGS_ABORT;
for (pattern = patbuf+1; *pattern == ' '; pattern++) ;
if (*pattern) {
ng_doread = FALSE;
}
s = rindex(pattern,cmdchr);
if (s != Nullch && *(s-1) != '\\') {
*s++ = '\0';
if (index(s,'r') != Nullch)
ng_doread = TRUE;
}
if ((s = ng_comp(&ngcompex,pattern,TRUE,TRUE)) != Nullch) {
/* compile regular expression */
printf("\n%s\n",s) FLUSH;
return NGS_ABORT;
}
fputs("\nSearching...",stdout) FLUSH; /* give them something to read */
fflush(stdout);
for (;;) {
if (int_count) {
int_count = 0;
return NGS_INTR;
}
if (backward) {
if (ng > 0)
--ng;
else
ng = nextrcline;
}
else {
if (ng >= nextrcline)
ng = 0;
else
++ng;
}
if (ng == current_ng)
return NGS_NOTFOUND;
if (ng == nextrcline || toread[ng] < TR_NONE || !ng_wanted())
continue;
if (toread[ng] == TR_NONE)
set_toread(ng);
if (toread[ng] > TR_NONE)
return NGS_FOUND;
else if (toread[ng] == TR_NONE)
if (ng_doread)
return NGS_FOUND;
else
printf("\n[0 unread in %s--skipping]",rcline[ng]) FLUSH;
}
}
bool
ng_wanted()
{
return execute(&ngcompex,rcline[ng]) != Nullch;
}
#endif
#ifdef NGSORONLY
char *
ng_comp(compex,pattern,RE,fold)
COMPEX *compex;
char *pattern;
bool RE;
bool fold;
{
char ng_pattern[128];
register char *s = pattern, *d = ng_pattern;
if (!*s)
return Nullch; /* reuse old pattern */
for (; *s; s++) {
if (*s == '.') {
*d++ = '\\';
*d++ = *s;
}
else if (*s == '?') {
*d++ = '.';
}
else if (*s == '*') {
*d++ = '.';
*d++ = *s;
}
else if (strnEQ(s,"all",3)) {
*d++ = '.';
*d++ = '*';
s += 2;
}
else
*d++ = *s;
}
*d = '\0';
return compile(compex,ng_pattern,RE,fold);
}
#endif
!STUFFY!FUNK!
echo Extracting art.help.SH
cat >art.help.SH <<'!STUFFY!FUNK!'
case $CONFIG in
'') . config.sh ;;
esac
echo "Extracting art.help (with variable substitutions)"
$spitshell >art.help <<!GROK!THIS!
$startsh
# $Header: art.help.SH,v 4.3 85/05/01 11:35:34 lwall Exp $
#
# $Log: art.help.SH,v $
# Revision 4.3 85/05/01 11:35:34 lwall
# Baseline for release with 4.3bsd.
#
#
$pager <<'EOT'
Article Selection commands:
n,SP Scan forward for next unread article.
N Go to next article.
^N Scan forward for next unread article with same subject.
p,P,^P Same as n,N,^N, only going backwards.
- Go to previously displayed article.
number Go to specified article.
range{,range} command{:command}
Apply one or more commands to one or more ranges of articles.
Ranges are of the form: number | number-number. You may use . for
the current article, and $ for the last article.
Valid commands are: j, m, M, s, S, and !.
/pattern/modifiers
Scan forward for article containing pattern in the subject line.
(Use ?pat? to scan backwards; append h to scan headers, a to scan
entire articles, r to scan read articles, c to make case sensitive.
/pattern/modifiers:command{:command}
Apply one or more commands to the set of articles matching pattern.
Use a K modifier to save entire command to the KILL file for this
newsgroup. Commands m and M, if first, imply an r modifier.
Valid commands are: j, m, M, s, S, and !.
f,F Submit a followup article (F = include this article).
r,R Reply through net mail (R = include this article).
s ... Save to file or pipe via sh.
S ... Save via preferred shell.
w,W Like s and S but save without the header.
| ... Same as s|...
C Cancel this article, if yours.
^R,v Restart article (v=verbose).
^X Restart article, rot13 mode.
c Catch up (mark all articles as read).
^B Back up one page.
^L Refresh the screen. You can get back to the pager with this.
X Refresh screen in rot13 mode.
^ Go to first unread article. Disables subject search mode.
$ Go to end of newsgroup. Disables subject search mode.
# Print last article number.
& Print current values of command-line switches.
&switch {switch}
Set or unset more switches.
&& Print current macro definitions.
&&def Define a new macro.
j Junk this article (mark it read). Stays at end of article.
m Mark article as still unread.
M Mark article as still unread upon exiting newsgroup or Y command.
Y Yank back articles marked temporarily read via M.
k Mark current SUBJECT as read.
K Mark current SUBJECT as read, and save command in KILL file.
= List subjects of unread articles.
u Unsubscribe to this newsgroup.
^K Edit local KILL file (the one for this newsgroup).
q Quit this newsgroup for now.
Q Quit newsgroup, staying at current newsgroup.
EOT
!GROK!THIS!
$eunicefix art.help
chmod 755 art.help
!STUFFY!FUNK!
echo Extracting newsgroups.SH
cat >newsgroups.SH <<'!STUFFY!FUNK!'
case $CONFIG in
'') . ./config.sh ;;
esac
echo "Extracting newsgroups (with variable substitutions)"
$spitshell >newsgroups <<!GROK!THIS!
$startsh
# $Header: newsgroups.SH,v 4.3.2.7 90/04/23 19:30:41 sob Exp $
#
# $Log: newsgroups.SH,v $
# Revision 4.3.2.7 90/04/23 19:30:41 sob
# Extra space removed to make second part of newsgroups work.
# Sigh.
#
# Revision 4.3.2.6 90/04/06 20:35:37 sob
# Added fixes for SCO Xenix sent by ronald@robobar.co.uk.
#
# Revision 4.3.2.5 90/03/17 17:27:00 sob
# System V sed and BSD sed don't work quite alike. This change uses a
# syntax that is common between them.
#
# Revision 4.3.2.4 89/11/08 01:13:35 sob
# Finished modifications to make work with RN and RRN
#
# Revision 4.3.2.3 89/11/07 22:58:04 sob
# Added final changes to allow rn and rrn to be built from same sources.
#
# Revision 4.3.2.2 89/11/07 22:52:22 sob
# Added prelimiary support to allow both rrn and rn to be built from same
# sources.
#
# Revision 4.3.2.1 89/11/06 01:04:39 sob
# Added RRN support from NNTP 1.5
#
# Revision 4.3 85/05/01 11:43:27 lwall
# Baseline for release with 4.3bsd.
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
: syntax: newsgroups [pattern] [pipeflag]
: System Dependencies
: You might want to change pager to a "make column" program if you have one.
: On the other hand, if your kernel does paging, cat would probably do.
pager="${pager-/usr/ucb/more}"
#NORMALactive="${active-/usr/lib/news/active}"
#NORMALcase \$active in
#NORMAL~*) active=\`$filexp \$active\` ;;
#NORMALesac
#NNTPactive="/tmp/active.\$\$"
: End of system dependencies, hopefully
#NNTP$rnlib/getactive \$active
if $test \$# -ge 2 ; then
pager=$cat
else
$echo "Completely unsubscribed newsgroups:"
fi
dotdir=\${DOTDIR-\${HOME-\$LOGDIR}}
: Throwing .newsrc into the pot twice is a lovely hack to prevent
: bogus newsgroups from showing up as unsubscribed.
$cat \$dotdir/.newsrc \$dotdir/.newsrc \$active | \\
$sed -n -e '/^options/d' \\
-e '/^[ ]/d' \\
-e '/^control/d' \\
-e '/^to\./d' \\
-e 's/^\([^ !:]*\)[ !:].*\$/\1/' \\
-e "/.*\$1/p" | \\
$sort | $uniq -u | \$pager
if $test \$# -ge 2 ; then
exit
fi
$echo $n "[Type return to continue] $c"
read tmp
$echo ""
$echo "Unsubscribed but mentioned in .newsrc:"
$sed -n < \$dotdir/.newsrc \\
-e "/\$1.*!/"'s/^\([^!]*\)!.*\$/\1/p' | \\
$sort | \$pager
!GROK!THIS!
case "$isrrn" in
define) sed < newsgroups -e '/^#NNTP/s/^#NNTP//' -e '/^#NORMAL/d' > newsgroups.new ;;
*) sed < newsgroups -e '/^#NNTP/d' -e '/^#NORMAL/s/^#NORMAL//' > newsgroups.new ;;
esac
mv newsgroups.new newsgroups
$eunicefix newsgroups
chmod 755 newsgroups
!STUFFY!FUNK!
echo Extracting makedepend.SH
cat >makedepend.SH <<'!STUFFY!FUNK!'
case $CONFIG in
'') . ./config.sh ;;
esac
echo "Extracting makedepend (with variable substitutions)"
$spitshell >makedepend <<!GROK!THIS!
$startsh
# $Header: makedepend.SH,v 4.3.2.2 90/04/21 14:24:58 sob Exp $
#
# $Log: makedepend.SH,v $
# Revision 4.3.2.2 90/04/21 14:24:58 sob
# Added a fix to deal with XENIX cc -E output.
#
# Revision 4.3.2.1 89/12/17 02:52:46 sob
# Will only read config.sh from local directory.
#
# Revision 4.3.1.2 85/05/13 15:53:42 lwall
# Made cpp look in /usr/local/include too.
#
# Revision 4.3.1.1 85/05/10 11:35:10 lwall
# Branch for patches.
#
# Revision 4.3 85/05/01 11:42:26 lwall
# Baseline for release with 4.3bsd.
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
$cat /dev/null >.deptmp
$echo "(Note: this is going to take a while.)"
$rm -f X*.c
for file in *.c; do
filebase=\`basename \$file .c\`
$echo "Finding dependencies for \$filebase.o."
$sed -n <\$file >X\$file \\
-e "/^\${filebase}_init(/q" \\
-e '/^#/{' \\
-e 's|/\*.*$||' \\
-e p \\
-e '}'
$cpp -I/usr/local/include X\$file | $sed \\
-e '/^#line/s/line//' \
-e '/^# *[0-9]/!d' \\
-e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
-e 's|: \./|: |' \\
-e 's|: X|: |' | \\
$uniq | $sort | $uniq >> .deptmp
done
for file in *.SH; do
$echo \`basename \$file .SH\`: \$file config.sh \; /bin/sh \$file >> .deptmp
done
$sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
if $test -s .deptmp; then
echo "Updating Makefile..."
echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new
$cat .deptmp >>Makefile.new
else
$echo "You don't seem to have a proper C preprocessor. Using grep instead."
$egrep '^#include ' *.c *.h >.deptmp
echo "Updating Makefile..."
<.deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' >> Makefile.new
<.deptmp $sed -n 's|c:#include <\(.*\)>.*\$\$|o: /usr/include/\1|p' >> Makefile.new
<.deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> Makefile.new
<.deptmp $sed -n 's|h:#include <\(.*\)>.*\$\$|h: /usr/include/\1|p' >> Makefile.new
fi
$mv Makefile Makefile.old
$mv Makefile.new Makefile
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
rm .deptmp X*.c
!GROK!THIS!
$eunicefix makedepend
chmod 755 makedepend
!STUFFY!FUNK!
echo Extracting ndir.h
cat >ndir.h <<'!STUFFY!FUNK!'
/* $Header: ndir.h,v 4.3.2.1 90/04/17 15:28:13 sob Exp $
*
* $Log: ndir.h,v $
* Revision 4.3.2.1 90/04/17 15:28:13 sob
* Altered to include correct directory include file.
*
* Revision 4.3 85/05/01 11:43:00 lwall
* Baseline for release with 4.3bsd.
*
*/
#ifdef LIBNDIR
# include <ndir.h>
#else
# ifndef USENDIR
# include DIRINC
# else
#ifndef DEV_BSIZE
#define DEV_BSIZE 512
#endif
#define DIRBLKSIZ DEV_BSIZE
#define MAXNAMLEN 255
struct direct {
long d_ino; /* inode number of entry */
short d_reclen; /* length of this record */
short d_namlen; /* length of string in d_name */
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
};
/*
* The DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/
#undef DIRSIZ
#define DIRSIZ(dp) \
((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
/*
* Definitions for library routines operating on directories.
*/
typedef struct _dirdesc {
int dd_fd;
long dd_loc;
long dd_size;
char dd_buf[DIRBLKSIZ];
} DIR;
#ifndef NULL
#define NULL 0
#endif
extern DIR *opendir();
extern struct direct *readdir();
extern long telldir();
extern void seekdir();
#define rewinddir(dirp) seekdir((dirp), (long)0)
extern void closedir();
# endif
#endif
!STUFFY!FUNK!
echo ""
echo "End of kit 8 (of 9)"
cat /dev/null >kit8isdone
config=true
for iskit in 1 2 3 4 5 6 7 8 9 ; do
if test -f kit${iskit}isdone; then
echo "You have run kit ${iskit}."
else
echo "You still need to run kit ${iskit}."
config=false
fi
done
case $config in
true)
echo "You have run all your kits. Please read README and then type Configure."
chmod 755 Configure
;;
esac
: I do not append .signature, but someone might mail this.
exit