svn commit: r223928 - head/usr.bin/calendar

John Baldwin jhb at freebsd.org
Mon Jul 11 15:14:49 UTC 2011


On Monday, July 11, 2011 4:24:36 am Edwin Groothuis wrote:
> Author: edwin
> Date: Mon Jul 11 08:24:36 2011
> New Revision: 223928
> URL: http://svn.freebsd.org/changeset/base/223928
> 
> Log:
>   Fix the interpreter for:
>   
>   Jul/Sat+3       Every third saturday of July - Jul/Sat+3
>   
>   which was able to be done via:
>   
>   Jul/SatThird	Every third saturday of July - Jul/SatThird
>   
>   Add interpreters for:
>   
>   SatFourth	Every third saturday of each month - SatFourth
>   Sat+4           Every third saturday of each month - Sat+4
>   Sat 		Every saturday of each month - Sat
>   
>   MFC after:	2 weeks
> 
> Modified:
>   head/usr.bin/calendar/parsedata.c
> 
> Modified: head/usr.bin/calendar/parsedata.c
> ==============================================================================
> --- head/usr.bin/calendar/parsedata.c	Mon Jul 11 08:23:59 2011	(r223927)
> +++ head/usr.bin/calendar/parsedata.c	Mon Jul 11 08:24:36 2011	(r223928)
> @@ -548,6 +548,24 @@ parsedaymonth(char *date, int *yearp, in
> @@ -918,6 +936,16 @@ indextooffset(char *s)
>  	int i;
>  	struct fixs *n;
>  
> +	if (s[0] == '+' || s[0] == '-') {
> +		char ss[9];
> +		for (i = -100; i < 100; i++) {
> +			sprintf(ss, "%s%d", (i > 0) ? "+" : "", i);
> +			if (strcmp(ss, s) == 0)
> +				return (i);
> +		}
> +		return (0);
> +	}
> +

Hmm, did you consider using something like strtol instead?

-- 
John Baldwin


More information about the svn-src-head mailing list