|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 4233 (0x1089) Types: TextFile Names: »main.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦f1ce22008⟧ »EurOpenD3/news/newsxd2.5.0.tar.Z« └─⟦caa165e81⟧ └─⟦this⟧ »main.c«
/* * #include <legal/bs.h> > > Copyright (c) 1989 Washington University in Saint Louis, Missouri and > Chris Myers. All rights reserved. > > Permission is hereby granted to copy, reproduce, redistribute or > otherwise use this software as long as: (1) there is no monetary > profit gained specifically from the use or reproduction of this > software, (2) it is not sold, rented, traded, or otherwise marketed, > (3) the above copyright notice and this paragraph is included > prominently in any copy made, and (4) that the name of the University > is not used to endorse or promote products derived from this software > without the specific prior written permission of the University. > THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR > IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED > WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. > */ #include "defs.h" /*************************************************************************/ /* FUNCTION : main */ /* PURPOSE : */ /* ARGUMENTS : argc and argv passed in by calling program */ /*************************************************************************/ void main(argc, argv, envp) int argc; char *argv[], *envp[]; { int loop, ltime, clock, sleeptime; FILE *pidout; struct tm *curtime; debug = 0; DEBUG = 0; newsxdebug = 0; (void) strcpy(configfile, default_configfile); (void) strcpy(statusfile, default_statusfile); (void) strcpy(pidfile, default_pidfile); #ifdef FAKESYSLOG (void) strcpy(fakelogfile, FAKESYSLOG); #endif FAKESYSLOG for (loop = 0; loop < argc; loop++) { if (strcmp(argv[loop], "-v") == 0) { (void) fprintf(stderr, "newsxd version %1.1f", VERSION); #if PATCHLEVEL > 0 (void) fprintf(stderr, "-%d", PATCHLEVEL); #endif (void) fprintf(stderr, ", written by Chris Myers <chris@wugate.wustl.edu>\n"); #ifdef SYSLOG (void) fprintf(stderr, "Logging to syslog\n"); #endif #ifdef FAKESYSLOG (void) fprintf(stderr, "Logging to %s\n", fakelogfile); #endif exit(0); } if (strcmp(argv[loop], "-debug") == 0) debug++; if (strcmp(argv[loop], "-DEBUG") == 0) { DEBUG++; debug++; } if (strcmp(argv[loop], "-newsxdebug") == 0) newsxdebug++; if ((strcmp(argv[loop], "-c") == 0) && (loop < argc - 1)) (void) strcpy(configfile, argv[++loop]); if ((strcmp(argv[loop], "-pid") == 0) && (loop < argc - 1)) (void) strcpy(pidfile, argv[++loop]); if ((strcmp(argv[loop], "-status") == 0) && (loop < argc - 1)) (void) strcpy(statusfile, argv[++loop]); #ifdef FAKESYSLOG if ((strcmp(argv[loop], "-log") == 0) && (loop < argc - 1)) (void) strcpy(fakelogfile, argv[++loop]); #endif } (void) signal(SIGCHLD, xmit_done); (void) signal(SIGHUP, read_config); (void) signal(SIGQUIT, dump_config); (void) signal(SIGTERM, kill_children); (void) signal(SIGUSR1, debug_on); (void) signal(SIGUSR2, debug_off); (void) signal(SIGIO, idle); (void) signal(SIGTRAP, dump_info); if (!debug) daemon_start(); #ifdef SYSLOG # ifdef LOG_LOCAL7 openlog("newsxd", LOG_PID, SYSLOG); # else openlog("newsxd", LOG_PID); # endif #endif log(LOG_INFO, "starting\n"); for (loop = 0; loop < MAXXMITTERS; loop++) { pidlist[loop] = 0; pidmap[loop] = (struct host *) NULL; } read_config(0); if (debug) dump_config(); pidout = fopen(pidfile, "w"); if (pidout != (FILE *)NULL) { (void) fprintf(pidout, "%d\n", getpid()); (void) fflush(pidout); (void) fclose(pidout); } while (1) { if (!daemon_idle) run_queue(); xmit_done(0); (void) time(&clock); curtime = localtime(&clock); ltime = curtime->tm_sec + curtime->tm_min * 60 + curtime->tm_hour * 3600; sleeptime = queueinterval - (ltime % queueinterval); if (sleeptime == 0) sleeptime++; dprintf("%d:sleeping for %d seconds\n", ltime, sleeptime); (void) sleep((unsigned) sleeptime); } }