Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2011 11:04:10 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Edwin Groothuis <edwin@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r223928 - head/usr.bin/calendar
Message-ID:  <201107111104.10409.jhb@freebsd.org>
In-Reply-To: <201107110824.p6B8OaFj082562@svn.freebsd.org>
References:  <201107110824.p6B8OaFj082562@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107111104.10409.jhb>