[comp.sources.unix] v23i013: Netnews transmission daemon, Part03/03

rsalz@bbn.com (Rich Salz) (08/31/90)

Submitted-by: Chris Myers <chris@wugate.wustl.edu>
Posting-number: Volume 23, Issue 13
Archive-name: newsxd/part03

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents:  Makefile complex.conf log.c main.c newsxd.conf newsxd.h
# Wrapped by rsalz@litchi.bbn.com on Fri Jul 13 15:03:58 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo '          "shar: End of archive 3 (of 3)."'
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
  echo shar: Extracting \"'Makefile'\" \(4951 characters\)
  sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# 1. If the compiler complains about undefined structs, try removing the
X#    -DBSD4_2 in CFLAGS, below.
X#
X# 2. If the linker complains that it can't find 'index', change -DSTRCHR=index
X#    to -DSTRCHR=strchr in CFLAGS, below.
X
XCFLAGS=		-O -DBSD4_2 -DSTRCHR=index
XLINTFLAGS=	-abchx
XCC=		cc
XLIBS=		-lcnews
X
X# The uid and gid that newsxd (and the news transmitters) should run as
XOWNER=news
XGROUP=news
X
X# Where to put newsxd when it's compiled
XBINDIR=/usr/local/etc
X
X# Where to put the manpage and the manual section it's going into
XMANDIR=/usr/man/manl
XMANEXT=l
X
XSRCS=	config.c log.c main.c process.c util.c
XOBJS=	config.o log.o main.o process.o util.o
X
Xall: newsxd
X
Xnewsxd: ${OBJS}
X	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS}
X
Xclean:
X	rm -f ${OBJS} newsxd core
X
Xdepend: ${SRCS}
X	mkdep ${CFLAGS} ${SRCS}
X
Xinstall: newsxd newsxd.8
X	install -c -m 444 -o root -g staff newsxd.8 ${MANDIR}/newsxd.${MANEXT}
X	install -s -c -m 6755 -o ${OWNER} -g ${GROUP} newsxd ${BINDIR}
X
Xshar:
X	shar README Makefile *.c *.h *.conf newsxd.8 > newsxd.shar
X
Xlint: ${SRCS}
X	lint ${LINTFLAGS} ${CFLAGS} ${SRCS}
X
X# DO NOT DELETE THIS LINE -- mkdep uses it.
X# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
X
Xconfig.o: config.c defs.h /usr/include/stdio.h /usr/include/signal.h
Xconfig.o: /usr/include/strings.h /usr/include/syslog.h /usr/include/nlist.h
Xconfig.o: /usr/include/errno.h /usr/include/ctype.h /usr/include/sys/param.h
Xconfig.o: /usr/include/machine/param.h /usr/include/signal.h
Xconfig.o: /usr/include/sys/types.h /usr/include/sys/errno.h
Xconfig.o: /usr/include/sys/file.h /usr/include/sys/types.h
Xconfig.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
Xconfig.o: /usr/include/sys/ttydev.h /usr/include/sys/ttyio.h
Xconfig.o: /usr/include/sgtty.h /usr/include/sys/wait.h /usr/include/sys/types.h
Xconfig.o: /usr/include/sys/stat.h newsxd.h patchlevel.h /usr/include/time.h
Xconfig.o: /usr/include/sys/resource.h /usr/include/sys/../h/fixpoint.h
Xlog.o: log.c defs.h /usr/include/stdio.h /usr/include/signal.h
Xlog.o: /usr/include/strings.h /usr/include/syslog.h /usr/include/nlist.h
Xlog.o: /usr/include/errno.h /usr/include/ctype.h /usr/include/sys/param.h
Xlog.o: /usr/include/machine/param.h /usr/include/signal.h
Xlog.o: /usr/include/sys/types.h /usr/include/sys/errno.h
Xlog.o: /usr/include/sys/file.h /usr/include/sys/types.h
Xlog.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
Xlog.o: /usr/include/sys/ttydev.h /usr/include/sys/ttyio.h /usr/include/sgtty.h
Xlog.o: /usr/include/sys/wait.h /usr/include/sys/types.h /usr/include/sys/stat.h
Xlog.o: newsxd.h patchlevel.h /usr/include/time.h /usr/include/sys/resource.h
Xlog.o: /usr/include/sys/../h/fixpoint.h
Xmain.o: main.c defs.h /usr/include/stdio.h /usr/include/signal.h
Xmain.o: /usr/include/strings.h /usr/include/syslog.h /usr/include/nlist.h
Xmain.o: /usr/include/errno.h /usr/include/ctype.h /usr/include/sys/param.h
Xmain.o: /usr/include/machine/param.h /usr/include/signal.h
Xmain.o: /usr/include/sys/types.h /usr/include/sys/errno.h
Xmain.o: /usr/include/sys/file.h /usr/include/sys/types.h
Xmain.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
Xmain.o: /usr/include/sys/ttydev.h /usr/include/sys/ttyio.h /usr/include/sgtty.h
Xmain.o: /usr/include/sys/wait.h /usr/include/sys/types.h
Xmain.o: /usr/include/sys/stat.h newsxd.h patchlevel.h /usr/include/time.h
Xmain.o: /usr/include/sys/resource.h /usr/include/sys/../h/fixpoint.h
Xprocess.o: process.c defs.h /usr/include/stdio.h /usr/include/signal.h
Xprocess.o: /usr/include/strings.h /usr/include/syslog.h /usr/include/nlist.h
Xprocess.o: /usr/include/errno.h /usr/include/ctype.h /usr/include/sys/param.h
Xprocess.o: /usr/include/machine/param.h /usr/include/signal.h
Xprocess.o: /usr/include/sys/types.h /usr/include/sys/errno.h
Xprocess.o: /usr/include/sys/file.h /usr/include/sys/types.h
Xprocess.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
Xprocess.o: /usr/include/sys/ttydev.h /usr/include/sys/ttyio.h
Xprocess.o: /usr/include/sgtty.h /usr/include/sys/wait.h
Xprocess.o: /usr/include/sys/types.h /usr/include/sys/stat.h newsxd.h
Xprocess.o: patchlevel.h /usr/include/time.h /usr/include/sys/resource.h
Xprocess.o: /usr/include/sys/../h/fixpoint.h
Xutil.o: util.c defs.h /usr/include/stdio.h /usr/include/signal.h
Xutil.o: /usr/include/strings.h /usr/include/syslog.h /usr/include/nlist.h
Xutil.o: /usr/include/errno.h /usr/include/ctype.h /usr/include/sys/param.h
Xutil.o: /usr/include/machine/param.h /usr/include/signal.h
Xutil.o: /usr/include/sys/types.h /usr/include/sys/errno.h
Xutil.o: /usr/include/sys/file.h /usr/include/sys/types.h
Xutil.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
Xutil.o: /usr/include/sys/ttydev.h /usr/include/sys/ttyio.h /usr/include/sgtty.h
Xutil.o: /usr/include/sys/wait.h /usr/include/sys/types.h
Xutil.o: /usr/include/sys/stat.h newsxd.h patchlevel.h /usr/include/time.h
Xutil.o: /usr/include/sys/resource.h /usr/include/sys/../h/fixpoint.h
Xversion.o: version.c
X
X# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
END_OF_FILE
  if test 4951 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
  fi
  # end of 'Makefile'
fi
if test -f 'complex.conf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'complex.conf'\"
else
  echo shar: Extracting \"'complex.conf'\" \(3224 characters\)
  sed "s/^X//" >'complex.conf' <<'END_OF_FILE'
X# Define a series of service classes for sending news to other sites:
X#     nlink     NNTPlink Transmits (Continuous NNTPXMITs)
X#     high      High Priority Transmits (Top-40)
X#     med       Medium Prio Transmits (Non Top-40)
X#     low       Low Priority Transmits (Endnodes)
X#     batch     Batched (with sendbatch) newsfeeds
X
Xclass   nlink   maxxmits=20 interval=60    maxload=10  noworkfile
Xxmit    nlink   /usr/local/lib/news/nntplink nntplink %h:%b
X
Xclass   high    maxxmits=99 interval=60/20 maxload=8   ttl=1800
X
Xclass   med     maxxmits=5  interval=300   maxload=6   ttl=1800/60
X
Xclass   low     maxxmits=3  interval=1200  maxload=5   ttl=1100/60   nice=10
X
Xclass   batch   maxxmits=1  interval=3600  maxload=5   ttl=1800/1800
Xxmit    batch   /usr/local/lib/news/sendbatch sendbatch %f %h
X
X# Define the default news transmitter
Xxmit    DEFAULT /usr/local/lib/news/nntpxmit nntpxmit %h:%w
X
X# Check the transmit queue every <n> seconds (this should be at least as
X# low as the smallest "interval" in all of the transmission classes).
Xqueueinterval    20
X
X# In all of the following options, %s is replaced by the host name of the
X# system being sent to.
X
X# File news places articles paths/ids in
Xbatchfile   /usr/spool/batch/%s
X
X# File a news transmitter wants articles paths/ids in
Xworkfile    /usr/spool/batch/%s.work
X
X# Where to log the output of a news transmitter (default is /dev/null)
X# [leave it as the default of /dev/null for now]
X# nntplogs   /usr/spool/batch/%s.log
X
X# Hosts to send news to.  Each line is of the format:
X#                            CLASS   VALID START
X# host HOSTNAME              NAME       TIMES          OPTIONS
X
Xhost dorothy                 low     Any
Xhost toto                    low     Any
Xhost wizard                  low     Any
Xhost witch                   low     Any
Xhost tinman                  low     Any
Xhost lion                    low     Any
Xhost cactus.biz.com          low     Any
Xhost endnode.foobar.edu      low     Any2000-0500
Xhost biggernode.foobar.edu   med     SaSu|Wk1730-0730
Xhost bignode.company.com     med     Any
Xhost midsize.company.com     med     Any
Xhost university.podunk.edu   med     Any
Xhost mrbackbone.bigu.edu     high    Any
Xhost gateway.bizness.com     high    Any
Xhost supernews.hellou.edu    high    Any
Xhost mrnntp.aloha.edu        high    Any
Xhost hello.world.edu         high    Any
Xhost supernews.foou.edu      nlink   Any
Xhost backbone.newssite.edu   nlink   Any
Xhost fred                    batch   Any nice=20 flags=-s500000 interval=86400
Xhost barney                  batch   Any nice=20 flags=-s250000 interval=86400
Xhost wilma                   batch   Any nice=20 flags=-s500000
Xhost betty                   batch   Any nice=20 flags=-s500000|-m500000
Xhost kitty                   batch   SaSu|Wk1730-730 flags=-c|-s250000
Xhost dino                    batch   SaSu|Wk1730-730 flags=-c|-s250000
Xhost bambam                  batch   Sa interval=86400
X
X# Notes: Only send news to biggernode.foobar.edu during non-business hours
X#        endnode.foobar.edu only wants news transmitted from 8PM to 5AM.
X#        Only send news to fred and barney once per day (every 24 hours).
X#        Do one batching run for bambam each Saturday.
END_OF_FILE
  if test 3224 -ne `wc -c <'complex.conf'`; then
    echo shar: \"'complex.conf'\" unpacked with wrong size!
  fi
  # end of 'complex.conf'
fi
if test -f 'log.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'log.c'\"
else
  echo shar: Extracting \"'log.c'\" \(5400 characters\)
  sed "s/^X//" >'log.c' <<'END_OF_FILE'
X/*
X * #include <legal/bs.h>
X >
X > Copyright (c) 1989 Washington University in Saint Louis, Missouri and
X > Chris Myers. All rights reserved.
X >
X > Permission is hereby granted to copy, reproduce, redistribute or
X > otherwise use this software as long as: (1) there is no monetary
X > profit gained specifically from the use or reproduction of this
X > software, (2) it is not sold, rented, traded, or otherwise marketed,
X > (3) the above copyright notice and this paragraph is included
X > prominently in any copy made, and (4) that the name of the University
X > is not used to endorse or promote products derived from this software
X > without the specific prior written permission of the University.
X > THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X > IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X > WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X >
X */
X
X#include "defs.h"
X
X/*************************************************************************/
X/* FUNCTION  : log                                                       */
X/* PURPOSE   : Log messages to syslog or a log file, as defined in       */
X/*             newsxd.h.  If debug or DEBUG is set, log to stderr.       */
X/* ARGUMENTS : Log priority, message to log, and message parameters      */
X/*************************************************************************/
X
Xvoid
Xlog(priority, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) /*VARARGS2*/
X    int  priority;
X    char *message, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10;
X
X{
Xstatic  FILE    *logfile = NULL;
Xlong    clock;
Xextern  int     errno;
Xchar    buffer[30];
X
X   if ((debug > 0) || (DEBUG > 0)) {
X      (void) fprintf(stderr, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X      return;
X   }
X
X#if     defined(SYSLOG)
X   syslog(priority, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X#endif
X
X#if     defined(FAKESYSLOG)
X   if ((logfile != NULL) && (CONFIGCHANGEDFILE)) {
X       (void) fclose(logfile);
X       logfile = NULL;
X       CONFIGCHANGEDFILE = 0;
X   }
X   if (logfile == NULL) {
X      logfile = fopen(fakelogfile, "a");
X   }
X
X   if (logfile != NULL) {
X      (void) time(&clock);
X      (void) strcpy(buffer, ctime(&clock));
X      *index(buffer, '\n') = ' ';
X      (void) fputs(buffer, logfile);
X      (void) fprintf(logfile, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X      (void) fflush(logfile);
X   }
X#endif
X
X}
X
X/*************************************************************************/
X/* FUNCTION  : logerr                                                    */
X/* PURPOSE   : Log an error to syslog                                    */
X/* ARGUMENTS : Message to log, and message parameters                    */
X/*************************************************************************/
X
Xvoid
Xlogerr(message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) /*VARARGS1*/
X    char *message, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10;
X
X{
X
X   log(LOG_ERR, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X
X}
X
X/*************************************************************************/
X/* FUNCTION  : Dprintf                                                   */
X/* PURPOSE   : Do COPIOUS debugging logging                              */
X/* ARGUMENTS : Message to log, and message parameters                    */
X/*************************************************************************/
X
Xvoid
XDprintf(message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) /*VARARGS1*/
X    char *message, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10;
X
X{
X
X   if (DEBUG != 0)
X      log(LOG_DEBUG, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X
X}
X
X/*************************************************************************/
X/* FUNCTION  : dprintf                                                   */
X/* PURPOSE   : Do normal debugging logging                               */
X/* ARGUMENTS : Message to log, and message parameters                    */
X/*************************************************************************/
X
Xvoid
Xdprintf(message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) /*VARARGS1*/
X    char *message, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10;
X
X{
X
X   if (debug != 0)
X      log(LOG_DEBUG, message, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
X
X}
X
X/*************************************************************************/
X/* FUNCTION  : debug_off                                                 */
X/* PURPOSE   : Increase debugging level during program execution         */
X/* ARGUMENTS : none                                                      */
X/*************************************************************************/
X
Xvoid
Xdebug_on()
X
X{
X
X   if (debug) DEBUG = -1; else debug = -1;
X   log(LOG_INFO, "Debugging changed to debug %s, DEBUG %s\n",
X      debug ? "On" : "Off", DEBUG ? "On" : "Off");
X
X}
X
X/*************************************************************************/
X/* FUNCTION  : debug_off                                                 */
X/* PURPOSE   : Reduce debugging level during program execution           */
X/* ARGUMENTS : none                                                      */
X/*************************************************************************/
X
Xvoid
Xdebug_off()
X
X{
X
X   if (DEBUG) DEBUG = 0; else debug = 0;
X   log(LOG_INFO, "Debugging changed to debug %s, DEBUG %s\n",
X      debug ? "On" : "Off", DEBUG ? "On" : "Off");
X
X}
END_OF_FILE
  if test 5400 -ne `wc -c <'log.c'`; then
    echo shar: \"'log.c'\" unpacked with wrong size!
  fi
  # end of 'log.c'
fi
if test -f 'main.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'main.c'\"
else
  echo shar: Extracting \"'main.c'\" \(4631 characters\)
  sed "s/^X//" >'main.c' <<'END_OF_FILE'
X/*
X * #include <legal/bs.h>
X >
X > Copyright (c) 1989 Washington University in Saint Louis, Missouri and
X > Chris Myers. All rights reserved.
X >
X > Permission is hereby granted to copy, reproduce, redistribute or
X > otherwise use this software as long as: (1) there is no monetary
X > profit gained specifically from the use or reproduction of this
X > software, (2) it is not sold, rented, traded, or otherwise marketed,
X > (3) the above copyright notice and this paragraph is included
X > prominently in any copy made, and (4) that the name of the University
X > is not used to endorse or promote products derived from this software
X > without the specific prior written permission of the University.
X > THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X > IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X > WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X >
X */
X
X#include "defs.h"
Xchar	*progname = "newsxd";
X
X/*************************************************************************/
X/* FUNCTION  : main                                                      */
X/* PURPOSE   :                                                           */
X/* ARGUMENTS : argc and argv passed in by calling program                */
X/*************************************************************************/
X
Xvoid
Xmain(argc, argv, envp)
X   int  argc;
X   char *argv[], *envp[];
X
X{
Xint     loop,
X        ltime,
X        clock,
X	pid,
X        sleeptime;
X
XFILE    *pidout;
X
Xstruct  tm      *curtime;
X
X   debug = 0;
X   DEBUG = 0;
X   newsxdebug = 0;
X
X   (void) strcpy(configfile, default_configfile);
X   (void) strcpy(statusfile, default_statusfile);
X   (void) strcpy(pidfile, default_pidfile);
X#ifdef  FAKESYSLOG
X   (void) strcpy(fakelogfile, FAKESYSLOG);
X#endif  FAKESYSLOG
X
X   for (loop = 0; loop < argc; loop++) {
X
X      if (strcmp(argv[loop], "-v") == 0) {
X         (void) fprintf(stderr, "newsxd version %1.1f", VERSION);
X#if	PATCHLEVEL > 0
X         (void) fprintf(stderr, "-%d", PATCHLEVEL);
X#endif
X         (void) fprintf(stderr, ", written by Chris Myers <chris@wugate.wustl.edu>\n");
X#ifdef SYSLOG
X         (void) fprintf(stderr, "Logging to syslog\n");
X#endif
X#ifdef FAKESYSLOG
X         (void) fprintf(stderr, "Logging to %s\n", fakelogfile);
X#endif
X         exit(0);
X      }
X      if (strcmp(argv[loop], "-debug") == 0) debug++;
X      if (strcmp(argv[loop], "-DEBUG") == 0) { DEBUG++; debug++; }
X      if (strcmp(argv[loop], "-newsxdebug") == 0) newsxdebug++;
X      if ((strcmp(argv[loop], "-c") == 0) && (loop < argc - 1))
X         (void) strcpy(configfile, argv[++loop]);
X      if ((strcmp(argv[loop], "-pid") == 0) && (loop < argc - 1))
X         (void) strcpy(pidfile, argv[++loop]);
X      if ((strcmp(argv[loop], "-status") == 0) && (loop < argc - 1))
X         (void) strcpy(statusfile, argv[++loop]);
X#ifdef  FAKESYSLOG
X      if ((strcmp(argv[loop], "-log") == 0) && (loop < argc - 1))
X         (void) strcpy(fakelogfile, argv[++loop]);
X#endif
X
X   }
X
X   (void) signal(SIGCHLD, xmit_done);
X   (void) signal(SIGHUP, read_config);
X   (void) signal(SIGQUIT, dump_config);
X   (void) signal(SIGTERM, kill_children);
X   (void) signal(SIGUSR1, debug_on);
X   (void) signal(SIGUSR2, debug_off);
X   (void) signal(SIGIO, idle);
X   (void) signal(SIGIOT, reset);
X   (void) signal(SIGTRAP, dump_info);
X
X   (void) setuid(geteuid());
X   (void) setgid(getegid());
X
X   if (!debug) daemon_start();
X
X#ifdef  SYSLOG
X# ifdef LOG_LOCAL7
X   openlog("newsxd", LOG_PID, SYSLOG);
X# else
X   openlog("newsxd", LOG_PID);
X# endif
X#endif
X
X   pidout = fopen(pidfile, "r");
X   if (pidout != (FILE *) NULL) {
X      (void) fscanf(pidout, "%d", &pid);
X      (void) fclose(pidout);
X      if (kill(pid, 0) == 0) {
X         logerr("duplicate invocation of newsxd -- aborting\n");
X         (void) exit(1);
X      }
X   }
X
X   log(LOG_INFO, "starting\n");
X
X   for (loop = 0; loop < MAXXMITTERS; loop++) {
X      pidlist[loop] = 0;
X      pidmap[loop] = (struct host *) NULL;
X   }
X
X   read_config(0);
X
X   if (debug) dump_config();
X
X   pidout = fopen(pidfile, "w");
X
X   if (pidout != (FILE *) NULL) {
X      (void) fprintf(pidout, "%d\n", getpid());
X      (void) fflush(pidout);
X      (void) fclose(pidout);
X   }
X
X   while (1) {
X      if (!daemon_idle) run_queue();
X
X      xmit_done(0);
X
X      (void) time(&clock);
X      curtime = localtime(&clock);
X      ltime = curtime->tm_sec + curtime->tm_min * 60 + curtime->tm_hour * 3600;
X
X      sleeptime = queueinterval - (ltime % queueinterval);
X      if (sleeptime == 0) sleeptime++;
X
X      dprintf("%d:sleeping for %d seconds\n", ltime, sleeptime);
X
X      (void) sleep((unsigned) sleeptime);
X
X   }
X}
END_OF_FILE
  if test 4631 -ne `wc -c <'main.c'`; then
    echo shar: \"'main.c'\" unpacked with wrong size!
  fi
  # end of 'main.c'
fi
if test -f 'newsxd.conf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'newsxd.conf'\"
else
  echo shar: Extracting \"'newsxd.conf'\" \(3432 characters\)
  sed "s/^X//" >'newsxd.conf' <<'END_OF_FILE'
X# Define transmission service classes and alternate transmitters
X# 	nlink	NNTPlink Transmits (Continuous NNTPXMITs)
X# 	high	High Priority Transmits (Top-40)
X# 	med	Medium Prio Transmits (Non Top-40)
X# 	low	Low Priority Transmits (Endnodes)
X
Xclass	nlink	maxxmits=99 interval=60    maxload=10  noworkfile debug=-d
Xxmit	nlink	/usr/local/lib/news/nntplink nntplink -L100 %d %h:%b
X
Xclass	high	maxxmits=3  interval=1800  maxload=8   debug=-d
X
Xclass	med	maxxmits=3  interval=7200  maxload=6   nice=15    debug=-d
X
Xclass	low	maxxmits=2  interval=14400 maxload=4   nice=15    debug=-d
X
Xclass	batch	maxxmits=1  interval=14400 maxload=6   nice=15
Xxmit	batch	/usr/local/lib/news/sendbatch sendbatch %f %h
X
X# define the default transmitter
Xxmit DEFAULT /usr/local/lib/news/nntpxmit nntpxmit %d %h:%w
X
X# Check the transmit queue every <n> seconds (this should be at least as low
X# as the smallest "interval" in all of the transmission classes).
Xqueueinterval	20
X
X# In all of the following options, %s is replaced by the host name of the
X# system being sent to.
X
X# File news places articles paths/ids in
Xbatchfile	/usr/spool/batch/%s
X
X# File a news transmitter wants articles paths/ids in
Xworkfile	/usr/spool/batch/%s.work
X
X# Where to log the output of a news transmitter (default is /dev/null)
X# xmitlogs	/tmp/paramlog
X
X# Hosts to send news to.  Each line is of the format:
X#                               CLASS   VALID XMIT
X# host HOSTNAME			NAME 	   TIMES       OPTIONS
X
Xhost cec2			high    Any    
Xhost dinorah			high    Any
Xhost gauss			low	Any	       
Xhost wubios			high    Any    
Xhost wuche2                     high    Any            
Xhost wuibc                      low	Any
Xhost wuphys			low	Any	       
X# host sbctri.sbc.com		low	Any	       
Xhost brazos.rice.edu		low	Any	       
Xhost kuhub.cc.ukans.edu         nlink   Any
X# host wums2			low	Any	flags=-D
Xhost rouge.usl.edu		low	Any
Xhost husc6.harvard.edu		med	Any            
Xhost swbatl.sbc.com		med     Any        
Xhost dogie.macc.wisc.edu        high    Any            
Xhost emory.mathcs.emory.edu     high    Any            
Xhost eddie.mit.edu              high    Any            
Xhost decwrl.dec.com		nlink   Any flags=-C200
Xhost mailrus.cc.umich.edu	nlink   Any flags=-C200
Xhost nigel.ee.udel.edu          nlink   Any flags=-C200
Xhost psuvax1.cs.psu.edu		nlink   Any flags=-C200
Xhost rex.cs.tulane.edu		nlink   Any flags=-C200
Xhost s.ms.uky.edu		nlink   Any flags=-C200
Xhost uwm.edu			nlink   Any flags=-C200
Xhost tness7.sbc.com		nlink	Any flags=-C200
Xhost uunet.uu.net		nlink   Any flags=-C1000000
Xhost bu.edu			nlink   Any flags=-C200
Xhost usc.edu                    nlink   Any flags=-C200
Xhost zaphod.mps.ohio-state.edu	nlink   Any flags=-C200
Xhost cs.utexas.edu		nlink   Any flags=-C200
Xhost brutus.cs.uiuc.edu		nlink	Any flags=-C200
Xhost wums2			batch   Any flags=-s500000
Xhost dranet                     batch   Any flags=-s250000
Xhost biolgy                     batch   Any flags=-s500000
Xhost crygtw			batch   SaSu|Wk1730-730 flags=-s250000|-c
Xhost jgaltstl                   batch   SaSu|Wk1730-730 flags=-c|-s250000|-m10000000
Xhost plus5                      batch   SaSu|Wk1730-730 flags=-c|-s250000|-m10000000
Xhost slustl                     batch   SaSu|Wk1730-730 flags=-c|-s250000|-m10000000
Xhost hpuslma                    batch   SaSu|Wk1730-730 flags=-c|-s250000|-m10000000
Xhost hilco2                     batch   SaSu|Wk1730-730 flags=-c|-s250000|-m10000000
END_OF_FILE
  if test 3432 -ne `wc -c <'newsxd.conf'`; then
    echo shar: \"'newsxd.conf'\" unpacked with wrong size!
  fi
  # end of 'newsxd.conf'
fi
if test -f 'newsxd.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'newsxd.h'\"
else
  echo shar: Extracting \"'newsxd.h'\" \(3723 characters\)
  sed "s/^X//" >'newsxd.h' <<'END_OF_FILE'
X/*
X * USER CONFIGURABLE OPTIONS
X */
X
X#define	default_configfile	"/usr/local/etc/newsxd.conf"
X#define	default_pidfile		"/usr/tmp/newsxd.pid"
X#define	default_statusfile	"/usr/tmp/newsxd.status"
X
X/*
X * If you run CNEWS, enable CNEWS-compatible locking by defining the
X * CNEWSLOCKING symbol.  If you don't do this, there is a race condition
X * than can result in some articles not being transmitted
X *
X * If CNEWSLOCKING is enabled, after renaming the batch file to the work file,
X * each transmitter attempts to lock and then immediately unlock the news
X * system to ensure that relaynews is no longer writing into the batch file.
X */
X
X#define CNEWSLOCKING
X
X/*
X * CNEWS sites will probably want to define default_workfile and
X * default_batchfile in the following manner:
X *
X * #define default_batchfile	"/usr/spool/out.going/%s/togo"
X * #define default_workfile	"/usr/spool/out.going/%s/togo.work"
X */
X
X#define	default_batchfile	"/usr/spool/batch/%s"
X#define	default_workfile	"/usr/spool/batch/%s.work"
X
X#define	default_xmitlogs	"/dev/null"
X
X/*
X * MAXXMITTERS is the maximum number of transmitters that newsxd will
X * support.  MAXCLASSXMITTERS is used to define the dimensions of an array
X * used to quickly map PIDs back to particular transmitters.
X */
X
X#define MAXXMITTERS		200
X#define MAXCLASSXMITTERS	100
X
X/*
X * Define SYSLOG if you want logging via syslog.  If so, define SYSLOG to
X * the facility to log at as defined in <syslog.h>.  This is usually 
X * something like LOG_NEWS or LOG_LOCAL7.
X *
X * If your system doesn't support syslog or you don't want to use syslog,
X * you can have newsxd log to a file instead by defining FAKESYSLOG to be
X * the name of the file to log to.
X *
X * If you are planning on turning on debugging while newsxd is running (by
X * using SIGUSR1), you should STRONGLY CONSIDER using FAKESYSLOG.  Enabling
X * one level of debugging can log several MBytes/hour of debugging info and
X * enabling full debugging will easily triple that amount.  This will do bad
X * things to your syslogd!
X *
X * DO NOT DEFINE BOTH SYSLOG AND FAKESYSLOG
X *
X */
X
X/* #define	SYSLOG			LOG_NEWS	/* normal syslog */
X#define FAKESYSLOG		"/usr/tmp/newsxd.log"	/* fake log file */
X
X/*
X * Things you probably shouldn't change unless modifying newsxd
X */
X
X#define	MAXCLASSFLAGS		2	/* number of defined class flags */
X#define	MAXEXECARGS		16	/* max number of args to execv */
X
X#define MAXTIMENAMELEN		40	/* max len of UUCP L.sys-style time */
X#define	MAXCLASSNAMELEN		8	/* max length of a class name */
X
X#define	C_NOWORK		0	/* Don't rename batchfile->workfile */
X#define	C_NOBATCH		1	/* Don't look for batchfile */
X
X/*
X * Why isn't a transmitter running (used in status display)
X */
X
X
Xstatic char *wnlist[] = {
X               "TTL Penlty",
X#define WN_PENALTYTIME		0	/* host went over ttl, now penalized */
X               "TTL Kill",
X#define WN_TTL			1	/* host hit ttl, killed xmit */
X               "Class Intv",
X#define WN_CLASSSTARTINT	2	/* started xmit this class recently */
X               "Host Intvl",
X#define WN_HOSTSTARTINT		3	/* started xmit this host recently */
X               "High Load",
X#define WN_LOAD			4	/* load too high */
X               "Wrong Time",
X#define WN_BADTIME		5	/* wrong time to xmit */
X               "Max Xmits",
X#define WN_MAXXMITS		6	/* too many transmitters running */
X               "RUNNING",
X#define WN_RUNNING		7	/* it's running! */
X               "No Work",
X#define WN_NOWORK		8	/* no work to transmit */
X               "Bad Rename",
X#define WN_RENAMEFAILED		9	/* couldn't rename batch -> workfile */
X               "NotMyTurn",
X#define WN_NOTMYTURN		10	/* give other host a chance to xmit */
X               "No Slot!"
X#define WN_NOSLOT		11	/* no class slot, recompile newsxd */
X};
END_OF_FILE
  if test 3723 -ne `wc -c <'newsxd.h'`; then
    echo shar: \"'newsxd.h'\" unpacked with wrong size!
  fi
  # end of 'newsxd.h'
fi
echo shar: End of archive 3 \(of 3\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still must unpack the following archives:
    echo "        " ${MISSING}
fi
exit 0
exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.