Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!munnari.oz.au!basser!ultima!nick From: nick@ultima.cs.uts.oz (Nick Andrew) Newsgroups: comp.os.minix Subject: News for Minix (part 9 of 12) Keywords: news Message-ID: <16751@ultima.cs.uts.oz> Date: 7 Dec 89 11:54:39 GMT Organization: Comp Sci, NSWIT, Australia Lines: 2151 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Makefile.minix' <<'END_OF_FILE' X# '@(#)Makefile.minix 1.23 3/23/87' X# Makefile for Minix. X# This is converted to USG/v7/etc by localize.sh X# which should at least be a copy of localize.v7 or localize.usg X X# definitions X XOSTYPE = v7 X X# HOME is the user name whose home dir has all the news stuff in it. XHOME= news X# Use the -DHOME line if you want dynamic lookup in /etc/passwd X#HOMENAME= -DHOME=\"$(HOME)\" XHOMENAME= X XNEWSUSR = news XNEWSGRP = news XSPOOLDIR = /usr/spool/news XBATCHDIR = /usr/spool/batch XLIBDIR = /usr/lib/news XBINDIR = /usr/local/bin XDESTDIR = XUUXFLAGS = -r -z -n -gd X XLNRNEWS = ln XDEBUG = XSCCSID = -DSCCSID XDEFS = -DRNEWS=\"$(BINDIR)/rnews\" -DSPOOLDIR=\"$(SPOOLDIR)\" \ X -DBATCHDIR=\"$(BATCHDIR)\" -DLIBDIR=\"$(LIBDIR)\" \ X -DBINDIR=\"$(BINDIR)\" -DNEWSUSR=\"$(NEWSUSR)\" \ X -DNEWSGRP=\"$(NEWSGRP)\" X X# Order is important here XINSCOMPRESS= XCOMPRESS= compress X XVFORK=-Dvfork=fork X X X# Originally CFLAGS = ${DEBUG} -O -DDBM ${DEFS} ${SCCSID} ${VFORK} XCFLAGS = ${DEBUG} -O -DMINIX ${DEFS} ${SCCSID} ${VFORK} XLFLAGS = ${DEBUG} -i XSRCHLIBS = -lcio X# originally: LIBS = -ldbm XLIBS = XLINTFLAGS = -chba -DDBM ${DEFS} X XTERMLIB = -ltermlib XFIXACTIVE = X X XMISC = uname.s ftime.s XOBJECTS = funcs.s funcs2.s getdate.s header.s ndir.s $(MISC) XIOBJECTS = inews.s ifuncs.s iextern.s control.s fullname.s \ X ipathinit.s $(OBJECTS) X XPOBJECTS = postnews.s rextern.s rpathinit.s funcs.s $(MISC) XROBJECTS = readnews.s rfuncs.s rfuncs2.s rextern.s readr.s \ X process.s rpathinit.s digest.s $(OBJECTS) XVOBJECTS = readnews.s rfuncs.s rfuncs2.s rextern.s process.s rpathinit.s \ X $(OBJECTS) visual.s virtterm.s XEXPOBJS = expire.s header.s funcs.s getdate.s iextern.s epathinit.s \ X funcs2.s ndir.s $(MISC) X XSRCS = funcs.c funcs2.c header.c XISRCS = inews.c ifuncs.c iextern.c control.c fullname.c $(SRCS) XPSRCS = postnews.c rextern.c funcs.c XRSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c readr.c process.c \ X digest.c $(SRCS) XVSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c process.c $(SRCS) \ X visual.c virtterm.c XESRCS = expire.c header.c funcs.c iextern.c \ X funcs2.c XOSRCS = uurec.c recnews.c sendnews.c batch.c unbatch.c \ X recmail.c compress.c X XUTILS = inews uurec recnews sendnews expire batch unbatch recmail \ X encode decode $(COMPRESS) XSCRIPTS = sendbatch rmgroup checkgroups XOTHERS = $(UTILS) $(SCRIPTS) X X# Cannot get readnews to work due to asld bug X# Cannot get vnews to work due to being too lazy X#COMMANDS = readnews checknews postnews vnews XCOMMANDS = checknews postnews X X# dependencies Xall: $(OTHERS) $(COMMANDS) X Xinstall: all help vnews.help X -mkdir $(DESTDIR)$(BINDIR) X -mkdir $(DESTDIR)$(LIBDIR) X cp $(COMMANDS) $(DESTDIR)$(BINDIR) X -cd $(DESTDIR)$(BINDIR); \ X chown $(NEWSUSR) $(COMMANDS); \ X chgrp $(NEWSGRP) $(COMMANDS); \ X chmod 755 $(COMMANDS) X cp help vnews.help $(OTHERS) $(DESTDIR)$(LIBDIR) X cd $(DESTDIR)$(LIBDIR); \ X chown $(NEWSUSR) $(OTHERS); \ X chgrp $(NEWSGRP) $(OTHERS); \ X chmod 755 $(OTHERS) X -rm -f $(DESTDIR)$(BINDIR)/rnews $(DESTDIR)$(BINDIR)/inews X ${LNRNEWS} $(DESTDIR)$(LIBDIR)/inews $(DESTDIR)$(BINDIR)/rnews X chown $(NEWSUSR) $(DESTDIR)$(LIBDIR)/inews X chgrp $(NEWSGRP) $(DESTDIR)$(LIBDIR)/inews X chmod 6755 $(DESTDIR)$(LIBDIR)/inews $(DESTDIR)$(BINDIR)/rnews X $(INSCOMPRESS) X Xbindir: $(COMMANDS) X cp $(COMMANDS) $(DESTDIR)$(BINDIR) X -cd $(DESTDIR)$(BINDIR); \ X chown $(NEWSUSR) $(COMMANDS); \ X chgrp $(NEWSGRP) $(COMMANDS); \ X chmod 755 $(COMMANDS) X X X# defs.h: defs.dist localize.sh X# sh localize.sh X# @echo Localize has been run. Restart the make. X# @exit 1 X X# Makefile: localize.sh Makefile.dst X# sh localize.sh X# @echo Localize has been run. Restart the make. X# @exit 1 X Xupdate: install.sh makeactive.sh X sh install.sh $(SPOOLDIR) $(LIBDIR) $(BINDIR) $(NEWSUSR) $(NEWSGRP) $(OSTYPE) X chmod 6755 $(LIBDIR)/inews X Xclean: X rm -f $(COMMANDS) $(OTHERS) *.s a.out X rm -f core index errs X Xinews: $(IOBJECTS) X $(CC) -T. $(LFLAGS) $(IOBJECTS) $(SRCHLIBS) -o inews $(LIBS) X cp inews $(LIBDIR) X Xreadnews: $(ROBJECTS) X $(CC) $(LFLAGS) $(ROBJECTS) $(SRCHLIBS) -o readnews $(LIBS) X Xfuncs.s: funcs.c params.h defs.h header.h X $(CC) $(CFLAGS) -c funcs.c X Xfuncs2.s: funcs2.c params.h defs.h header.h X $(CC) $(CFLAGS) -c funcs2.c X X# getdate.s: getdate.c defs.h X# @echo "expect 8 shift/reduce conflicts" X# @echo yacc getdate.y X# @echo mv y.tab.c getdate.c X# $(CC) $(CFLAGS) -c getdate.c X# @echo -rm -f getdate.c X Xinews.s: inews.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c inews.c X Xifuncs.s: ifuncs.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c ifuncs.c X Xiextern.s: iextern.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c iextern.c X Xpostnews: $(POBJECTS) X $(CC) $(CFLAGS) $(LFLAGS) $(POBJECTS) $(SRCHLIBS) -o postnews X Xpostnews.s: postnews.c defs.h params.h header.h X $(CC) $(CFLAGS) -c postnews.c X Xreadnews.s: readnews.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c readnews.c X Xrfuncs.s: rfuncs.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rfuncs.c X Xrfuncs2.s: rfuncs2.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rfuncs2.c X Xrextern.s: rextern.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rextern.c X Xreadr.s: readr.c rparams.h defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c readr.c X Xchecknews.s: checknews.c defs.h header.h params.h X $(CC) $(CFLAGS) -c checknews.c X Xvnews: $(VOBJECTS) X $(CC) $(LFLAGS) $(VOBJECTS) $(TERMLIB) $(LIBS) $(SRCHLIBS) -o $@ X Xvisual.s: visual.c rparams.h defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c visual.c X Xcontrol.s: control.c defs.h iparams.h params.h header.h X $(CC) $(CFLAGS) -c control.c X Xlogdir.s: logdir.c X $(CC) $(CFLAGS) -c logdir.c X Xftime.s: ftime.c X $(CC) $(CFLAGS) -c ftime.c X Xuname.s: uname.c defs.h params.h header.h X $(CC) $(CFLAGS) -c uname.c X Xndir.s: ndir.c ndir.h defs.h X $(CC) $(CFLAGS) -c ndir.c X Xuurec: uurec.c defs.h X $(CC) $(CFLAGS) $(LFLAGS) uurec.c $(SRCHLIBS) -o uurec X Xrecnews: recnews.c defs.h header.h X $(CC) $(CFLAGS) $(LFLAGS) recnews.c $(SRCHLIBS) -o recnews X Xsendnews: sendnews.s X $(CC) $(LFLAGS) sendnews.s $(SRCHLIBS) -o sendnews X Xbatch: batch.c defs.h X $(CC) $(CFLAGS) $(LFLAGS) batch.c $(SRCHLIBS) -o batch X chmem =6144 batch X Xunbatch: unbatch.c X $(CC) $(CFLAGS) $(LFLAGS) unbatch.c $(SRCHLIBS) -o unbatch X chmem =6144 unbatch X Xencode: encode.c X $(CC) $(CFLAGS) $(LFLAGS) encode.c $(SRCHLIBS) -o encode X Xdecode: decode.c X $(CC) $(CFLAGS) $(LFLAGS) decode.c $(SRCHLIBS) -o decode X X# caesar: caesar.c X# $(CC) $(CFLAGS) $(LFLAGS) caesar.c $(SRCHLIBS) -o caesar -lm X Xcompress: compress.c X $(CC) $(CFLAGS) $(LFLAGS) $(SRCHLIBS) -o compress compress.c X Xrecmail: recmail.c defs.h params.h header.h X $(CC) $(CFLAGS) $(LFLAGS) recmail.c $(SRCHLIBS) -o recmail X Xprocess.s: process.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c process.c X Xchecknews: checknews.s process.s cpathinit.s rextern.s X $(CC) $(LFLAGS) checknews.s process.s cpathinit.s rextern.s $(SRCHLIBS) -o checknews X Xsendbatch: sendbatch.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" \ X -e "s%UUXFLAGS%$(UUXFLAGS)%g" \ X -e "s%BATCHDIR%$(BATCHDIR)%g" sendbatch.sh > sendbatch X Xrmgroup: rmgroup.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" \ X -e "s%FIXACTIVE%$(FIXACTIVE)%g" \ X -e "s%SPOOLDIR%$(SPOOLDIR)%g" rmgroup.sh > rmgroup X Xcheckgroups: checkgroups.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" checkgroups.sh > checkgroups X Xsendnews.s: sendnews.c defs.h X $(CC) $(CFLAGS) -c sendnews.c X Xfullname.s: fullname.c defs.h params.h header.h X $(CC) $(CFLAGS) -c fullname.c X Xexpire: $(EXPOBJS) X $(CC) $(LFLAGS) $(EXPOBJS) $(SRCHLIBS) -o expire $(LIBS) X Xheader.s: header.c header.h defs.h patchlevel.h params.h X $(CC) $(CFLAGS) -c header.c X Xexpire.s: expire.c defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c expire.c X Xdigest.s: digest.c rparams.h X $(CC) -DMINIX -c digest.c X X# Some silliness here to get pathinit for both readnews & inews Xrpathinit.s: pathinit.c rparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DREAD -c pathinit.c X mv pathinit.s rpathinit.s X Xipathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DINEW -c pathinit.c X mv pathinit.s ipathinit.s X Xcpathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DCHKN -c pathinit.c X mv pathinit.s cpathinit.s X Xepathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DEXP -c pathinit.c X mv pathinit.s epathinit.s X Xtags: /tmp X ctags -w *.h *.c X END_OF_FILE if test 8385 -ne `wc -c <'Makefile.minix'`; then echo shar: \"'Makefile.minix'\" unpacked with wrong size! fi # end of 'Makefile.minix' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(8385 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# '@(#)Makefile.minix 1.23 3/23/87' X# Makefile for Minix. X# This is converted to USG/v7/etc by localize.sh X# which should at least be a copy of localize.v7 or localize.usg X X# definitions X XOSTYPE = v7 X X# HOME is the user name whose home dir has all the news stuff in it. XHOME= news X# Use the -DHOME line if you want dynamic lookup in /etc/passwd X#HOMENAME= -DHOME=\"$(HOME)\" XHOMENAME= X XNEWSUSR = news XNEWSGRP = news XSPOOLDIR = /usr/spool/news XBATCHDIR = /usr/spool/batch XLIBDIR = /usr/lib/news XBINDIR = /usr/local/bin XDESTDIR = XUUXFLAGS = -r -z -n -gd X XLNRNEWS = ln XDEBUG = XSCCSID = -DSCCSID XDEFS = -DRNEWS=\"$(BINDIR)/rnews\" -DSPOOLDIR=\"$(SPOOLDIR)\" \ X -DBATCHDIR=\"$(BATCHDIR)\" -DLIBDIR=\"$(LIBDIR)\" \ X -DBINDIR=\"$(BINDIR)\" -DNEWSUSR=\"$(NEWSUSR)\" \ X -DNEWSGRP=\"$(NEWSGRP)\" X X# Order is important here XINSCOMPRESS= XCOMPRESS= compress X XVFORK=-Dvfork=fork X X X# Originally CFLAGS = ${DEBUG} -O -DDBM ${DEFS} ${SCCSID} ${VFORK} XCFLAGS = ${DEBUG} -O -DMINIX ${DEFS} ${SCCSID} ${VFORK} XLFLAGS = ${DEBUG} -i XSRCHLIBS = -lcio X# originally: LIBS = -ldbm XLIBS = XLINTFLAGS = -chba -DDBM ${DEFS} X XTERMLIB = -ltermlib XFIXACTIVE = X X XMISC = uname.s ftime.s XOBJECTS = funcs.s funcs2.s getdate.s header.s ndir.s $(MISC) XIOBJECTS = inews.s ifuncs.s iextern.s control.s fullname.s \ X ipathinit.s $(OBJECTS) X XPOBJECTS = postnews.s rextern.s rpathinit.s funcs.s $(MISC) XROBJECTS = readnews.s rfuncs.s rfuncs2.s rextern.s readr.s \ X process.s rpathinit.s digest.s $(OBJECTS) XVOBJECTS = readnews.s rfuncs.s rfuncs2.s rextern.s process.s rpathinit.s \ X $(OBJECTS) visual.s virtterm.s XEXPOBJS = expire.s header.s funcs.s getdate.s iextern.s epathinit.s \ X funcs2.s ndir.s $(MISC) X XSRCS = funcs.c funcs2.c header.c XISRCS = inews.c ifuncs.c iextern.c control.c fullname.c $(SRCS) XPSRCS = postnews.c rextern.c funcs.c XRSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c readr.c process.c \ X digest.c $(SRCS) XVSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c process.c $(SRCS) \ X visual.c virtterm.c XESRCS = expire.c header.c funcs.c iextern.c \ X funcs2.c XOSRCS = uurec.c recnews.c sendnews.c batch.c unbatch.c \ X recmail.c compress.c X XUTILS = inews uurec recnews sendnews expire batch unbatch recmail \ X encode decode $(COMPRESS) XSCRIPTS = sendbatch rmgroup checkgroups XOTHERS = $(UTILS) $(SCRIPTS) X X# Cannot get readnews to work due to asld bug X# Cannot get vnews to work due to being too lazy X#COMMANDS = readnews checknews postnews vnews XCOMMANDS = checknews postnews X X# dependencies Xall: $(OTHERS) $(COMMANDS) X Xinstall: all help vnews.help X -mkdir $(DESTDIR)$(BINDIR) X -mkdir $(DESTDIR)$(LIBDIR) X cp $(COMMANDS) $(DESTDIR)$(BINDIR) X -cd $(DESTDIR)$(BINDIR); \ X chown $(NEWSUSR) $(COMMANDS); \ X chgrp $(NEWSGRP) $(COMMANDS); \ X chmod 755 $(COMMANDS) X cp help vnews.help $(OTHERS) $(DESTDIR)$(LIBDIR) X cd $(DESTDIR)$(LIBDIR); \ X chown $(NEWSUSR) $(OTHERS); \ X chgrp $(NEWSGRP) $(OTHERS); \ X chmod 755 $(OTHERS) X -rm -f $(DESTDIR)$(BINDIR)/rnews $(DESTDIR)$(BINDIR)/inews X ${LNRNEWS} $(DESTDIR)$(LIBDIR)/inews $(DESTDIR)$(BINDIR)/rnews X chown $(NEWSUSR) $(DESTDIR)$(LIBDIR)/inews X chgrp $(NEWSGRP) $(DESTDIR)$(LIBDIR)/inews X chmod 6755 $(DESTDIR)$(LIBDIR)/inews $(DESTDIR)$(BINDIR)/rnews X $(INSCOMPRESS) X Xbindir: $(COMMANDS) X cp $(COMMANDS) $(DESTDIR)$(BINDIR) X -cd $(DESTDIR)$(BINDIR); \ X chown $(NEWSUSR) $(COMMANDS); \ X chgrp $(NEWSGRP) $(COMMANDS); \ X chmod 755 $(COMMANDS) X X X# defs.h: defs.dist localize.sh X# sh localize.sh X# @echo Localize has been run. Restart the make. X# @exit 1 X X# Makefile: localize.sh Makefile.dst X# sh localize.sh X# @echo Localize has been run. Restart the make. X# @exit 1 X Xupdate: install.sh makeactive.sh X sh install.sh $(SPOOLDIR) $(LIBDIR) $(BINDIR) $(NEWSUSR) $(NEWSGRP) $(OSTYPE) X chmod 6755 $(LIBDIR)/inews X Xclean: X rm -f $(COMMANDS) $(OTHERS) *.s a.out X rm -f core index errs X Xinews: $(IOBJECTS) X $(CC) -T. $(LFLAGS) $(IOBJECTS) $(SRCHLIBS) -o inews $(LIBS) X cp inews $(LIBDIR) X Xreadnews: $(ROBJECTS) X $(CC) $(LFLAGS) $(ROBJECTS) $(SRCHLIBS) -o readnews $(LIBS) X Xfuncs.s: funcs.c params.h defs.h header.h X $(CC) $(CFLAGS) -c funcs.c X Xfuncs2.s: funcs2.c params.h defs.h header.h X $(CC) $(CFLAGS) -c funcs2.c X X# getdate.s: getdate.c defs.h X# @echo "expect 8 shift/reduce conflicts" X# @echo yacc getdate.y X# @echo mv y.tab.c getdate.c X# $(CC) $(CFLAGS) -c getdate.c X# @echo -rm -f getdate.c X Xinews.s: inews.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c inews.c X Xifuncs.s: ifuncs.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c ifuncs.c X Xiextern.s: iextern.c iparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c iextern.c X Xpostnews: $(POBJECTS) X $(CC) $(CFLAGS) $(LFLAGS) $(POBJECTS) $(SRCHLIBS) -o postnews X Xpostnews.s: postnews.c defs.h params.h header.h X $(CC) $(CFLAGS) -c postnews.c X Xreadnews.s: readnews.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) $(HOMENAME) -c readnews.c X Xrfuncs.s: rfuncs.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rfuncs.c X Xrfuncs2.s: rfuncs2.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rfuncs2.c X Xrextern.s: rextern.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c rextern.c X Xreadr.s: readr.c rparams.h defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c readr.c X Xchecknews.s: checknews.c defs.h header.h params.h X $(CC) $(CFLAGS) -c checknews.c X Xvnews: $(VOBJECTS) X $(CC) $(LFLAGS) $(VOBJECTS) $(TERMLIB) $(LIBS) $(SRCHLIBS) -o $@ X Xvisual.s: visual.c rparams.h defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c visual.c X Xcontrol.s: control.c defs.h iparams.h params.h header.h X $(CC) $(CFLAGS) -c control.c X Xlogdir.s: logdir.c X $(CC) $(CFLAGS) -c logdir.c X Xftime.s: ftime.c X $(CC) $(CFLAGS) -c ftime.c X Xuname.s: uname.c defs.h params.h header.h X $(CC) $(CFLAGS) -c uname.c X Xndir.s: ndir.c ndir.h defs.h X $(CC) $(CFLAGS) -c ndir.c X Xuurec: uurec.c defs.h X $(CC) $(CFLAGS) $(LFLAGS) uurec.c $(SRCHLIBS) -o uurec X Xrecnews: recnews.c defs.h header.h X $(CC) $(CFLAGS) $(LFLAGS) recnews.c $(SRCHLIBS) -o recnews X Xsendnews: sendnews.s X $(CC) $(LFLAGS) sendnews.s $(SRCHLIBS) -o sendnews X Xbatch: batch.c defs.h X $(CC) $(CFLAGS) $(LFLAGS) batch.c $(SRCHLIBS) -o batch X chmem =6144 batch X Xunbatch: unbatch.c X $(CC) $(CFLAGS) $(LFLAGS) unbatch.c $(SRCHLIBS) -o unbatch X chmem =6144 unbatch X Xencode: encode.c X $(CC) $(CFLAGS) $(LFLAGS) encode.c $(SRCHLIBS) -o encode X Xdecode: decode.c X $(CC) $(CFLAGS) $(LFLAGS) decode.c $(SRCHLIBS) -o decode X X# caesar: caesar.c X# $(CC) $(CFLAGS) $(LFLAGS) caesar.c $(SRCHLIBS) -o caesar -lm X Xcompress: compress.c X $(CC) $(CFLAGS) $(LFLAGS) $(SRCHLIBS) -o compress compress.c X Xrecmail: recmail.c defs.h params.h header.h X $(CC) $(CFLAGS) $(LFLAGS) recmail.c $(SRCHLIBS) -o recmail X Xprocess.s: process.c rparams.h defs.h params.h header.h X $(CC) $(CFLAGS) -c process.c X Xchecknews: checknews.s process.s cpathinit.s rextern.s X $(CC) $(LFLAGS) checknews.s process.s cpathinit.s rextern.s $(SRCHLIBS) -o checknews X Xsendbatch: sendbatch.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" \ X -e "s%UUXFLAGS%$(UUXFLAGS)%g" \ X -e "s%BATCHDIR%$(BATCHDIR)%g" sendbatch.sh > sendbatch X Xrmgroup: rmgroup.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" \ X -e "s%FIXACTIVE%$(FIXACTIVE)%g" \ X -e "s%SPOOLDIR%$(SPOOLDIR)%g" rmgroup.sh > rmgroup X Xcheckgroups: checkgroups.sh X sed -e "s%LIBDIR%$(LIBDIR)%g" checkgroups.sh > checkgroups X Xsendnews.s: sendnews.c defs.h X $(CC) $(CFLAGS) -c sendnews.c X Xfullname.s: fullname.c defs.h params.h header.h X $(CC) $(CFLAGS) -c fullname.c X Xexpire: $(EXPOBJS) X $(CC) $(LFLAGS) $(EXPOBJS) $(SRCHLIBS) -o expire $(LIBS) X Xheader.s: header.c header.h defs.h patchlevel.h params.h X $(CC) $(CFLAGS) -c header.c X Xexpire.s: expire.c defs.h params.h ndir.h header.h X $(CC) $(CFLAGS) -c expire.c X Xdigest.s: digest.c rparams.h X $(CC) -DMINIX -c digest.c X X# Some silliness here to get pathinit for both readnews & inews Xrpathinit.s: pathinit.c rparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DREAD -c pathinit.c X mv pathinit.s rpathinit.s X Xipathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DINEW -c pathinit.c X mv pathinit.s ipathinit.s X Xcpathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DCHKN -c pathinit.c X mv pathinit.s cpathinit.s X Xepathinit.s: pathinit.c iparams.h header.h params.h defs.h X $(CC) $(CFLAGS) $(HOMENAME) -DEXP -c pathinit.c X mv pathinit.s epathinit.s X Xtags: /tmp X ctags -w *.h *.c X END_OF_FILE if test 8385 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'readnews.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'readnews.c'\" else echo shar: Extracting \"'readnews.c'\" \(7970 characters\) sed "s/^X//" >'readnews.c' <<'END_OF_FILE' X/* X * readnews - read news articles. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)readnews.c 2.32 3/21/87"; X#endif /* SCCSID */ X X#include "rparams.h" X X/* X * readnews - article reading program X */ X X#ifndef SYSBUF Xchar SYSBUF[BUFSIZ]; /* to buffer std out */ X#endif X X#define OPTION 0 /* pick up an option string */ X#define STRING 1 /* pick up a string of arguments */ X Xstruct timeb Now; X Xint onsig(), cleanup(); X X/* X * Authors: X * Matt Glickman ucbvax!glickman X * Mark Horton cbosg!mark X * Stephen Daniels duke!swd X * Tom Truscott duke!trt X */ X Xmain(argc, argv) Xint argc; Xregister char **argv; X{ X register char *ptr; /* pointer to rest of buffer */ X char *user = NULL, *home = NULL; X int optflag = FALSE, space = FALSE; X struct utsname ubuf; X char *myrc; X X /* set up defaults and initialize. */ X pathinit(); X mode = UNKNOWN; X header.title[0] = header.nbuf[0] = '\0'; X coptbuf[0] = datebuf[0] = '\0'; X uname(&ubuf); X strcpy(FROMSYSNAME, ubuf.nodename); X X savmask = umask(N_UMASK); /* set up mask */ X uid = getuid(); X gid = getgid(); X duid = 0; X dgid = 0; X (void) ftime(&Now); X X /* give reasonable error message if SPOOL directory X * is unaccessable... usually means system administrator X * has "turned off" news reading... X */ X if (access(SPOOL, 05)) X { X fputs("News articles are not available at this time\n",stderr); X xxit(1); X } X X#ifndef SHELL X if ((SHELL = getenv("SHELL")) == NULL) X SHELL = "/bin/sh"; X#endif X /* X * IHCC forces the use of 'getuser()' to prevent forgery of articles X * by just changing $LOGNAME X * Note that this shouldn't matter in readnews, since inews X * does all the actual posting of news. X */ X#ifndef IHCC X if ((user = getenv("USER")) == NULL) X user = getenv("LOGNAME"); X if ((home = getenv("HOME")) == NULL) X home = getenv("LOGDIR"); X#endif /* ! IHCC */ X if (user == NULL || home == NULL) X getuser(); X else { X username = AllocCpy(user); X (void) strcpy(header.path, username); X userhome = AllocCpy(home); X } X X if (!(MAILER = getenv("MAILER"))) X MAILER = "mail"; /* was /bin/mail */ X X#ifdef PAGE X if (myrc = getenv("PAGER")) X PAGER = AllocCpy(myrc); X else { X# ifdef IHCC X (void) sprintf(bfr, "%s/bin/%s", logdir(HOME), PAGE); X PAGER = AllocCpy(bfr); X# else /* !IHCC */ X PAGER = PAGE; X# endif /* !IHCC */ X } X#endif /* PAGE */ X X if (ptr = getenv("NEWSOPTS")) X (void) strcpy(rcbuf, ptr); X else X *rcbuf = '\0'; X if (*rcbuf) { X (void) strcat(rcbuf, " \1"); X ptr = rcbuf; X while (*++ptr) X if (isspace(*ptr)) X *ptr = '\0'; X for (ptr = rcbuf; ; ptr++) { X if (!*ptr) X continue; X if (*ptr == '\1') X break; X if (++line > LINES) X xerror("Too many options."); X if ((rcline[line] = malloc((unsigned)(strlen(ptr) + 1))) == NULL) X xerror("Not enough memory."); X argvrc[line] = rcline[line]; X (void) strcpy(rcline[line], ptr); X while (*ptr) X ptr++; X } X } X myrc = getenv("NEWSRC"); X if (myrc == NULL) { X myrc = NEWSRC; X (void) sprintf(newsrc, "%s/%s", userhome, myrc); X } else { X (void) strcpy(newsrc, myrc); X } X if (access(newsrc, 0)) X newrc(newsrc); X if ((rcfp = fopen(newsrc, "r")) != NULL) { X rcreadok = FALSE; X while (fgets(rcbuf, LBUFLEN, rcfp) != NULL) { X if (!(space = isspace(*rcbuf))) X optflag = FALSE; X if (!strncmp(rcbuf, "options ", 8)) X optflag = TRUE; X if (optflag) { X (void) strcat(rcbuf, "\1"); X if (space) X ptr = rcbuf - 1; X else X ptr = &rcbuf[7]; X while (*++ptr) X if (isspace(*ptr)) X *ptr = '\0'; X if (space) X ptr = rcbuf; X else X ptr = &rcbuf[8]; X for (; ; ptr++) { X if (!*ptr) X continue; X if (*ptr == '\1') X break; X if (++line > LINES) X xerror("Too many options."); X if ((rcline[line] = malloc((unsigned)(strlen(ptr) + 1))) == NULL) X xerror("Not enough memory."); X argvrc[line] = rcline[line]; X (void) strcpy(rcline[line], ptr); X while (*ptr) X ptr++; X } X } X } X (void) fclose(rcfp); X rcreadok = TRUE; X } X if (line != -1) { X#ifdef DEBUG X register int i; X for (i = 0; i <= line; i++) X fprintf(stderr, "options: %s\n", rcline[i]); X#endif X process(line + 2, argvrc); X do { X#ifdef DEBUG X fprintf(stderr, "Freeing %d\n", line); X#endif X free(rcline[line]); X } while (line--); X } X X argv++; X (void) strcat(header.nbuf, ADMSUB); X process(argc, argv); X if (!nflag) X (void) sprintf(header.nbuf, "%s,%s", ADMSUB, DFLTSUB); X else { X char *p = rindex(header.nbuf, ','); X if (p && p[1] == '\0') /* strip of trailing NGDELIM */ X *p ='\0'; X } X lcase(header.nbuf); X makehimask(header.nbuf, "junk"); X makehimask(header.nbuf, "control"); X makehimask(header.nbuf, "test"); X X setbuf(stdout, SYSBUF); X SigTrap = FALSE; /* true if a signal has been caught */ X if (!pflag && !lflag && !eflag) { X (void) signal(SIGQUIT, SIG_IGN); X (void) signal(SIGHUP, cleanup); X (void) signal(SIGINT, onsig); X (void) signal(SIGPIPE, onsig); X } else { X int (* old)(); X if ((old = signal(SIGQUIT, SIG_IGN)) != SIG_IGN) X (void) signal(SIGQUIT, cleanup); X if ((old = signal(SIGHUP, SIG_IGN)) != SIG_IGN) X (void) signal(SIGHUP, cleanup); X if ((old = signal(SIGINT, SIG_IGN)) != SIG_IGN) X (void) signal(SIGINT, cleanup); X } X X /* X * ALL of the command line has now been processed. (!) X */ X X if (!*header.nbuf) X strcpy(header.nbuf, DFLTSUB); X if (sflag) { X printf("Subscription list: %s\n", header.nbuf); X xxit(0); X } X if (xflag) X line = -1; X rcfp = xfopen(newsrc, "r"); X while (fgets(rcbuf, LBUFLEN, rcfp) != NULL) { X if (!nstrip(rcbuf)) X xerror(".newsrc line too long"); X if (++line >= LINES) X xerror("Too many .newsrc lines"); X if ((rcline[line] = malloc((unsigned)(strlen(rcbuf) + 1))) == NULL) X xerror("Not enough memory"); X (void) strcpy(rcline[line], rcbuf); X } X fclose(rcfp); X X if (SigTrap) { X if (SigTrap == SIGHUP || !rcreadok) X xxit(0); X fprintf(stdout, "Abort (n)? "); X (void) fflush(stdout); X if (gets(bfr) == NULL || *bfr == 'y' || *bfr == 'Y') X xxit(0); X SigTrap = FALSE; X } X sortactive(); X actfp = xfopen(ACTIVE, "r"); X X#ifdef DEBUG X fprintf(stderr, "header.nbuf = %s\n", header.nbuf); X#endif /* DEBUG */ X if (Kflag) X news++; X else { X switch (mode) { X case UNKNOWN: X readr(); X break; X#ifdef TMAIL X case MAIL: X Mail(); X break; X#endif /* TMAIL */ X } X } X X cleanup(0); X /*NOTREACHED*/ X} X Xcleanup(signo) X{ X extern short ospeed; X X (void) signal(SIGHUP, SIG_IGN); X (void) fflush(stdout); X if (news && !xflag && !lflag && !tflag) { X if (*groupdir && mode != MAIL) X updaterc(); X writeoutrc(); X } X /* X * stop vnews from clearing the screen if we're X * killed by a hangup X */ X if (signo == SIGHUP) X ospeed = 0; X xxit(0); X} X X/* X * Write out the .newsrc file. It's already been cleaned up by sortactive() X * Take care that data is all written, and flushed, before we destroy the X * old copy. X */ Xwriteoutrc() X{ X FILE *wrcfp; X char aline[BUFLEN]; X register int i; X X /* NEVER write it out if xflag */ X if (xflag || !rcreadok) X return; X X (void) strcpy(aline, newsrc); X (void) strcat(aline, ".new"); X X#ifdef VMS X (void) vmsdelete(aline); X#endif X wrcfp = xfopen(aline, "w"); X X for (i = 0; i <= line; i++) { X if (rcline[i] != NULL) X if (fprintf(wrcfp, "%s\n", rcline[i]) < 0) X goto fouled; X } X if (fclose(wrcfp) < 0) X goto fouled; X X#ifdef VMS X (void) vmsdelete(newsrc); X#endif X if (rename(aline, newsrc) < 0) X xerror("Cannot rename %s to %s", aline, newsrc); X return; X X fouled: X xerror("Error writing new .newsrc file - no changes made\n"); X return; X} X X/* X * Forbid newsgroup ng, unless he asked for it in nbuf. X */ Xmakehimask(nbuf, ng) Xchar *nbuf, *ng; X{ X if (!findex(nbuf, ng)) X (void) sprintf(rindex(nbuf, '\0'), ",!%s", ng); X} X X/* X * Return true if the string searchfor is in string, but not if preceded by !. X */ Xfindex(string, searchfor) Xchar *string, *searchfor; X{ X register char first; X register char *p; X X first = *searchfor; X for (p=index(string, first); p; p = index(p+1, first)) { X if (((p==string) || (p[-1]!='!')) && strncmp(p, searchfor, strlen(searchfor)) == 0) X return TRUE; X } X return FALSE; X} END_OF_FILE if test 7970 -ne `wc -c <'readnews.c'`; then echo shar: \"'readnews.c'\" unpacked with wrong size! fi # end of 'readnews.c' fi if test -f 'digest.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'digest.c'\" else echo shar: Extracting \"'digest.c'\" \(8135 characters\) sed "s/^X//" >'digest.c' <<'END_OF_FILE' X/* X * digest - process ARPANET digests X * X * digest(ifile, ofile, header) X * FILE *ifile, *ofile; X * struct header *header; X * X * returns: TRUE EOF reached, exit from readnews. X * FALSE normal exit, continue reading news. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)digest.c 1.7 9/19/86"; X#endif /* SCCSID */ X X#include "rparams.h" X Xstruct art { X long a_hdr; X long a_bod; X int a_blen; X int a_hlen; X}; X X#define loop for(;;) X#define getnum(p, n) for (n=0; *p>='0' && *p<='9'; p++) n = n*10 + *p-'0' X#define errchk(p) if (*p) goto badopt X X#define MAXART 128 X Xstruct art *arts; Xint lastart; X Xdigest(ifp, ofp, h) XFILE *ifp, *ofp; Xstruct hbuf *h; X{ X register int n, curart; X struct art artbuf[MAXART]; X int printh, eod, nomore; X char cbuf[BUFLEN], *cmd; X X arts = artbuf; X printh = TRUE; X nomore = eod = FALSE; X curart = 1; X X if (dscan(ifp)) X return FALSE; X X dprint(0, ifp, ofp); X X loop { X if (nomore) break; X if (curart < 1) { X curart = 1; X eod = nomore = FALSE; X } X if (curart > lastart) curart = lastart; X if (eod) nomore = TRUE; X if (printh && !nomore) X (void) dhprint(curart, ifp, ofp); X getcmd: X loop { X SigTrap = FALSE; X fprintf(ofp, "Digest article %d of %d ", curart, lastart); X if (curart==lastart && nomore) X fprintf(ofp, "Last digest article "); X fprintf(ofp, "(%d lines) More? [%s] ", X arts[curart].a_blen, nomore?"snq":"ynq"); X (void) fflush(ofp); X cmd = cbuf; X if (fgets(cmd, BUFLEN, stdin)) X break; X if (!SigTrap) X return(TRUE); X putc('\n', ofp); X } X (void) nstrip(cmd); X while (*cmd==' ' || *cmd=='\t') X cmd++; X printh = TRUE; X X switch (*cmd++) { X case '#': X fprintf(ofp, "%d articles in digest\n", lastart); X (void) fflush(ofp); X printh = FALSE; X break; X X case '$': X curart = lastart; X break; X X case '!': X fwait(fsubr(ushell, cmd, (char *)NULL)); X fprintf(ofp, "!\n"); X printh = FALSE; X break; X X case '\0': X if (nomore) { X putc('\n', ofp); X return(FALSE); X } X cmd--; X case 'y': X case 'p': X errchk(cmd); X dprint(curart++, ifp, ofp); X if (curart > lastart) X eod = TRUE; X break; X X case 'n': X errchk(cmd); X if (++curart > lastart) { X putc('\n', ofp); X return(FALSE); X } X break; X X case '+': X getnum(cmd, n); X errchk(cmd); X if (nomore) { X putc('\n', ofp); X return(FALSE); X } X if (n) curart += n; X else { X curart += 1; X if (curart > lastart) X eod = TRUE; X } X break; X X case '-': X getnum(cmd, n); X errchk(cmd); X eod = nomore = FALSE; X curart -= (n) ? n : 1; X break; X X case '0': case '1': case '2': case '3': case '4': X case '5': case '6': case '7': case '8': case '9': X cmd--; X getnum(cmd, n); X errchk(cmd); X curart = n; X eod = nomore = FALSE; X break; X X case 'q': X case 'x': X putc('\n', ofp); X return(FALSE); X X case '?': X fprintf(ofp, "\nDigester options:\n\n"); X fprintf(ofp, "y\tyes, print article.\n"); X fprintf(ofp, "n\tno, go to next article.\n"); X fprintf(ofp, "q\texit from digester.\n"); X fprintf(ofp, "h\tprint article header.\n"); X fprintf(ofp, "s file\tsave article in file.\n"); X fprintf(ofp, "t\ttable of contents.\n"); X fprintf(ofp, "+[n]\tforward n articles (1).\n"); X fprintf(ofp, "-[n]\tback n articles (1).\n"); X fprintf(ofp, "\nh and s may be followed by '-'\n"); X (void) fflush(ofp); X break; X X case 'h': X n = curart; X if (*cmd=='-') { X cmd++; X if (n > 1) n--; X } X errchk(cmd); X (void) dhprint(n, ifp, ofp); X nomore = printh = FALSE; X if (n!=curart) X putc('\n', ofp); X break; X X case 's': X case 'w': X n = curart; X if (*cmd=='-') { X cmd++; X if (n > 1) n--; X } X while (*cmd==' ' || *cmd=='\t') X cmd++; X dsaveart(n, ifp, ofp, cmd); X nomore = printh = FALSE; X if (n!=curart) X putc('\n', ofp); X break; X X case 'H': X errchk(cmd); X hprint(h, ofp, 1); X eod = nomore = FALSE; X break; X X case 'T': X case 't': X errchk(cmd); X if (cmd[-1]=='T') X hprint(h, ofp, 0); X dprint(0, ifp, ofp); X eod = nomore = FALSE; X break; X X default: X badopt: X if (!nomore) X fprintf(ofp, "y (yes), n (no), "); X fprintf(ofp, "q (quit), s file (save), h (header), t (table of contents)\n"); X fprintf(ofp, "? for help\n"); X goto getcmd; X } X } X putc('\n', ofp); X return(FALSE); X} X Xdscan(ifp) Xregister FILE *ifp; X{ X char scanbuf[BUFLEN]; X register int n, len; X register char *s; X register long pos; X short wasblank, ishead; X X n = len = 0; X wasblank = FALSE; X s = scanbuf; X arts[0].a_bod = arts[1].a_hdr = ftell(ifp); X arts[0].a_hdr = 0L; X arts[1].a_bod = -1L; X X loop { X if (SigTrap) X return(TRUE); X pos = ftell(ifp); X if (fgets(s, BUFLEN, ifp)==NULL) X *s = '\0'; X if (wasblank && isheader(s)) { X long lastpos; X short is_blank; X short nhlines; X arts[n++].a_blen = len; X len = 0; X nhlines = 0; X arts[n].a_hdr = pos; X is_blank = FALSE; X ishead = TRUE; X do { X lastpos = pos; X wasblank = is_blank; X nhlines++; X pos = ftell(ifp); X if (fgets(s, BUFLEN, ifp)==NULL) X *s = '\0'; X else X len++; X is_blank = (*s=='\n') ? TRUE : FALSE; X if (is_blank && nhlines==1) X /* one liner--not a header */ X break; X if (!ishead || (s[0] != ' ' && s[0] != '\t')) X ishead = isheader(s); X } while ((is_blank && !wasblank) || ishead); X if ((!is_blank && !wasblank) || nhlines < 2) { X /* oops! not a header... back off */ X arts[n].a_hdr = arts[n-1].a_bod; X len += arts[--n].a_blen; X } else { X if (wasblank) X pos = lastpos; X arts[n].a_hlen = len; X arts[n].a_bod = arts[n+1].a_hdr = pos; X arts[n+1].a_bod = -1L; X arts[n+1].a_hlen = 3; /* average header len */ X len = 0; X } X } X if (*s=='\0') X break; X wasblank = (*s=='\n') ? TRUE : FALSE; X len++; X } X arts[n].a_blen = len; X arts[n+1].a_hdr = pos; X lastart = n; X return FALSE; X} X Xdhprint(art, ifp, ofp) Xregister int art; Xregister FILE *ifp, *ofp; X{ X register char c; X register long pos = arts[art].a_hdr; X register long epos = arts[art].a_bod; X register int nlines = 1; X X putc('\n', ofp); X fseek(ifp, pos, 0); X while (pos++ < epos && !SigTrap) { X if ((c = getc(ifp))=='\n') X nlines++; X putc(c, ofp); X } X (void) fflush(ofp); X SigTrap = FALSE; X return nlines; X} X Xdprint(art, ifp, ofp) Xint art; XFILE *ifp, *ofp; X{ X#ifdef PAGE X register int cnt; X FILE *pfp, *popen(); X X if (art && arts[art].a_blen > 23-arts[art+1].a_hlen && *PAGER) { X if (!index(PAGER, FMETA)) { X if ((pfp = popen(PAGER, "w"))==NULL) X (void) dprinta(art, ifp, ofp); X else { X cnt = dprinta(art, ifp, pfp) % 23; X if (cnt > 23-arts[art+1].a_hlen) X while (cnt++ < 24) X putc('\n', pfp); X (void) pclose(pfp); X } X } else X pout(ofp); X } else X#endif /* PAGE */ X (void) dprinta(art, ifp, ofp); X} X Xdprinta(art, ifp, ofp) Xint art; Xregister FILE *ifp, *ofp; X{ X register char c; X register long pos = arts[art].a_bod; X register long epos = arts[art+1].a_hdr; X register int nlines = 0; X X (void) fseek(ifp, pos, 0); X while (pos++ < epos && !SigTrap) { X if ((c = getc(ifp))=='\n') X nlines++; X putc(c, ofp); X } X (void) fflush(ofp); X SigTrap = FALSE; X return nlines; X} X Xdsaveart(art, ifp, ofp, name) Xint art; Xregister FILE *ifp, *ofp; Xregister char *name; X{ X register FILE *nfp; X char fname[BUFLEN]; X char *strcat(), *strcpy(), *getenv(); X register char *nb; X X while (*name==' ' || *name=='\t') X name++; X X if (*name=='|') { X fprintf(ofp, "don't know how to pipe yet.\n"); X (void) fflush(ofp); X return; X } else if (*name=='/') X (void) strcpy(fname, name); X else { X if (nb = getenv("NEWSBOX")) X (void) strcpy(fname, nb); X else X (void) strcpy(fname, userhome); X (void) strcat(fname, "/"); X (void) strcat(fname, name); X } X X fprintf(ofp, "Save digest article %d in \"%s\"", art, fname); X (void) fflush(ofp); X if ((nfp = fopen(fname, "a"))!=NULL) { X int ln; X ln = dhprint(art, ifp, nfp); X ln += dprinta(art, ifp, nfp); X fprintf(ofp, " [Appended] %d lines\n", ln); X (void) fclose(nfp); X } else X fprintf(ofp, " cannot append to.\n"); X} X Xisheader(s) Xregister char *s; X{ X if (isupper(*s) || islower(*s)) { X while (*s && *s!=':' && !isspace(*s)) X s++; X if (*s==':' && *++s==' ') X return TRUE; X } X return FALSE; X} END_OF_FILE if test 8135 -ne `wc -c <'digest.c'`; then echo shar: \"'digest.c'\" unpacked with wrong size! fi # end of 'digest.c' fi if test -f 'unbatch.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'unbatch.c'\" else echo shar: Extracting \"'unbatch.c'\" \(6310 characters\) sed "s/^X//" >'unbatch.c' <<'END_OF_FILE' X/* X * unbatchnews: extract news in batched format and process it one article X * at a time. The format looks like X * #! rnews 1234 X * article containing 1234 characters X * #! rnews 4321 X * article containing 4321 characters X * X * or X * X * #! cunbatch X * calls LIBDIR/compress and writes the output to a temp file X * executes rnews for every article in the temp file X * unlinks the temp file X * X * or X * X * #! command [args] X * calls LIBDIR/command [args] to process the news X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)unbatch.c 1.26 3/21/87"; X#endif /* SCCSID */ X X#define MAXARGS 32 X X#include "defs.h" X#include X#include X X#if defined(USG) || defined(BSD4_2) || defined(BSD4_1C) || defined(MINIX) X#include X#endif /* USG */ X Xchar xbuf[BUFSIZ]; Xchar sibuf[BUFSIZ]; X Xmain() X{ X register int c; X register FILE *pfn; X register long size; X char *filename; X int pid, wpid, exstat; X char *mktemp(), *gets(); X long atol(); X X filename = mktemp("/tmp/unbnewsXXXXXX"); X setbuf(stdin, (char *)NULL); /* only for the first line */ X if (gets(xbuf) == NULL) { X (void) unlink(filename); X exit(0); X } X if (strncmp(xbuf, "#! cunbatch", 11) == 0) { X docunbatch(xbuf); X /* should not return */ X logerr("unbatch: docunbatch returned!"); X exit(1); X } X X if (strncmp(xbuf, "#! rnews ", 9) != 0) { X docmd(xbuf); X /* should not return */ X logerr("unbatch: docmd returned!"); X exit(1); X } X X setbuf(stdin, sibuf); /* buffer the rest of the file */ X X do { X while (strncmp(xbuf, "#! rnews ", 9) X && strncmp(xbuf, "! rnews ", 8)) { /* kludge for bug */ X register char *cp; X for (cp = xbuf; *cp != '\0'; ++cp) X if (!isascii(*cp) || X (!isprint(*cp) && !isspace(*cp))) X *cp = '?'; X logerr("out of sync, skipping %s", xbuf); X if (gets(xbuf) == NULL) X exit(0); X } X size = atol(xbuf + (xbuf[0] == '#' ? 9 : 8)); X if(size <= 0) { X logerr("nonsense size %ld", size); X continue; X } X#ifdef VMS X/* The loop is to delete all versions. */ X while (unlink(filename) == 0) X ; X#endif /* VMS */ X pfn = fopen(filename, "w"); X while(--size >= 0 && (c = getc(stdin)) != EOF) X putc(c, pfn); X if (ferror(pfn) || fclose(pfn)) { /* disk full? */ X logerr("error writing temporary file"); X break; X } X X /* X * If we got a truncated batch, don't process the X * last article; it will probably be received again. X */ X if (size > 0) { X logerr("truncated batch"); X break; X } X X /* X * rnews < filename X */ X while ((pid = vfork()) == -1) { X logerr("fork failed, waiting...\n"); X sleep(60); X } X if (pid == 0) { X (void) close(0); X (void) open(filename, 0); X#ifdef IHCC X (void) sprintf(xbuf, "%s/%s", logdir(HOME), RNEWS); X#else X strcpy(xbuf, RNEWS); X#endif X#ifdef SPOOLNEWS X execlp(xbuf, "rnews", "-S", (char *)0); X#else /* !SPOOLNEWS */ X execlp(xbuf, "rnews", (char *)0); X#endif /* !SPOOLNEWS */ X perror("rnews"); X exit(1); X } X while ((wpid = wait(&exstat)) >= 0 && wpid != pid) X ; X } while (gets(xbuf) != NULL); X (void) unlink(filename); X exit(0); X} X Xdocmd(p) Xregister char *p; X{ X char *args[MAXARGS]; X register char **ap = args; X char path[BUFSIZ]; X char *rindex(), *cp; X X while (*p && !isspace(*p)) /* skip leading #! crud */ X p++; X X while (isspace(*p)) X p++; X X while (*p != '\0') { X *ap++ = p; X if (ap >= &args[MAXARGS]) { X logerr("unbatch: Too many args to %s", args[0]); X exit(2); X } X while (*p && !isspace(*p)) X p++; X if (*p) X *p++ = '\0'; X while (isspace(*p)) X p++; X } X *ap = (char *)0; X X if (ap == args) { X logerr("unbatch: no command to execute"); X exit(2); X } X X /* strip off any leading pathname in case someone gets tricky */ X cp = rindex(args[0], '/'); X if (cp++ == NULL) X cp = args[0]; X X# ifdef HOME X sprintf(path, "%s/%s/%s", logdir(HOME), LIBDIR, cp); X# else /* !HOME */ X sprintf(path, "%s/%s", LIBDIR, cp); X# endif /* HOME */ X X /* X * "path" is absolute, no searching is needed, we use X * 'execvp' solely so that sh scripts will be handled X */ X (void) execvp(path, args); X perror(path); X exit(2); X} X X/* docunbatch ... feed a compressed batch into compress & put output to X * a temporary file. Used to conserve memory when rnews is running. X */ X Xdocunbatch(arg) Xchar *arg; X{ X char cmd[200]; X int pid, wpid, exstat; X char *filename; X char *mktemp(); X X filename = mktemp("/usr/tmp/unbnewsXXXXXX"); X /* feed stdin into compress */ X sprintf(cmd,"%s/compress -d >%s", LIBDIR, filename); X X if ((pid=vfork()) == 0) { X execl("/bin/sh", "news-decompress", "-c", cmd, (char *) 0); X logerr("execl /bin/sh -c compress failed!\n"); X exit(2); X } else { X while ((wpid = wait(&exstat)) >= 0 && wpid != pid) X ; X } X X if (exstat) { X logerr("Decompress failed\n"); X exit(3); X } X X /* now run unbatch (hey, that's us!) on the file */ X /* redirect stdin to point to the file */ X fclose(stdin); X if (open(filename, O_RDONLY) != 0) { X logerr("unbatch cannot reopen stdin\n"); X unlink(filename); X exit(2); X } X X sprintf(cmd, "%s/unbatch", LIBDIR); X X if ((pid=vfork()) == 0) { X execl(cmd, "news-unpack", (char *) 0); X logerr("execl LIBDIR/unbatch failed!\n"); X unlink(filename); X exit(2); X } else { X while ((wpid = wait(&exstat)) >= 0 && wpid != pid) X ; X } X X unlink(filename); X if (exstat) { X logerr("Unbatch failed\n"); X exit(3); X } X X exit(0); X} X X X/* X * Log the given message, with printf strings and parameters allowed, X * on the log file, if it can be written. X */ X/* VARARGS1 */ Xlogerr(fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9) Xchar *fmt; Xlong a1, a2, a3, a4, a5, a6, a7, a8, a9; X{ X FILE *logfile; X char lfname[BUFSIZ]; /* the log file */ X char bfr[BUFSIZ]; X char *logtime, *ctime(); X long t; X X (void) time(&t); X logtime = ctime(&t); X logtime[16] = 0; X logtime += 4; X X#ifdef IHCC X (void) sprintf(lfname, "%s/%s/errlog", logdir(HOME), LIBDIR); X#else X (void) sprintf(lfname, "%s/errlog", LIBDIR); X#endif X X (void) sprintf(bfr, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9); X (void) fprintf(stderr, "%s\n", bfr); X if (access(lfname, 0) == 0 && (logfile = fopen(lfname, "a")) != NULL) { X#if defined(USG) || defined(BSD4_2) || defined(BSD4_1C) X int flags; X flags = fcntl(fileno(logfile), F_GETFL, 0); X (void) fcntl(fileno(logfile), F_SETFL, flags|O_APPEND); X#else /* v7 */ X (void) lseek(fileno(logfile), 0L, 2); X#endif /* v7 */ X fprintf(logfile, "%s\tbatch\t%s\n", logtime, bfr); X (void) fclose(logfile); X } X} END_OF_FILE if test 6310 -ne `wc -c <'unbatch.c'`; then echo shar: \"'unbatch.c'\" unpacked with wrong size! fi # end of 'unbatch.c' fi if test -f 'recmail.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'recmail.c'\" else echo shar: Extracting \"'recmail.c'\" \(6021 characters\) sed "s/^X//" >'recmail.c' <<'END_OF_FILE' X/* X * This software is Copyright (c) 1986 by Rick Adams. X * X * Permission is hereby granted to copy, reproduce, redistribute or X * otherwise use this software as long as: there is no monetary X * profit gained specifically from the use or reproduction or this X * software, it is not sold, rented, traded or otherwise marketed, and X * this copyright notice is included prominently in any copy X * made. X * X * The author make no claims as to the fitness or correctness of X * this software for any use whatsoever, and it is provided as is. X * Any use of this software is at the user's own risk. X * X * recmail: read a mail message on stdin, grab all addresses in To and Cc X * lines, and pass the full message to all addressees. This is useful to X * send the output of a recently edited mail message (with headers edited too). X * It is similar to sendmail -t, but only assumes /bin/mail. X * To use your own mailer, e. g. nmail, compile with -DMAILER=my_mailer. X */ X X#ifdef SCCSID Xstatic char *SccsId = "@(#)recmail.c 1.15 10/23/86"; X#endif /* SCCSID */ X X#include "params.h" X X#ifndef MAILER X#define MAILER "/bin/mail" X#endif Xchar mailer[] = MAILER; X X#define MAXRECIPS 100 Xchar *recips[MAXRECIPS]; Xint nrecips = 0; X Xmain() X{ X FILE *fd; X char *tmpf; X FILE *errfd; X char *errf; X char linebuf[1024]; X int i, pid, wpid; X int exstat; X char *mypath; X int goodcnt, badcnt; X char *mktemp(), *getenv(); X X tmpf = mktemp("/tmp/rmXXXXXX"); X (void) close(creat(tmpf,0666)); X fd = fopen(tmpf, "w"); X errf = mktemp("/tmp/rmXXXXXX"); X (void) close(creat(errf,0666)); X errfd = fopen(errf, "w"); X fprintf(errfd, "Subject: Returned mail\n"); X fprintf(errfd, "\n ----- Transcript of session follows -----\n"); X (void) fflush(errfd); X goodcnt = badcnt = 0; X X while (fgets(linebuf, sizeof linebuf, stdin) != NULL) { X if ((strncmp(linebuf, "Bcc: ", 5) == 0 || X strncmp(linebuf, "bcc: ", 5) == 0 || X strncmp(linebuf, "BCC: ", 5) == 0)) { X if (linebuf[5] != '\n') X addrecips(linebuf+5); X } X else if (fputs(linebuf, fd) == EOF) X goto werror; X if (linebuf[0] == '\n') X break; X if ((strncmp(linebuf, "To: ", 4) == 0 || X strncmp(linebuf, "to: ", 4) == 0 || X strncmp(linebuf, "TO: ", 4) == 0 || X strncmp(linebuf, "Cc: ", 4) == 0 || X strncmp(linebuf, "cc: ", 4) == 0 || X strncmp(linebuf, "CC: ", 4) == 0) && X linebuf[4] != '\n') X addrecips(linebuf+4); X } X if (!feof(stdin)) { X while (fgets(linebuf, sizeof linebuf, stdin) != NULL) { X if (fputs(linebuf, fd) == EOF) { Xwerror: X printf("write error on temp file\n"); X exit(2); X } X } X } X /* X * Append the contents of the .signature file (if it exists) to X * the end of the mail message X */ X { X char sigbuf[BUFSIZ]; X register c; X register char *p = getenv("HOME"); X FILE *infp; X X if (p) { X (void) sprintf(sigbuf, "%s/%s", p, ".signature"); X if (infp = fopen(sigbuf, "r")) { X fprintf(fd,"---\n"); X while ((c = getc(infp)) != EOF) X putc(c,fd); X (void) fclose(infp); X } X } X } X (void) fclose(fd); X X /* X * Force the path to only consider /bin and /usr/bin, since X * that's the version of mail we want (not /usr/ucb/mail) X */ X if (mailer[0] != '/') { X register int e; X extern char **environ; X for (e = 0; environ[e] != NULL; ++e) X if (strncmp(environ[e], "PATH=", 5) == 0) { X environ[e] = "PATH=/bin:/usr/bin"; X break; X } X } X mypath = getenv("PATH"); X if (mypath) X strcpy(mypath, "/bin:/usr/bin"); X X /* X * We send the copies out separately, because of a bug in X * USG's /bin/mail which will generate ANOTHER To: line, X * even though we already have one, if there are at least X * two recipients. X */ X for (i=0; i= 0 && wpid != pid) X ; X if (exstat == 0) X goodcnt++; X else X badcnt++; X } X if (badcnt) { X mailback(errfd, tmpf, errf); X (void) unlink(tmpf); X (void) unlink(errf); X exit(1); X } else if (goodcnt == 0) { X fprintf(errfd, "recmail: no 'To:' line\n"); X mailback(errfd, tmpf, errf); X (void) unlink(tmpf); X (void) unlink(errf); X exit (1); X } X (void) unlink(tmpf); X (void) unlink(errf); X exit (0); X} X X#define isok(c) (isprint(c) && (c) != ' ' && c != ',') Xaddrecips(line) Xchar *line; X{ X char *front, *back, *tail; X char *malloc(); X X tail = line + strlen(line); X for (front=line; front < tail; ) { X while (!isok(*front) && front < tail) X front++; X if (front >= tail) X break; /* skip end of line garbage */ X for (back=front; isok(*back); back++) X ; X *back=0; X if (nrecips >= MAXRECIPS) { X printf("Too many destinations\n"); X exit(2); X } X if ((recips[nrecips] = malloc(strlen(front) + 1)) == NULL) { X printf("Out of space\n"); X exit(2); X } X (void) strcpy(recips[nrecips], front); X nrecips++; X front = back+1; X } X} X Xint Xmailto(tmpf, errfd, recip) Xchar *tmpf; XFILE *errfd; Xchar *recip; X{ X register int pid; X X /* X * mail recips < tmpf X */ X while ((pid = vfork()) == -1) { X fprintf(stderr, "fork failed, waiting...\r\n"); X sleep(60); X } X if (pid == 0) { X (void) close(0); X (void) open(tmpf, 0); X if (errfd != NULL) { X (void) close(1); X (void) dup(fileno(errfd)); X (void) fclose(errfd); X (void) close(2); X (void) dup(1); X } X execlp(mailer, mailer, recip, (char *)0); X perror(mailer); X exit(1); X } X return pid; X} X Xmailback(errfd, tmpf, errf) Xregister FILE *errfd; Xchar *tmpf; Xchar *errf; X{ X register FILE *fd; X register int c; X int exstat; X register int pid, wpid; X char *logn; X char *getlogin(), *getenv(); X register struct passwd *pwd; X X if ((fd = fopen(tmpf, "r")) != NULL) { X fprintf(errfd, "\n ----- Unsent message follows -----\n"); X while ((c = getc(fd)) != EOF) X putc(c, errfd); X (void) fclose(fd); X } X (void) fclose(errfd); X if ((logn = getlogin()) == NULL && (logn = getenv("USER")) == NULL) { X if ((pwd = getpwent(getuid())) == NULL) X return; X logn = pwd->pw_name; X } X pid = mailto(errf, (FILE *)NULL, logn); X while ((wpid = wait(&exstat)) >= 0 && wpid != pid) X ; X} END_OF_FILE if test 6021 -ne `wc -c <'recmail.c'`; then echo shar: \"'recmail.c'\" unpacked with wrong size! fi # end of 'recmail.c' fi if test -f 'defs.minix' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'defs.minix'\" else echo shar: Extracting \"'defs.minix'\" \(5776 characters\) sed "s/^X//" >'defs.minix' <<'END_OF_FILE' X/* X * This software is Copyright (c) 1986 by Rick Adams. X * X * Permission is hereby granted to copy, reproduce, redistribute or X * otherwise use this software as long as: there is no monetary X * profit gained specifically from the use or reproduction or this X * software, it is not sold, rented, traded or otherwise marketed, and X * this copyright notice is included prominently in any copy X * made. X * X * The author make no claims as to the fitness or correctness of X * this software for any use whatsoever, and it is provided as is. X * Any use of this software is at the user's own risk. X * X */ X X/* @(#)defs.dist 2.58 4/10/87 */ X X/* X * defs.h - defines for news-related programs. X * X * If you remove any lines here or in your Makefile, make the change X * to localize.sh so you won't have to redo it for each news release. X * X * If TMAIL is undefined, the -M option will be disabled. X * X * By convention, the version of the software you are running is taken X * to be news_version below. X */ X X#define DAYS (60L*60L*24L) X#define WEEKS (7*DAYS) X/* Things that very well may require local configuration */ X#ifndef HOME X#define ROOTID 10 /* uid of person allowed to cancel anything */ X#endif X#define N_UMASK 002 /* mask for umask call, 022 for secure system */ X#define DFLTEXP 2*WEEKS /* default no. of seconds to expire in */ X#define HISTEXP 4*WEEKS /* default no. of seconds to forget in */ X#define DFLTSUB "general,all.announce" /* default subscription list */ X#define TMAIL "/usr/bin/Mail" /* Mail program that understands -T */ X#define ADMSUB "general,all.announce" /* Mandatory subscription list */ X#define PAGE "/usr/bin/more" /* Default pager */ X#define NOTIFY "usenet" /* Tell him about certain ctl messages */ X /* Default xmit command - remove -z if */ X#define DFTXMIT "uux - -r -z -gd %s!rnews < %s" /* your uux can't do it */ X#define UXMIT "uux -r -z -gd -c %s!rnews '<' %s" /* If uux -c is ok */ X#define DFTEDITOR "mined" /* Default editor, see also postnews. */ X/* #define UUPROG "euuname" /* omit for uuname, put in LIBDIR */ X#define MANUALLY /* Don't execute rmgroups, just notify. */ X/* #define NONEWGROUPS /* Don't create new groups, just notify.*/ X/* #define SPOOLNEWS /* Spool incoming rnews, don't process */ X/* #define SPOOLINEWS /* Spool local inews, don't process */ X/* #define LOCALNAME /* There is no full name database. */ X#define INTERNET /* Internet mail works locally */ X#define MYDOMAIN ".OZ" /* Local domain */ X/* #define CHEAP /* don't chown files to news */ X/* #define OLD /* Add extra headers for old neighbors */ X/* #define UNAME /* If uname call returns your nodename */ X/* #define GHNAME /* If gethostname call is available. */ X#define UUNAME "/etc/uucpname" /* If your nodename is stored in a file */ X#define V7MAIL /* Local mail format is V7 ("From ") */ X#define SORTACTIVE /* if you want news presented in the order of the .newsrc */ X#define ZAPNOTES /* if you want old style notes headers moved into the headers */ X#define DIGPAGE /* allow digestifying in vnews */ X/* #define DOXREFS /* Generate xref line for rn to use */ X#define MULTICAST /* If you want to be able to multicast news */ X/* #define BSD4_2 /* If you are running 4.2 or 4.3 BSD */ X/* #define BSD4_1C /* If you are running 4.1C BSD */ X/* #define LOCKF /* If you have the lockf() sys call */ X/* #define ALWAYSALIAS /* temporary kludge for conversion */ X/* #define SENDMAIL "/usr/bin/sendmail" /* command line to run "sendmail" if you have it */ X/* #define MMDF "/usr/mmdf/submit" /* command line to run mmdf if you have it */ X#define MYORG "Minix support BBS, NSW, Australia" /* My organization. Please */ X /* include your city (and state, and */ X /* country, if not obvious) in MYORG, */ X /* and please keep it short. */ X/* #define HIDDENNET "frooz" /* if you have a local network and want */ X /* The mail address to look like it came */ X /* from one machine */ X/* NOTE: The following two macros replace the use of HIDDENNET */ X/* #define GENERICPATH "frooz" /* If you are using a shared USENET/UUCP node */ X/* #define GENERICFROM "Frobozz.COM" /* If you want generic From:-addresses */ X/* #define NICENESS 4 /* does a nice(NICENESS) in rnews */ X/* #define FASCIST "all,!all.all" /* only permit posting to certain groups */ X /* see installation guide for details */ X#define SMALL_ADDRESS_SPACE /* If your machine can't address > 32767 */ X/* #define ORGDISTRIB "froozum" /* For organization wide control message handling */ X X/* Things you might want to change */ X#define NEWSRC ".newsrc" /* name of .newsrc file (in home dir) */ X#define LINES 512 /* maximum no. of lines in .newsrc */ X#define NEGCHAR '!' /* newsgroup negation character */ X#define DEADTIME 45 /* no. of seconds to wait on deadlock */ X#define FMETA '%' /* file meta-character for c option */ X#if defined(pdp11) || defined(SMALL_ADDRESS_SPACE) X# define BUFLEN 128 /* standard buffer size */ X#else X# define BUFLEN 256 /* standard buffer size */ X#endif X#define LBUFLEN 1024 /* big buffer size */ X#define SBUFLEN 32 /* small buffer size (for system names, etc) */ X#define LNCNT 14 /* Articles with > LNCNT lines go through pager */ X X/* Things you probably won't want to change */ X#define PATHLEN 512 /* length of longest source string */ X#define DATELEN 64 /* length of longest allowed date string */ X#define NAMELEN 128 /* length of longest possible message ID */ X#define SNLN 8 /* max significant characters in sysname */ X#define PROTO 'A' /* old protocol name */ X#define NETCHRS "!:@^%,"/* Punct. chars used for various networks */ X#define TRUE 1 /* boolean true */ X#define FALSE 0 /* boolean false */ X#define PERHAPS 2 /* indeterminate boolean value */ X#define NGDELIM ',' /* delimit character in news group line */ X END_OF_FILE if test 5776 -ne `wc -c <'defs.minix'`; then echo shar: \"'defs.minix'\" unpacked with wrong size! fi # end of 'defs.minix' fi echo shar: End of shell archive. exit 0 -- "Zeta Microcomputer Software" ACSnet: nick@ultima.cs.uts.oz UUCP: ...!uunet!munnari!ultima.cs.uts.oz!nick Fidonet: Nick Andrew on 3:713/602 (Zeta)