Package-Name: dcron
Gentoo-Package: sys-process/dcron
Requires: ex-vi|vim
Source: ibibliolinux:///system/daemons/cron/dcron-(\d+.\d+(.\d+)?).tar.gz $1
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
Compile:
	mv -f CHANGES COPYING README "$(PREFIX)/"
	$(MAKE) CFLAGS='-O2 -DPATH_VI=\"/bin/vi\" -DSENDMAIL=\"/usr/sbin/sendmail\"'
	umask 022 ; mkdir -p "$(PREFIX)"/{bin,etc,sbin,man/man{1,8}}
	mv -f crontab "$(PREFIX)"/bin/
	mv -f crontab.1 "$(PREFIX)"/man/man1
	mv -f crond.init "$(PREFIX)"/etc/
	mv -f crond "$(PREFIX)"/sbin/
	mv -f crond.8 "$(PREFIX)"/man/man8/
	chmod 700 "$(PREFIX)"/etc/crond.init
Install:
	chmod 4711 "$(PREFIX)"/bin/crontab
	$(MAKE) instbin BIN=crontab
	$(MAKE) instsbin SBIN=crond
	$(MAKE) instman SECTION=1 MAN=crontab
	$(MAKE) instman SECTION=8 MAN=crond
	$(MAKE) instinit SRC=etc/crond.init DEST=crond S=3/15
	mkdir -p /var/spool/cron/crontabs
Patch: <<EOT
######## begin logfile patch
--- defs.h.old	1997-09-06 04:44:32 +0900
+++ defs.h	2004-01-11 20:22:56 +0900
@@ -49,6 +49,9 @@
 #ifndef PATH_VI
 #define PATH_VI		"/usr/bin/vi"	/* location of vi	*/
 #endif
+#ifndef LOGFILE
+#define LOGFILE		"/var/log/cron"
+#endif
 
 
 #define VERSION	"2.3.2"
--- subs.c.old	1998-02-17 04:35:10 +0900
+++ subs.c	2004-01-11 20:22:56 +0900
@@ -17,6 +17,8 @@
 Prototype int slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate);
 Prototype char *strdup(const char *);
 
+static int log_fd = -1;
+
 void 
 log9(const char *ctl, ...)
 {
@@ -67,6 +69,12 @@
     static short useDate = 1;
 
     if (level >= LogLevel) {
+	if (fd == 2) {
+	    if (log_fd < 0)
+		log_fd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0600);
+	    if (log_fd >= 0)
+		fd = log_fd;
+	}
         write(fd, buf, n = slog(buf, sizeof(buf), ctl, va, useDate));
 	useDate = (n && buf[n-1] == '\n');
     }
######## end logfile patch
--- defs.h.old	1997-09-06 04:44:32 +0900
+++ defs.h	2002-11-24 19:18:27 +0900
@@ -79,5 +79,7 @@
 #define RUN_RUNNING	2
 #define RUN_FAILED	3
 
+#undef strdup
+#define strdup strdup_
 #include "protos.h"
 
--- crontab.c.old	1997-08-31 16:30:40 +0900
+++ crontab.c	2004-01-11 19:25:35 +0900
@@ -136,7 +136,7 @@
      */
 
     if (chdir(CDir) < 0) {
-        fprintf(stderr, "cannot change diir to %s: %s\n", CDir, strerror(errno));
+        fprintf(stderr, "cannot change dir to %s: %s\n", CDir, strerror(errno));
         exit(1);
     }
 
@@ -201,7 +201,7 @@
 		close(fd);
 		rename(path, pas->pw_name);
 	    } else {
-		fprintf(stderr, "unable to create %s/%s\n", CDir, buf);
+		fprintf(stderr, "unable to create %s/%s\n", CDir, path);
 	    }
 	    close(repFd);
 	}
--- subs.c.old	1998-02-17 04:35:10 +0900
+++ subs.c	2002-11-24 19:18:57 +0900
@@ -80,7 +80,7 @@
 
     buf[0] = 0;
     if (useDate)
-	strftime(buf, 128, "%d-%b-%y %H:%M  ", tp);
+	strftime(buf, 128, "%d-%b-%Y %H:%M  ", tp);
     vsnprintf(buf + strlen(buf), sz - strlen(buf), ctl, va);
     return(strlen(buf));
 }
diff -urN ../dcron-2.3.3-orig/crond.init crond.init
--- ../dcron-2.3.3-orig/crond.init	1970-01-01 09:00:00 +0900
+++ crond.init	2003-07-03 11:30:33 +0900
@@ -0,0 +1,4 @@
+#!/bin/sh
+# If you want cron to actually log activity to /var/log/cron, then change
+# -l10 to -l8 to increase the logging level.
+exec /etc/rc.d/init.d/generic-daemon "$1" crond -l10 >>/var/log/cron
EOT

-/var/log/cron
-/var/spool/cron/
/etc/rc.d/init.d/crond
/etc/rc.d/rc3.d/[Ss]15crond
/pkg/dcron/
/usr/bin/crontab
/usr/man/man1/crontab.1.gz
/usr/man/man8/crond.8.gz
/usr/sbin/crond
/var/log/cron
/var/spool/cron/
