Correct a typo (22th -> 22nd)

Remove some whitespace
Fix a problem where any event on the Last whatever of the month
was duplicated after the last day of the month (e.g. 32oct.)

PR:		4907
Submitted by:	Mikhail Teterin mi@aldan.algebra.com
This commit is contained in:
Nick Hibma 1999-07-24 16:23:52 +00:00
parent 9a16e31ade
commit 15c2a9ef79

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: day.c,v 1.10 1997/09/18 14:06:43 phk Exp $
* $Id: day.c,v 1.11 1997/10/26 12:51:30 wosch Exp $
*/
@ -204,8 +204,8 @@ time_t Mktime (dp)
tm.tm_year -= 1900;
}
#if DEBUG
printf("Mktime: %d %d %d %s\n", (int)mktime(&tm), (int)t, len,
#ifdef DEBUG
fprintf(stderr, "Mktime: %d %d %d %s\n", (int)mktime(&tm), (int)t, len,
asctime(&tm));
#endif
free(date);
@ -308,7 +308,7 @@ isnow(endp, monthp, dayp, varp)
* 'SundayLast' -> ??
*/
if (flags & F_ISDAY) {
#if DEBUG
#ifdef DEBUG
fprintf(stderr, "\nday: %d %s month %d\n", day, endp, month);
#endif
@ -321,11 +321,12 @@ isnow(endp, monthp, dayp, varp)
v1 = day/10 - 1; /* offset -4 ... -1 */
day = 10 + (day % 10); /* day 1 ... 7 */
/* day, eg '22th' */
/* day, eg '22nd' */
v2 = tp->tm_mday + (((day - 1) - tp->tm_wday + 7) % 7);
/* (month length - day) / 7 + 1 */
if (((int)((cumdays[month+1] -
if (cumdays[month+1] - cumdays[month] >= v2
&& ((int)((cumdays[month+1] -
cumdays[month] - v2) / 7) + 1) == -v1)
/* bingo ! */
day = v2;
@ -379,8 +380,8 @@ isnow(endp, monthp, dayp, varp)
*varp = 1;
}
#if DEBUG
fprintf(stderr, "day2: day %d(%d) yday %d\n", *dayp, day, tp->tm_yday);
#ifdef DEBUG
fprintf(stderr, "day2: day %d(%d-%d) yday %d\n", *dayp, day, cumdays[month], tp->tm_yday);
#endif
/* if today or today + offset days */
if (day >= tp->tm_yday - f_dayBefore &&
@ -454,7 +455,7 @@ getdayvar(s)
/* Sun+1 or Wednesday-2
* ^ ^ */
/* printf ("x: %s %s %d\n", s, s + offset - 2, offset); */
/* fprintf(stderr, "x: %s %s %d\n", s, s + offset - 2, offset); */
switch(*(s + offset - 2)) {
case '-':
return(-(atoi(s + offset - 1)));