[net.sources] kit to install 2.10.2 news under Eunice

chip@t4test.UUCP (Chip Rosenthal) (10/01/84)

: This is a shar archive.  Extract with sh, not csh.
: This archive contains the following files
:  README.vms do.changes Makefile.vms vmsfuncs.c
: Total number of files: 4
echo x - README.vms [file 1 of 4]
sed 's/^|//' > README.vms << '!-FUNKY-STUFF-!'
|This kit allows conversion of the version 2.10.2 USENET software so that
|it may be installed under the Eunice operating system.  The following
|files are included:
|
|	   README.vms - these very words
|          do.changes - script to automatically update various sources
|        Makefile.vms - the skeleton makefile which should be used
|          vmsfuncs.c - additional functions to make Eunice happy
|
|To install news in a Eunice environment, take the following steps:
|
|1)  Unbundle the version 2.10.2 software.
|2)  Copy the files from this kit into the same directory as the news sources.
|3)  Type "sh do.changes" to update the distributed software.
|4)  Proceed as usual (i.e. create a "localize.sh", run make, etc.)
|
|Note: You will probably want to remove the -DDBM flag from 'Makefile'
|when you write a 'localize.sh'.  Until TWG makes files like 'history.dir'
|work correctly, the database subroutines look to me like a dangerous thing 
|to be running.
|
|Disclaimer:  Do not expect 'vnews' to work perfectly.  Although it
|compiles alright, it appears to have some bugs in it.  Your possible
|actions are: (1) just use readnews, (2) debug vnews, or (3) get and
|install the 'rn' news reader.  We have taken the latter action, and
|recommend the same.  The 'rn' program has been designed to work in the
|Eunice environment.  Furthermore, it is a very good piece of software.
|
!-FUNKY-STUFF-!
echo x - do.changes [file 2 of 4]
sed 's/^|//' > do.changes << '!-FUNKY-STUFF-!'
|#! /bin/sh
|: add Eunice patches to version 2.10.2 news sources
|: use sh, not csh
|
|cat << 'EOF'
|
|This script will perform the required updates upon the distributed 
|version 2.10.2 programs to allow them to run under Eunice.  Note that
|all software will remain compatible with non-Eunice systems.  The
|following files will be updated:
|
|	fullname.c
|	ifuncs.c
|	inews.c
|	postnews.c
|	recmail.c
|
|EOF
|
|
|echo "verifying that required files are available..."
|flag=""
|for file in fullname.c ifuncs.c inews.c recmail.c postnews.c ; do
|    if test ! -f $file ; then
|	echo "$file not found"
|	flag="failed"
|    elif test ! -w $file ; then
|	echo "no write access to $file"
|	flag="failed"
|    fi
|done
|if test $flag ; then
|    echo "please make required changes, and then start $0 again"
|    exit 1
|fi
|echo "all required files are present and accounted for"
|
|
|echo ""
|echo "performing updates on fullname.c"
|cp fullname.c fullname.c.old
|echo "old copy is saved as fullname.c.old"
|ed fullname.c << 'EOF'
|25a
|#ifdef VMS
|struct passwd *getpwent(), *getpwuid(), *getpwnam();
|#endif VMS
|.
|w
|q
|EOF
|
|
|echo ""
|echo "performing updates on ifuncs.c"
|cp ifuncs.c ifuncs.c.old
|echo "old copy is saved as ifuncs.c.old"
|ed ifuncs.c << 'EOF'
|833d
|449a
|
|#endif	!VMS
|
|.
|448d
|444,446c
|
|.
|430d
|422a
|
|.
|421a
|		(void) time(&now);
|		i = stat(lockname, &sbuf);
|		if (i < 0) {
|			xerror("Directory permission problem in /tmp");
|		}
|		if (sbuf.st_mtime + 10*60 < now) {
|			unlink(lockname);
|			logerr("Article %s locked up", str);
|		} else {
|		    	log("waiting on lock for %s", lockname);
|		    	sleep((unsigned)60);
|		}
|	}
|	close(fd);
|	unlink(tempname);
|
|.
|419a
|	int fd;
|.
|418d
|416a
|
|.
|w
|q
|EOF
|
|
|echo ""
|echo "performing updates on inews.c"
|cp inews.c inews.c.old
|echo "old copy is saved as inews.c.old"
|ed inews.c << 'EOF'
|496a
|#ifdef DEBUG
|	fprintf(stderr,"updated size of newsgroup %s to %05ld\n",ngname,ngsize+1);
|#endif
|.
|491a
|#ifdef VMS
|	unixtovms(ACTIVE);
|#endif
|.
|484c
|#ifdef VMS
|	vmstounix(ACTIVE);
|#endif
|	actfp = xfopen(ACTIVE, "r+");
|.
|472c
|		logerr("Cannot install article as %s (%d)", bfr, e);
|.
|470a
|#ifdef DEBUG
|		perror(bfr);
|#endif
|.
|457,466c
|		if (vmslink(ARTICLE, bfr) == 0)
|			break;
|.
|449a
|#ifdef DEBUG
|	fprintf(stderr,"localize current size of '%s' is '%d'\n",bfr,ngsize);
|#endif
|.
|428a
|#ifdef DEBUG
|        fprintf(stderr,"localize entered for '%s'\n",ngname);
|#endif
|
|.
|380c
|#endif !VMS
|.
|w
|q
|EOF
|
|
|echo ""
|echo "performing updates on postnews.c"
|cp postnews.c postnews.c.old
|echo "old copy is saved as postnews.c.old"
|ed postnews.c << 'EOF'
|18a
|#ifdef VMS
|struct passwd *getpwent(), *getpwuid(), *getpwnam();
|#define unlink vmsdelete
|#endif VMS
|.
|w
|q
|EOF
|
|
|echo ""
|echo "performing updates on recmail.c"
|cp recmail.c recmail.c.old
|echo "old copy is saved as recmail.c.old"
|ed recmail.c << 'EOF'
|18a
|#ifdef VMS
|struct passwd *getpwent(), *getpwuid(), *getpwnam();
|#endif
|.
|w
|q
|EOF
|
|
|echo ""
|echo "Updates have been performed."
|
!-FUNKY-STUFF-!
echo x - Makefile.vms [file 3 of 4]
sed 's/^|//' > Makefile.vms << '!-FUNKY-STUFF-!'
|# @(#)Makefile.vms	1.00	9/22/84
|# Makefile for the Eunice VMS-based system
|
|# definitions
|
|NEWSUSR = news
|NEWSGRP = news
|# HOME is the user name whose home dir has all the news stuff in it.
|HOME=	exptools
|# Use the -DHOME line if you want dynamic lookup in /etc/passwd
|#HOMENAME=	-DHOME=\"$(HOME)\"
|HOMENAME=
|SPOOLDIR = /usr/spool/news
|BATCHDIR = /usr/spool/batch
|LIBDIR = /usr/lib/news
|BINDIR = /usr/bin
|UUXFLAGS = -r -z
|
|DEBUG =
|IBMFLAGS =
|DEFS =	-DRNEWS=\"$(BINDIR)/rnews\" -DSPOOLDIR=\"$(SPOOLDIR)\" \
|	-DBATCHDIR=\"$(BATCHDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
|	-DBINDIR=\"$(BINDIR)\" -DNEWSUSR=\"$(NEWSUSR)\" \
|	-DNEWSGRP=\"$(NEWSGRP)\"
|CFLAGS = ${DEBUG} -O -DVMS -DDBM ${DEFS}
|LFLAGS =
|LIBS = -ldbm
|LINTFLAGS = -chba -DVMS -DDBM ${DEFS}
|
|MISC = uname.o
|OBJECTS = funcs.o funcs2.o getdate.o header.o ndir.o $(MISC)
|VMSOBJECTS = vmsfuncs.o
|IOBJECTS = inews.o ifuncs.o iextern.o control.o fullname.o \
|	ipathinit.o $(OBJECTS) $(VMSOBJECTS)
|POBJECTS = postnews.o rextern.o rpathinit.o funcs.o $(VMSOBJECTS) $(MISC)
|ROBJECTS = readnews.o rfuncs.o rfuncs2.o rextern.o readr.o \
|	process.o rpathinit.o digest.o $(OBJECTS)
|VOBJECTS = readnews.o rfuncs.o rfuncs2.o rextern.o process.o rpathinit.o \
|	$(OBJECTS) visual.o virtterm.o
|EXPOBJS=  expire.o header.o funcs.o getdate.o rextern.o epathinit.o \
|	funcs2.o ndir.o $(MISC)
|
|SRCS = funcs.c funcs2.c header.c
|VMSSRCS = vmsfuncs.c
|ISRCS = inews.c ifuncs.c iextern.c control.c fullname.c  $(SRCS) $(VMSSRCS)
|PSRCS = postnews.c rextern.c funcs.c $(VMSSRCS)
|RSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c readr.c process.c  \
|	digest.c $(SRCS)
|VSRCS = readnews.c rfuncs.c rfuncs2.c rextern.c process.c $(SRCS) \
|	visual.c virtterm.c
|EXPSRCS = expire.c header.c funcs.c getdate.c rextern.c \
|	funcs2.c
|OSRCS = uurec.c recnews.c sendnews.c batch.c unbatch.c caesar.c \
|	recmail.c compress.c
|
|OTHERS = inews uurec recnews sendnews expire batch unbatch caesar recmail \
|	compress sendbatch csendbatch rmgroup checkgroups
|COMMANDS = readnews checknews postnews vnews cunbatch
|
|# dependencies
|all: $(COMMANDS) $(OTHERS)
|
|cp: all $(LIBDIR) $(BINDIR) help vnews.help
|	cp $(COMMANDS) $(BINDIR)
|	-cd $(BINDIR); chown $(NEWSUSR) $(COMMANDS); chgrp $(NEWSGRP) $(COMMANDS);\
|		chmod 755 $(COMMANDS)
|	@echo "Reminder: uux must permit cunbatch if running over uucp."
|	unixtovms help
|	unixtovms vnews.help
|	cp help vnews.help $(OTHERS) $(LIBDIR)
|	cd $(LIBDIR); chown $(NEWSUSR) $(OTHERS); chgrp $(NEWSGRP) $(OTHERS);\
|		chmod 755 $(OTHERS)
|	chmod 6755 $(LIBDIR)/inews
|	-rm -f $(BINDIR)/rnews
|	cp $(LIBDIR)/inews $(BINDIR)/rnews
|
|defs.h:	defs.dist localize.sh
|	sh localize.sh
|
|Makefile: Makefile.vms localize.sh defs.dist
|	sh localize.sh
|
|install: cp install.sh makeactive.sh
|	unixtovms install.sh
|	unixtovms makeactive.sh
|	sh install.sh $(SPOOLDIR) $(LIBDIR) $(NEWSUSR) $(NEWSGRP) v7
|
|clean:
|	vms purge/log
|	rm -f $(COMMANDS) $(OTHERS) *.o a.out
|	rm -f core index errs getdate.c
|
|lint:  ilint vlint rlint elint plint olint
|
|ilint: defs.h params.h iparams.h header.h $(ISRCS)
|	lint $(LINTFLAGS) $(ISRCS)
|
|vlint: defs.h params.h rparams.h header.h $(VSRCS)
|	lint $(LINTFLAGS) $(VSRCS)
|
|rlint: defs.h params.h rparams.h header.h $(RSRCS)
|	lint $(LINTFLAGS) $(RSRCS)
|
|elint: defs.h params.h iparams.h header.h $(ESRCS)
|	lint $(LINTFLAGS) $(ESRCS)
|
|plint: defs.h params.h iparams.h header.h $(PSRCS)
|	lint $(LINTFLAGS) $(PSRCS)
|
|olint: defs.h params.h iparams.h header.h $(OSRCS)
|	for i in $(OSRCS); do lint $(LINTFLAGS) $$i; done
|
|inews:  Makefile $(IOBJECTS)
|	$(CC) $(LFLAGS) $(IOBJECTS) -o inews $(LIBS)
|
|readnews:  Makefile $(ROBJECTS)
|	$(CC) $(LFLAGS) $(ROBJECTS) -o readnews $(LIBS)
|
|funcs.o:  funcs.c params.h defs.h header.h
|	$(CC) $(CFLAGS) -c funcs.c
|
|getdate.o:  getdate.y
|	@echo "expect 6 shift/reduce conflicts"
|	yacc getdate.y
|	mv ytab.c getdate.c
|	$(CC) $(CFLAGS) -c getdate.c
|	-rm -f getdate.c
|
|inews.o:  inews.c iparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) -c inews.c
|
|ifuncs.o:  ifuncs.c iparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) $(HOMENAME) -c ifuncs.c
|
|iextern.o:  iextern.c iparams.h defs.h params.h Makefile header.h
|	$(CC) $(CFLAGS) -c iextern.c
|
|postnews: Makefile $(POBJECTS)
|	$(CC) $(CFLAGS) $(LFLAGS) $(POBJECTS) -o postnews
|
|postnews.o: postnews.c defs.h
|	$(CC) $(CFLAGS) -c postnews.c
|
|readnews.o:  readnews.c rparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) $(HOMENAME) -c readnews.c
|
|rfuncs.o:  rfuncs.c rparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) -c rfuncs.c
|
|rfuncs2.o:  rfuncs2.c rparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) -c rfuncs2.c
|
|rextern.o:  rextern.c rparams.h defs.h params.h Makefile header.h
|	$(CC) $(CFLAGS) -c rextern.c
|
|readr.o:  readr.c rparams.h defs.h params.h Makefile ndir.h header.h
|	$(CC) $(CFLAGS) -c readr.c
|
|checknews.o:  checknews.c defs.h header.h Makefile
|	$(CC) $(CFLAGS) -c checknews.c
|
|vnews:	$(VOBJECTS)
|	$(CC) $(LFLAGS) $(VOBJECTS) -ltermcap $(LIBS) -o $@
|
|visual.o:  visual.c rparams.h defs.h params.h ndir.h header.h
|	$(CC) $(CFLAGS) -c visual.c
|
|control.o:  control.c defs.h iparams.h params.h header.h
|	$(CC) $(CFLAGS) -c control.c
|
|logdir.o: logdir.c
|	$(CC) $(CFLAGS) -c logdir.c
|
|uname.o:  uname.c defs.h
|	$(CC) $(CFLAGS) -c uname.c
|
|ndir.o: ndir.c ndir.h
|	$(CC) $(CFLAGS) -c ndir.c
|
|uurec:  uurec.c defs.h
|	$(CC) $(CFLAGS) -s uurec.c -o uurec
|
|recnews:  recnews.c defs.h
|	$(CC) $(CFLAGS) -s recnews.c -o recnews
|
|sendnews:  sendnews.o uname.o
|	$(CC) $(LFLAGS) sendnews.o uname.o -o sendnews
|
|batch:  batch.c Makefile
|	$(CC) $(CFLAGS) -s batch.c -o batch
|
|unbatch:  unbatch.c
|	$(CC) $(CFLAGS) -s unbatch.c -o unbatch
|
|caesar:  caesar.c
|	$(CC) $(CFLAGS) -s caesar.c -o caesar -lm
|
|# do NOT compile this with -O on a vax due to a bug in the optimizer
|compress: compress.c
|	$(CC) -o compress compress.c
|
|recmail:  recmail.c
|	$(CC) $(CFLAGS) -s recmail.c -o recmail
|
|process.o:  process.c rparams.h defs.h params.h header.h
|	$(CC) $(CFLAGS) -c process.c
|
|
|checknews:  Makefile checknews.o process.o cpathinit.o
|	$(CC) $(LFLAGS) checknews.o process.o cpathinit.o -o checknews
|
|csendbatch: csendbatch.sh Makefile
|	unixtovms csendbatch.sh
|	sed -e "s%LIBDIR%$(LIBDIR)%g" \
|	 -e "s%UUXFLAGS%$(UUXFLAGS)%g" \
|	 -e "s%BATCHDIR%$(BATCHDIR)%g" csendbatch.sh > csendbatch
|	unixtovms csendbatch
|
|sendbatch: sendbatch.sh Makefile
|	unixtovms sendbatch.sh
|	sed -e "s%LIBDIR%$(LIBDIR)%g" \
|	 -e "s%UUXFLAGS%$(UUXFLAGS)%g" \
|	 -e "s%BATCHDIR%$(BATCHDIR)%g" sendbatch.sh > sendbatch
|	unixtovms sendbatch
|
|cunbatch: cunbatch.sh Makefile
|	unixtovms cunbatch.sh
|	sed -e "s%LIBDIR%$(LIBDIR)%g" \
|	 -e "s%BINDIR%$(BINDIR)%g" cunbatch.sh > cunbatch
|	unixtovms cunbatch
|
|rmgroup: rmgroup.sh Makefile
|	unixtovms rmgroup.sh
|	sed -e "s%LIBDIR%$(LIBDIR)%g" \
|	 -e "s%SPOOLDIR%$(SPOOLDIR)%g" rmgroup.sh > rmgroup
|	unixtovms rmgroup
|
|checkgroups: checkgroups.sh Makefile
|	unixtovms checkgroups.sh
|	sed -e "s%LIBDIR%$(LIBDIR)%g" checkgroups.sh > checkgroups
|	unixtovms checkgroups
|
|sendnews.o: sendnews.c defs.h
|	$(CC) $(CFLAGS) -c sendnews.c
|
|fullname.o: defs.h
|
|expire: Makefile $(EXPOBJS)
|	$(CC) $(LFLAGS) -o expire $(EXPOBJS) $(LIBS)
|
|header.o:  header.c header.h defs.h
|	$(CC) $(CFLAGS) -c header.c
|
|expire.o:  expire.c defs.h Makefile params.h ndir.h header.h
|	$(CC) $(CFLAGS) -c expire.c
|
|digest.o:  digest.c
|	$(CC) $(CFLAGS) -c digest.c
|
|params.h: defs.h header.h
|
|# Some silliness here to get pathinit for both readnews & inews
|rpathinit.o:  pathinit.c rparams.h header.h params.h
|	$(CC) $(CFLAGS) $(HOMENAME) -DREAD -c pathinit.c
|	mv pathinit.o rpathinit.o
|
|ipathinit.o:  pathinit.c iparams.h header.h params.h
|	$(CC) $(CFLAGS) $(HOMENAME) -DINEW -c pathinit.c
|	mv pathinit.o ipathinit.o
|
|cpathinit.o:  pathinit.c iparams.h header.h params.h
|	$(CC) $(CFLAGS) $(HOMENAME) -DCHKN -c pathinit.c
|	mv pathinit.o cpathinit.o
|
|epathinit.o:  pathinit.c iparams.h header.h params.h
|	$(CC) $(CFLAGS) $(HOMENAME) -DEXP -c pathinit.c
|	mv pathinit.o epathinit.o
|
|vmsfuncs:o	vmsfuncs.c
|	$(CC) $(CFLAGS) -c vmsfuncs.c
|
|tags:	/tmp
|	ctags -w *.h *.c
|
|$(LIBDIR):
|	mkdir $(LIBDIR)
|	chmod 755 $(LIBDIR)
|	chown $(NEWSUSR) $(LIBDIR)
|	chgrp $(NEWSGRP) $(LIBDIR)
|
|$(BINDIR):
|	mkdir $(BINDIR)
|	chmod 755 $(BINDIR)
|	chown $(NEWSUSR) $(BINDIR)
|	chgrp $(NEWSGRP) $(BINDIR)
!-FUNKY-STUFF-!
echo x - vmsfuncs.c [file 4 of 4]
sed 's/^|//' > vmsfuncs.c << '!-FUNKY-STUFF-!'
|/*
| * vmsfuncs - perform various functions for news running under Eunice
| */
|#include <errno.h>
|extern int errno;
|
|/*
| * vmslink allows simulation of file linking under VMS.  It actually
| * performs a copy of the file.  It attempts to appear as link(2)
| * in most other respects.
| */
|vmslink(infile,outfile)
|char *infile, *outfile;
|{
|    int in, out;
|    char buf[2];
|
|    if ( (access(outfile,0) == 0) ) {
|	errno = EEXIST;
|	return -1;
|    }
|    
|    out = creat(outfile,0766);
|    if ( out == -1 ) {
|	errno = EACCES;
|	return -1;
|    }
|
|    in = open(infile, 0);
|    if ( in < 0 ) {
|	unlink(outfile);
|	errno = ENOENT;
|	return -1;
|    }
|
|    while( read(in, buf, 1) > 0 ) {
|	if ( write(out, buf, 1) != 1 ) {
|	    close(in);
|	    close(out);
|	    errno = EIO;
|	    return -1;
|	}
|    }
|
|    close(in);
|    close(out);
|    return 0;
|}
|
|
|/*
| * vmsdelete deletes all revisions of a file.  It attempts to
| * appear as unlink(2) under conventional Unix in other respects.
| */
|vmsdelete(file)
|char *file;
|{
|    int i;
|
|    i = unlink(file);
|    if ( i != 0 )
|	return i;
|
|    i = errno;
|    while ( unlink(file) == 0 ) ;
|    errno = i;
|
|    return 0;
|}
|
|/*
| * Convert a Unix file to a VMS fixed record format file by
| * executing the 'unixtovms' command.
| */
|unixtovms(file)
|char *file;
|{
|    char buf[128];
|    strcpy(buf,"exec /etc/unixtovms ");
|    strcat(buf,file);
|    return system(buf);
|}
|
|
|/*
| * Convert a VMS fixed record format file to a Unix file by
| * executing the 'vmstounix' command.
| */
|vmstounix(file)
|char *file;
|{
|    char buf[128];
|    strcpy(buf,"exec /etc/vmstounix ");
|    strcat(buf,file);
|    return system(buf);
|}
|
|
!-FUNKY-STUFF-!
exit
-- 

Chip Rosenthal, Intel/Santa Clara
{ idi|intelca|icalqa|kremvax|qubix|ucscc } ! t4test ! { chip|news }