Deleted Added
full compact
ncal.c (32525) ncal.c (45064)
1/*-
2 * Copyright (c) 1997 Wolfgang Helbig
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
1/*-
2 * Copyright (c) 1997 Wolfgang Helbig
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
29 "$Id: ncal.c,v 1.5 1998/01/07 07:46:33 charnier Exp $";
29 "$Id: ncal.c,v 1.6 1998/01/15 10:23:34 helbig Exp $";
30#endif /* not lint */
31
32#include <calendar.h>
33#include <err.h>
34#include <locale.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>

--- 45 unchanged lines hidden (view full) ---

83 {"FR", "France", {1582, 12, 9}, "%e. %B %Y"},
84 {"GB", "United Kingdom",{1752, 9, 2}, "%e %B %Y"},
85 {"GR", "Greece", {1924, 3, 9}, "%e %B %Y"},
86 {"HU", "Hungary", {1587, 10, 21}, "%e %B %Y"},
87 {"IS", "Iceland", {1700, 11, 16}, "%e %B %Y"},
88 {"IT", "Italy", {1582, 10, 4}, "%e %B %Y"},
89 {"JP", "Japan", {1918, 12, 18}, "%Y\x94N %B%e"},
90 {"LI", "Lithuania", {1918, 2, 1}, "%e %B %Y"},
30#endif /* not lint */
31
32#include <calendar.h>
33#include <err.h>
34#include <locale.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>

--- 45 unchanged lines hidden (view full) ---

83 {"FR", "France", {1582, 12, 9}, "%e. %B %Y"},
84 {"GB", "United Kingdom",{1752, 9, 2}, "%e %B %Y"},
85 {"GR", "Greece", {1924, 3, 9}, "%e %B %Y"},
86 {"HU", "Hungary", {1587, 10, 21}, "%e %B %Y"},
87 {"IS", "Iceland", {1700, 11, 16}, "%e %B %Y"},
88 {"IT", "Italy", {1582, 10, 4}, "%e %B %Y"},
89 {"JP", "Japan", {1918, 12, 18}, "%Y\x94N %B%e"},
90 {"LI", "Lithuania", {1918, 2, 1}, "%e %B %Y"},
91 {"LN", "Latin", {9999, 31, 12}, "%e %B %Y"},
91 {"LN", "Latin", {9999, 05, 31}, "%e %B %Y"},
92 {"LU", "Luxembourg", {1582, 12, 14}, "%e %B %Y"},
93 {"LV", "Latvia", {1918, 2, 1}, "%e %B %Y"},
94 {"NL", "Netherlands", {1582, 12, 14}, "%e %B %Y"},
95 {"NO", "Norway", {1700, 2, 18}, "%e %B %Y"},
96 {"PL", "Poland", {1582, 10, 4}, "%e %B %Y"},
97 {"PT", "Portugal", {1582, 10, 4}, "%e %B %Y"},
98 {"RO", "Romania", {1919, 3, 31}, "%e %B %Y"},
99 {"RU", "Russia", {1918, 1, 31}, "%e %B %Y"},

--- 643 unchanged lines hidden (view full) ---

743 for (i = 0; i != 7; i++) {
744 tm.tm_wday = (i+1) % 7;
745 strftime(wds->names[i], 4, "%a", &tm);
746 wds->names[i][2] = ' ';
747 }
748}
749
750/*
92 {"LU", "Luxembourg", {1582, 12, 14}, "%e %B %Y"},
93 {"LV", "Latvia", {1918, 2, 1}, "%e %B %Y"},
94 {"NL", "Netherlands", {1582, 12, 14}, "%e %B %Y"},
95 {"NO", "Norway", {1700, 2, 18}, "%e %B %Y"},
96 {"PL", "Poland", {1582, 10, 4}, "%e %B %Y"},
97 {"PT", "Portugal", {1582, 10, 4}, "%e %B %Y"},
98 {"RO", "Romania", {1919, 3, 31}, "%e %B %Y"},
99 {"RU", "Russia", {1918, 1, 31}, "%e %B %Y"},

--- 643 unchanged lines hidden (view full) ---

743 for (i = 0; i != 7; i++) {
744 tm.tm_wday = (i+1) % 7;
745 strftime(wds->names[i], 4, "%a", &tm);
746 wds->names[i][2] = ' ';
747 }
748}
749
750/*
751 * Compute the day number of the first day in month.
752 * The day y-m-1 might be dropped due to Gregorian Reformation,
753 * so the answer is the smallest day number nd with sdate(nd) in
754 * the month m.
751 * Compute the day number of the first
752 * existing date after the first day in month.
753 * (the first day in month and even the month might not exist!)
755 */
756int
757firstday(int y, int m)
758{
759 date dt;
760 int nd;
761
762 dt.y = y;
763 dt.m = m;
764 dt.d = 1;
754 */
755int
756firstday(int y, int m)
757{
758 date dt;
759 int nd;
760
761 dt.y = y;
762 dt.m = m;
763 dt.d = 1;
765 for (nd = sndays(&dt); sdate(nd, &dt)->m != m; nd++)
766 ;
767 return (nd);
764 nd = sndays(&dt);
765 for (;;) {
766 sdate(nd, &dt);
767 if ((dt.m >= m && dt.y == y) || dt.y > y)
768 return (nd);
769 else
770 nd++;
771 }
772 /* NEVER REACHED */
768}
769
770/*
771 * Compute the number of days from date, obey the local switch from
772 * Julian to Gregorian if specified by the user.
773 */
774int
775sndays(struct date *d)

--- 57 unchanged lines hidden ---
773}
774
775/*
776 * Compute the number of days from date, obey the local switch from
777 * Julian to Gregorian if specified by the user.
778 */
779int
780sndays(struct date *d)

--- 57 unchanged lines hidden ---