=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/calendar/day.c,v retrieving revision 1.12 retrieving revision 1.15 diff -u -r1.12 -r1.15 --- src/usr.bin/calendar/day.c 2001/09/26 20:38:55 1.12 +++ src/usr.bin/calendar/day.c 2003/06/03 02:56:06 1.15 @@ -1,4 +1,4 @@ -/* $OpenBSD: day.c,v 1.12 2001/09/26 20:38:55 mickey Exp $ */ +/* $OpenBSD: day.c,v 1.15 2003/06/03 02:56:06 millert Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -43,7 +39,7 @@ #if 0 static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; #else -static char rcsid[] = "$OpenBSD: day.c,v 1.12 2001/09/26 20:38:55 mickey Exp $"; +static char rcsid[] = "$OpenBSD: day.c,v 1.15 2003/06/03 02:56:06 millert Exp $"; #endif #endif /* not lint */ @@ -433,17 +429,22 @@ } if ((tmp = malloc(sizeof(struct match))) == NULL) err(1, NULL); - tmp->when = f_time + v2 * SECSPERDAY; + + if (bodun && (day - tp->tm_yday) == -1) { + tmp->when = f_time - 1 * SECSPERDAY; + tmtmp.tm_mday++; + tmp->bodun = 1; + } else { + tmp->when = f_time + v2 * SECSPERDAY; + tmp->bodun = 0; + } + (void)mktime(&tmtmp); if (strftime(tmp->print_date, sizeof(tmp->print_date), /* "%a %b %d", &tm); Skip weekdays */ "%b %d", &tmtmp) == 0) tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; - if (bodun && (day - tp->tm_yday) == -1) - strcpy(tmp->prefix, "Бодун на утро от: "); - else - tmp->prefix[0] = '\0'; tmp->var = varp; tmp->next = NULL; @@ -539,11 +540,7 @@ /* "%a %b %d", &tm); Skip weekdays */ "%b %d", &tmtmp) == 0) tmp->print_date[sizeof(tmp->print_date) - 1] = '\0'; - if (bodun && tdiff == -1) - strcpy(tmp->prefix, - "Bodun na ytpo ot: "); - else - tmp->prefix[0] = '\0'; + tmp->bodun = bodun && tdiff == -1; tmp->var = varp; tmp->next = NULL; if (tmp2) @@ -564,9 +561,9 @@ int getmonth(s) - register char *s; + char *s; { - register char **p; + char **p; struct fixs *n; for (n = fnmonths; n->name; ++n) @@ -584,9 +581,9 @@ int getday(s) - register char *s; + char *s; { - register char **p; + char **p; struct fixs *n; for (n = fndays; n->name; ++n) @@ -608,9 +605,9 @@ */ int getdayvar(s) - register char *s; + char *s; { - register int offset; + int offset; offset = strlen(s);