From owner-freebsd-current Sat Feb 24 05:09:15 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id FAA28613 for current-outgoing; Sat, 24 Feb 1996 05:09:15 -0800 (PST) Received: from ibp.ibp.fr (ibp.ibp.fr [132.227.60.30]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id FAA28594 for ; Sat, 24 Feb 1996 05:09:10 -0800 (PST) Received: from blaise.ibp.fr (blaise.ibp.fr [132.227.60.1]) by ibp.ibp.fr (8.6.12/jtpda-5.0) with ESMTP id OAA15198 for ; Sat, 24 Feb 1996 14:07:46 +0100 Received: from (uucp@localhost) by blaise.ibp.fr (8.6.12/jtpda-5.0) with UUCP id OAA21043 for freebsd-current@FreeBSD.ORG; Sat, 24 Feb 1996 14:07:45 +0100 Received: (from roberto@localhost) by keltia.freenix.fr (8.7.3/keltia-uucp-2.7) id OAA23826 for freebsd-current@FreeBSD.ORG; Sat, 24 Feb 1996 14:06:15 +0100 (MET) From: Ollivier Robert Message-Id: <199602241306.OAA23826@keltia.freenix.fr> Subject: newsyslog To: freebsd-current@FreeBSD.ORG (FreeBSD Current Users' list) Date: Sat, 24 Feb 1996 14:06:14 +0100 (MET) X-Operating-System: FreeBSD 2.2-CURRENT ctm#1688 X-Mailer: ELM [version 2.4ME+ PL7 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.ORG Precedence: bulk Hi, I've modified newsyslog to be more like the rest of the utilities by creating a pathnames.h file and change a bit the symbols' names. Can someone review it and/or commit it (although I could do it, I'd rather have a review on the symbols, I'm not sure if my names are consistent). Index: Makefile =================================================================== RCS file: /spare/FreeBSD-current/src/usr.sbin/newsyslog/Makefile,v retrieving revision 1.2 diff -u -2 -u -r1.2 Makefile --- Makefile 1996/01/16 10:32:01 1.2 +++ Makefile 1996/02/24 12:54:27 @@ -3,10 +3,5 @@ PROG= newsyslog -CFLAGS+= -DOSF -CFLAGS+= -DCONF=\"/etc/newsyslog.conf\" -CFLAGS+= -DPIDFILE=\"/var/run/syslog.pid\" -CFLAGS+= -DCOMPRESS_PATH=\"/usr/bin/gzip\" -CFLAGS+= -DCOMPRESS_PROG=\"gzip\" -CFLAGS+= -DCOMPRESS_POSTFIX=\".gz\" +CFLAGS+= -DOSF -I. BINOWN= root Index: newsyslog.c =================================================================== RCS file: /spare/FreeBSD-current/src/usr.sbin/newsyslog/newsyslog.c,v retrieving revision 1.3 diff -u -2 -u -r1.3 newsyslog.c --- newsyslog.c 1996/01/16 10:32:04 1.3 +++ newsyslog.c 1996/02/24 12:57:55 @@ -33,20 +33,4 @@ #endif /* not lint */ -#ifndef CONF -#define CONF "/etc/athena/newsyslog.conf" /* Configuration file */ -#endif -#ifndef PIDFILE -#define PIDFILE "/etc/syslog.pid" -#endif -#ifndef COMPRESS_PATH -#define COMPRESS_PATH "/usr/ucb/compress" /* File compression program */ -#endif -#ifndef COMPRESS_PROG -#define COMPRESS_PROG "compress" -#endif -#ifndef COMPRESS_POSTFIX -#define COMPRESS_POSTFIX ".Z" -#endif - #include #include @@ -62,4 +46,6 @@ #include +#include "pathnames.h" + #define kbytes(size) (((size) + 1023) >> 10) #ifdef _IBMR2 @@ -95,5 +81,5 @@ int needroot = 1; /* Root privs are necessary */ int noaction = 0; /* Don't do anything, just show it */ -char *conf = CONF; /* Configuration file to use */ +char *conf = _PATH_NEWSYSLOG;/* Configuration file to use */ time_t timenow; int syslog_pid; /* read in from /etc/syslog.pid */ @@ -188,5 +174,5 @@ /* Let's find the pid of syslogd */ syslog_pid = 0; - f = fopen(PIDFILE,"r"); + f = fopen(_PATH_LOGPID,"r"); if (f && fgets(line,BUFSIZ,f)) syslog_pid = atoi(line); @@ -376,5 +362,5 @@ (void) sprintf(file1,"%s.%d",log,numdays); (void) strcpy(zfile1, file1); - (void) strcat(zfile1, COMPRESS_POSTFIX); + (void) strcat(zfile1, _SUFX_COMPRESS); if (noaction) { @@ -393,6 +379,6 @@ (void) strcpy(zfile2, file2); if (lstat(file1, &st)) { - (void) strcat(zfile1, COMPRESS_POSTFIX); - (void) strcat(zfile2, COMPRESS_POSTFIX); + (void) strcat(zfile1, _SUFX_COMPRESS); + (void) strcat(zfile2, _SUFX_COMPRESS); if (lstat(zfile1, &st)) continue; } @@ -473,6 +459,6 @@ err(1, "fork"); else if (!pid) { - (void) execl(COMPRESS_PATH,COMPRESS_PROG,"-f",tmp,0); - err(1, COMPRESS_PATH); + (void) execl(_PATH_COMPRESS,_NAME_COMPRESS,"-f",tmp,0); + err(1, _PATH_COMPRESS); } } @@ -494,9 +480,9 @@ { struct stat sb; - char tmp[MAXPATHLEN+sizeof(".0")+sizeof(COMPRESS_POSTFIX)+1]; + char tmp[MAXPATHLEN+sizeof(".0")+sizeof(_SUFX_COMPRESS)+1]; (void) strcpy(tmp,file); if (stat(strcat(tmp,".0"),&sb) < 0) - if (stat(strcat(tmp,COMPRESS_POSTFIX), &sb) < 0) + if (stat(strcat(tmp,_SUFX_COMPRESS), &sb) < 0) return(-1); return( (int) (timenow - sb.st_mtime + 1800) / 3600); --- /dev/null Thu Feb 22 23:53:45 1996 +++ pathnames.h Sat Feb 24 13:53:50 1996 @@ -0,0 +1,5 @@ +#define _PATH_NEWSYSLOG "/etc/newsyslog.conf" +#define _PATH_LOGPID "/var/run/syslog.pid" +#define _PATH_COMPRESS "/usr/bin/gzip" +#define _NAME_COMPRESS "gzip" +#define _SUFX_COMPRESS ".gz" -- Ollivier ROBERT -=- The daemon is FREE! -=- roberto@keltia.frmug.fr.net FreeBSD keltia.freenix.fr 2.2-CURRENT #1: Tue Feb 20 01:16:51 MET 1996