Subject: Re: bin/20319
To: Jeremy C. Reed <reed@reedmedia.net>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 07/22/2005 09:19:40
--UugvWAfsgieZRqgk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Fri, Jul 15, 2005 at 05:07:02AM +0000, Jeremy C. Reed wrote:
>The following reply was made to PR bin/20319; it has been noted by GNATS.
>
>From: "Jeremy C. Reed" <reed@reedmedia.net>
>To: gnats-bugs@netbsd.org
>Cc:
>Subject: Re: bin/20319
>Date: Thu, 14 Jul 2005 22:06:06 -0700 (PDT)
>
> This appears to work better.
>
> diff -b -u -r1.37 calendar.c
> --- usr.bin/calendar/calendar.c 2 Jun 2005 01:39:24 -0000 1.37
> +++ usr.bin/calendar/calendar.c 15 Jul 2005 05:02:31 -0000
> @@ -256,7 +256,8 @@
> if (flags & F_ISDAY || v1 > 12) {
> /* found a day */
> day = v1;
> - month = tp->tm_mon + 1;
> + v2 = getfield(endp, &endp, &flags);
> + month = v2;
> } else if (flags & F_ISMONTH) {
> month = v1;
> /* if no recognizable day, assume the first */
>
>
> (By the way, why fall back to day 1?)
so that "july" means "july 1st", i presume. the assumption is that
"no recognizable day" happened because there was no day indicated.
try the attached patch?
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
werdna@squooshy.com * "information is power -- share the wealth."
--UugvWAfsgieZRqgk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="calendar.patch1"
? calendar.c.ypfix-19121
? calendar.input
? calendar.output
? calendar.patch1
? calendar.tmp
? mktest
? test
Index: calendar.c
===================================================================
RCS file: /cvsroot/src/usr.bin/calendar/calendar.c,v
retrieving revision 1.37
diff -u -r1.37 calendar.c
--- calendar.c 2 Jun 2005 01:39:24 -0000 1.37
+++ calendar.c 22 Jul 2005 13:17:37 -0000
@@ -275,13 +275,15 @@
}
}
- if (flags & (F_WILDMONTH|F_WILDDAY))
+ if ((flags & (F_WILDMONTH|F_WILDDAY)) == (F_WILDMONTH|F_WILDDAY))
return (1);
- if ((flags & (F_WILDMONTH|F_ISDAY)) && (day == tp->tm_mday))
+ if (((flags & (F_WILDMONTH|F_ISDAY)) == (F_WILDMONTH|F_ISDAY)) &&
+ (day == tp->tm_mday))
return (1);
- if ((flags & (F_ISMONTH|F_WILDDAY)) && (month == tp->tm_mon + 1))
+ if (((flags & (F_ISMONTH|F_WILDDAY)) == (F_ISMONTH|F_WILDDAY)) &&
+ (month == tp->tm_mon + 1))
return (1);
if (flags & F_ISDAY)
--UugvWAfsgieZRqgk--