Subject: bin/33994: Implement a XXX comment in job.c
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: User Foo <foo@porticoluna.org>
List: netbsd-bugs
Date: 07/13/2006 14:50:00
>Number:         33994
>Category:       bin
>Synopsis:       Implement a XXX comment in job.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 13 14:50:00 +0000 2006
>Originator:     foo@porticoluna.org (User Foo)
>Release:        NetBSD 3.99.21
>Organization:
	<organization of PR author (multiple lines)>
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD pl2 3.99.21 NetBSD 3.99.21 (PL2) #2: Fri Jun 23 01:12:03 CEST 2006 pancake@pl2:/home/build/obj/sys/arch/i386/compile/PL2 i386
Architecture: i386
Machine: i386
>Description:
	<precise description of the problem (multiple lines)>
This patch allows to use 15m or 1h syntax for the CRON_WITHIN environment variable
handled by the cron(8) daemon.

>How-To-Repeat:
	<code/input/activities to reproduce the problem (multiple lines)>
>Fix:
	<how to correct or work around the problem, if known (multiple lines)>
TODO: manpage must be updated to sync this change.

Index: usr.sbin/cron/job.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cron/job.c,v
retrieving revision 1.6
diff -u -r1.6 job.c
--- usr.sbin/cron/job.c	16 Mar 2005 02:53:55 -0000	1.6
+++ usr.sbin/cron/job.c	13 Jul 2006 14:22:11 -0000
@@ -115,9 +115,16 @@
 	if (within == NULL)
 		return (1);
 
-	/* XXX handle 2m, 4h, etc? */
 	errno = 0;
 	delta = strtol(within, &t, 10);
+	switch(within[strlen(within)-1]) {
+	case 'm':
+		delta *= 60;
+		break;
+	case 'h':
+		delta *= 360;
+		break;
+	}
 	if (errno == ERANGE || *t != '\0' || delta <= 0)
 		return (1);
 

>Unformatted:
 SEND-PR: -*- send-pr -*-
 SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
 SEND-PR: will all comments (text enclosed in `<' and `>').
 SEND-PR: 
 SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
 SEND-PR: manual if you are not sure how to fill out a problem report.
 SEND-PR:
 SEND-PR: NOTE: If you include a patch that corrects the problem, the
 SEND-PR: issue will probably be handled much more quickly.
 SEND-PR:
 SEND-PR: Choose from the following categories:
 SEND-PR:
 SEND-PR: bin               install           kern              
 SEND-PR: lib               misc              pkg               
 SEND-PR: port-acorn26      port-acorn32      port-algor        
 SEND-PR: port-alpha        port-amd64        port-amiga        
 SEND-PR: port-amigappc     port-arc          port-arm          
 SEND-PR: port-atari        port-bebox        port-cats         
 SEND-PR: port-cesfic       port-cobalt       port-dreamcast    
 SEND-PR: port-evbarm       port-evbmips      port-evbppc       
 SEND-PR: port-evbsh3       port-evbsh5       port-hp300        
 SEND-PR: port-hp700        port-hpcarm       port-hpcmips      
 SEND-PR: port-hpcsh        port-hppa         port-i386         
 SEND-PR: port-ia64         port-ibmnws       port-iyonix       
 SEND-PR: port-luna68k      port-m68k         port-mac68k       
 SEND-PR: port-macppc       port-mips         port-mipsco       
 SEND-PR: port-mmeye        port-mvme68k      port-mvmeppc      
 SEND-PR: port-netwinder    port-news68k      port-newsmips     
 SEND-PR: port-next68k      port-ofppc        port-pc532        
 SEND-PR: port-playstation2 port-pmax         port-pmppc        
 SEND-PR: port-powerpc      port-prep         port-sandpoint    
 SEND-PR: port-sbmips       port-sgimips      port-sh3          
 SEND-PR: port-sh5          port-shark        port-sparc        
 SEND-PR: port-sparc64      port-sun2         port-sun3         
 SEND-PR: port-vax          port-x68k         port-xen          
 SEND-PR: security          standards         toolchain         
 SEND-PR: xsrc              y2k               
 SEND-PR:
 To: gnats-bugs@gnats.NetBSD.org
 Subject: Support for 'm'inute and 'h'ours suffix for CRON_WITHIN
 From: pancake@phreaker.net
 Reply-To: pancake@phreaker.net
 X-send-pr-version: 3.95
 
 
 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>