On Fri, Aug 25, 2006 at 10:02:23PM +0200, Jan Van den Bussche wrote:
> I can confirm that the weekend feature of calendar (namely, he should  
> report events from saturday, sunday, and monday, on a friday) does  
> not work.
> 
> The patch proposed by the bug reporter does not make sense, however,  
> and is merely based on a diff between calendar.c and OpenBSD's  
> calendar.s that does not seem to have anything to do with fridays.

Hi... for some reason I don't receive your email :-/ . I got this from
the BTS.

Maybe you are been a bit crude: the code isn't so well written and I
searched for the smaller patch. The program is part of a package named
bsdmainutils and I thought that to use a fix close to the BSDes was
smart (on the "README" is said that calendar comes from OpenBSD).

> In day.c we see the following:
> 
> day.c-171-      /* Friday displays Monday's events */
> day.c:172:      offset = tp->tm_wday == 5 ? lookahead + weekend :  
> lookahead;
> 
> For some reason the value of "weekend", an external variable set to 2  
> in calendar.c, is not transferred properly in day.c ???

This crossed my mind too. "offset" is a global variable used and defined
only on "day.c"... On the first time I changed that line to:

day.c:172:      lookahead = tp->tm_wday == 5 ? lookahead + weekend : lookahead;

and removed that unused global variable:

day.c:58:       int *cumdays;

Then I searched for directions and chose to suggest a patch close the
BSDes (OpenBSD) because I didn't understand why another global variable
was used. The use of global variables isn't a good practice rule most of
time but "lookahead" and "weekend" are also global variables. OTOH,
global variables used only on a file are preferable... This way,
"offset" may be a mistake or a transition.

My patch ends to be more a warning or a question than a fix but it makes
the code closer to the one in OpenBSD and on the "README" is said that
this program comes from OpenBSD, so I send that patch (and not the first
one).

rollingbits

-- 
,-. rollingbits -- [EMAIL PROTECTED], [EMAIL PROTECTED]
\`' [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
 `  Get my public GPG key in http://rollingbits.tripod.com/mykey.html

Attachment: signature.asc
Description: Digital signature

Reply via email to