Author: edwin
Date: Mon Aug 23 22:09:25 2010
New Revision: 211723
URL: http://svn.freebsd.org/changeset/base/211723

Log:
  MFC of r205821 r205827 r205828 r205862 r205872 r205937 r206568
  MFC of r208825 r208826 r208827 r208828 r208829 r208943
  
  r205821:
  Long awaited update to the calendar system:
  
  - Repeating events which span multiple years (because of -A, -B or
    just the three days before the end of the year).
  - Support for lunar events (full moon, new moon) and solar events
    (equinox and solstice, chinese new year). Because of this, the
    options -U (UTC offset) and -l (longitude) are available to
    compensate if reality doesn't match the calculated values.
  
  r205828:
  Use local names for calendar.dutch
  
  r205862:
  Fix DST thingies in calendar.australia
  
  r205872:
  Make licenses 3 clause instead of 4 clause
  
  r205937:
  Make the dates in the Tasmanian part of calendar.australia properly
  variable.
  
  r206568:
  Typo in Allerheiligen in calendar.dutch
  
  r208825, r208826, r208827, r208828, r208829, r208943:
  Coverity Prevent related fixes.

Modified:
  stable/8/usr.bin/calendar/Makefile
  stable/8/usr.bin/calendar/calendar.1
  stable/8/usr.bin/calendar/calendar.c
  stable/8/usr.bin/calendar/calendar.h
  stable/8/usr.bin/calendar/calendars/calendar.australia
  stable/8/usr.bin/calendar/calendars/calendar.dutch
  stable/8/usr.bin/calendar/calendars/calendar.freebsd
  stable/8/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common   (contents, 
props changed)
  stable/8/usr.bin/calendar/day.c
  stable/8/usr.bin/calendar/io.c
  stable/8/usr.bin/calendar/ostern.c
  stable/8/usr.bin/calendar/paskha.c
  stable/8/usr.bin/calendar/pathnames.h
Directory Properties:
  stable/8/usr.bin/calendar/   (props changed)

Modified: stable/8/usr.bin/calendar/Makefile
==============================================================================
--- stable/8/usr.bin/calendar/Makefile  Mon Aug 23 22:04:30 2010        
(r211722)
+++ stable/8/usr.bin/calendar/Makefile  Mon Aug 23 22:09:25 2010        
(r211723)
@@ -2,13 +2,17 @@
 # $FreeBSD$
 
 PROG=  calendar
-SRCS=   calendar.c io.c day.c ostern.c paskha.c
+SRCS=  calendar.c locale.c events.c dates.c parsedata.c io.c day.c \
+       ostern.c paskha.c pom.c sunpos.c
+LDADD= -lm
 INTER=          de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \
                hr_HR.ISO8859-2 hu_HU.ISO8859-2 ru_RU.KOI8-R uk_UA.KOI8-U
 DE_LINKS=       de_DE.ISO8859-15
 FR_LINKS=       fr_FR.ISO8859-15
 TEXTMODE?=     444
 
+WARNS?=                7
+
 beforeinstall:
        ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
            ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar

Modified: stable/8/usr.bin/calendar/calendar.1
==============================================================================
--- stable/8/usr.bin/calendar/calendar.1        Mon Aug 23 22:04:30 2010        
(r211722)
+++ stable/8/usr.bin/calendar/calendar.1        Mon Aug 23 22:09:25 2010        
(r211723)
@@ -9,10 +9,6 @@
 .\" 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
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -54,6 +50,8 @@
 .Ek
 .Oc
 .Op Fl W Ar num
+.Op Fl U Ar UTC-offset
+.Op Fl l Ar longitude
 .Sh DESCRIPTION
 The
 .Nm
@@ -93,6 +91,12 @@ as the default calendar file.
 .Sm on
 .Xc
 For test purposes only: set date directly to argument values.
+.It Fl l Ar longitude , Fl U Ar UTC-offset
+Only one is needed:
+Perform lunar and solar calculations from this longitude or from
+this UTC offset.
+If neither is specified, the calculations will be based on the
+difference between UTC time and localtime.
 .It Fl W Ar num
 Print lines from today and the next
 .Ar num
@@ -103,12 +107,36 @@ Ignore weekends when calculating the num
 To handle calendars in your national code table you can specify
 .Dq LANG=<locale_name>
 in the calendar file as early as possible.
-To handle national Easter
-names in the calendars
-.Dq Easter=<national_name>
-(for Catholic Easter) or
-.Dq Paskha=<national_name>
-(for Orthodox Easter) can be used.
+.Pp
+To handle the local name of sequences, you can specify them as:
+.Dq SEQUENCE=<first> <second> <third> <fourth> <fifth> <last>
+in the calendar file as early as possible.
+.Pp
+The names of the following special days are recognized:
+.Bl -tag -width 123456789012345 -compact
+.It Easter
+Catholic Easter.
+.It Paskha
+Orthodox Easter.
+.It NewMoon
+The lunar New Moon.
+.It FullMoon
+The lunar Full Moon.
+.It MarEquinox
+The solar equinox in March.
+.It JunSolstice
+The solar solstice in June.
+.It SepEquinox
+The solar equinox in March.
+.It DecSolstice
+The solar solstice in December.
+.It ChineseNewYear
+The first day of the Chinese year.
+.El
+These names may be reassigned to their local names via an assignment
+like
+.Dq Easter=Pasen
+in the calendar file.
 .Pp
 Other lines should begin with a month and day.
 They may be entered in almost any format, either numeric or as character
@@ -122,11 +150,11 @@ Two numbers default to the month followe
 Lines with leading tabs default to the last entered date, allowing
 multiple line specifications for a single date.
 .Pp
-``Easter'', is Easter for this year, and may be followed by a positive
-or negative integer.
-.Pp
-``Paskha'', is Orthodox Easter for this year, and may be followed by a
-positive or negative integer.
+The names of the recognized special days may be followed by a
+positive or negative integer, like:
+.Dq Easter+3
+or
+.Dq Pashka-4 .
 .Pp
 Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for
 last, first, second, third, fourth) for moving events like
@@ -191,7 +219,8 @@ calendar file to use if no calendar file
 do not send mail if this file exists.
 .El
 .Pp
-The following default calendar files are provided:
+The following default calendar files are provided in
+.Pa /usr/share/calendars:
 .Pp
 .Bl -tag -width calendar.southafrica -compact
 .It Pa calendar.all
@@ -208,6 +237,8 @@ so that roving holidays are set correctl
 Days of special significance to computer people.
 .It Pa calendar.croatian
 Calendar of events in Croatia.
+.It Pa calendar.dutch
+Calendar of events in the Netherlands.
 .It Pa calendar.freebsd
 Birthdays of
 .Fx
@@ -259,7 +290,28 @@ A
 .Nm
 command appeared in
 .At v7 .
+.Sh NOTES
+Chinese New Year is calculated at 120 degrees east of Greenwich,
+which roughly corresponds with the east coast of China.
+For people west of China, this might result that the start of Chinese
+New Year and the day of the related new moon might differ.
+.Pp
+The phases of the moon and the longitude of the sun are calculated
+against the local position which corresponds with 30 degrees times
+the time-difference towards Greenwich.
+.Pp
+The new and full moons are happening on the day indicated: They
+might happen in the time period in the early night or in the late
+evening.
+It doesn't indicate that they are starting in the night on that date.
+.Pp
+Because of minor differences between the output of the formulas
+used and other sources on the Internet, Druids and Werewolves should
+double-check the start and end time of solar and lunar events.
 .Sh BUGS
 The
 .Nm
-utility does not handle Jewish holidays and moon phases.
+utility does not handle Jewish holidays.
+.Pp
+There is no possibility to properly specify the local position
+needed for solar and lunar calculations.

Modified: stable/8/usr.bin/calendar/calendar.c
==============================================================================
--- stable/8/usr.bin/calendar/calendar.c        Mon Aug 23 22:04:30 2010        
(r211722)
+++ stable/8/usr.bin/calendar/calendar.c        Mon Aug 23 22:09:25 2010        
(r211723)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1989, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
@@ -10,10 +10,6 @@
  * 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
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -52,30 +48,38 @@ __FBSDID("$FreeBSD$");
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 
-#include "pathnames.h"
 #include "calendar.h"
 
+#define        UTCOFFSET_NOTSET        100     /* Expected between -24 and +24 
*/
+#define        LONGITUDE_NOTSET        1000    /* Expected between -360 and 
+360 */
+
 struct passwd  *pw;
 int            doall = 0;
+int            debug = 0;
+char           *DEBUG = NULL;
 time_t         f_time = 0;
-
-int    f_dayAfter = 0;         /* days after current date */
-int    f_dayBefore = 0;        /* days before current date */
-int    Friday = 5;             /* day before weekend */
+double         UTCOffset = UTCOFFSET_NOTSET;
+int            EastLongitude = LONGITUDE_NOTSET;
 
 static void    usage(void) __dead2;
 
 int
 main(int argc, char *argv[])
 {
+       int     f_dayAfter = 0;         /* days after current date */
+       int     f_dayBefore = 0;        /* days before current date */
+       int     Friday = 5;             /* day before weekend */
+
        int ch;
+       struct tm tp1, tp2;
 
        (void)setlocale(LC_ALL, "");
 
-       while ((ch = getopt(argc, argv, "-A:aB:F:f:t:W:")) != -1)
+       while ((ch = getopt(argc, argv, "-A:aB:dD:F:f:l:t:U:W:")) != -1)
                switch (ch) {
                case '-':               /* backward contemptible */
                case 'a':
@@ -90,14 +94,10 @@ main(int argc, char *argv[])
                        calendarFile = optarg;
                        break;
 
-               case 't': /* other date, undocumented, for tests */
-                       f_time = Mktime(optarg);
-                       break;
-
                case 'W': /* we don't need no steenking Fridays */
                        Friday = -1;
-
                        /* FALLTHROUGH */
+
                case 'A': /* days after current date */
                        f_dayAfter = atoi(optarg);
                        break;
@@ -106,9 +106,25 @@ main(int argc, char *argv[])
                        f_dayBefore = atoi(optarg);
                        break;
 
-               case 'F':
+               case 'F': /* Change the time: When does weekend start? */
                        Friday = atoi(optarg);
                        break;
+               case 'l': /* Change longitudal position */
+                       EastLongitude = strtol(optarg, NULL, 10);
+                       break;
+               case 'U': /* Change UTC offset */
+                       UTCOffset = strtod(optarg, NULL);
+                       break;
+
+               case 'd':
+                       debug = 1;
+                       break;
+               case 'D':
+                       DEBUG = optarg;
+                       break;
+               case 't': /* other date, undocumented, for tests */
+                       f_time = Mktime(optarg);
+                       break;
 
                case '?':
                default:
@@ -125,7 +141,60 @@ main(int argc, char *argv[])
        if (f_time <= 0)
                (void)time(&f_time);
 
-       settime(f_time);
+       /* if not set, determine where I could be */
+       {
+               if (UTCOffset == UTCOFFSET_NOTSET &&
+                   EastLongitude == LONGITUDE_NOTSET) {
+                       /* Calculate on difference between here and UTC */
+                       time_t t;
+                       struct tm tm;
+                       long utcoffset, hh, mm, ss;
+                       double uo;
+
+                       time(&t);
+                       localtime_r(&t, &tm);
+                       utcoffset = tm.tm_gmtoff;
+                       /* seconds -> hh:mm:ss */
+                       hh = utcoffset / SECSPERHOUR;
+                       utcoffset %= SECSPERHOUR;
+                       mm = utcoffset / SECSPERMINUTE;
+                       utcoffset %= SECSPERMINUTE;
+                       ss = utcoffset;
+
+                       /* hh:mm:ss -> hh.mmss */
+                       uo = mm + (100.0 * (ss / 60.0));
+                       uo /=  60.0 / 100.0;
+                       uo = hh + uo / 100;
+
+                       UTCOffset = uo;
+                       EastLongitude = UTCOffset * 15;
+               } else if (UTCOffset == UTCOFFSET_NOTSET) {
+                       /* Base on information given */
+                       UTCOffset = EastLongitude / 15;
+               } else if (EastLongitude == LONGITUDE_NOTSET) {
+                       /* Base on information given */
+                       EastLongitude = UTCOffset * 15;
+               }
+       }
+
+       settimes(f_time, f_dayBefore, f_dayAfter, Friday, &tp1, &tp2);
+       generatedates(&tp1, &tp2);
+
+       /*
+        * FROM now on, we are working in UTC.
+        * This will only affect moon and sun related events anyway.
+        */
+       if (setenv("TZ", "UTC", 1) != 0)
+               errx(1, "setenv: %s", strerror(errno));
+       tzset();
+
+       if (debug)
+               dumpdates();
+
+       if (DEBUG != NULL) {
+               dodebug(DEBUG);
+               exit(0);
+       }
 
        if (doall)
                while ((pw = getpwent()) != NULL) {
@@ -146,9 +215,11 @@ static void __dead2
 usage(void)
 {
 
-       fprintf(stderr, "%s\n%s\n",
+       fprintf(stderr, "%s\n%s\n%s\n",
            "usage: calendar [-a] [-A days] [-B days] [-F friday] "
            "[-f calendarfile]",
-           "                [-t dd[.mm[.year]]] [-W days]");
+           "                [-d] [-t dd[.mm[.year]]] [-W days]",
+           "                [-U utcoffset] [-l longitude]"
+           );
        exit(1);
 }

Modified: stable/8/usr.bin/calendar/calendar.h
==============================================================================
--- stable/8/usr.bin/calendar/calendar.h        Mon Aug 23 22:04:30 2010        
(r211722)
+++ stable/8/usr.bin/calendar/calendar.h        Mon Aug 23 22:09:25 2010        
(r211723)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1989, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
@@ -10,10 +10,6 @@
  * 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
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -36,43 +32,163 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 
+#define        SECSPERDAY      (24 * 60 * 60)
+#define        SECSPERHOUR     (60 * 60)
+#define        SECSPERMINUTE   (60)
+#define        MINSPERHOUR     (60)
+#define        HOURSPERDAY     (24)
+#define        FSECSPERDAY     (24.0 * 60.0 * 60.0)
+#define        FSECSPERHOUR    (60.0 * 60.0)
+#define        FSECSPERMINUTE  (60.0)
+#define        FMINSPERHOUR    (60.0)
+#define        FHOURSPERDAY    (24.0)
+
+#define        DAYSPERYEAR     365
+#define        DAYSPERLEAPYEAR 366
+
+/* Not yet categorized */
+
 extern struct passwd *pw;
 extern int doall;
-extern struct iovec header[];
-extern struct tm *tp;
+extern time_t t1, t2;
 extern const char *calendarFile;
-extern int *cumdays;
 extern int yrdays;
-extern struct fixs neaster, npaskha;
-
-void   cal(void);
-void   closecal(FILE *);
-int    getday(char *);
-int    getdayvar(char *);
-int    getfield(char *, char **, int *);
-int    getmonth(char *);
-int    geteaster(char *, int);
-int    getpaskha(char *, int);
-int    easter(int);
-int    isnow(char *, int *, int *, int *);
-FILE   *opencal(void);
-void   settime(time_t);
-time_t Mktime(char *);
-void   setnnames(void);
+extern struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
+extern struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;
+extern double UTCOffset;
+extern int EastLongitude;
 
 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
-/* some flags */
-#define        F_ISMONTH       0x01    /* month (January ...) */
-#define        F_ISDAY         0x02    /* day of week (Sun, Mon, ...) */
-#define        F_ISDAYVAR      0x04    /* variables day of week, like 
SundayLast */
-#define        F_EASTER        0x08    /* Easter or easter depending days */
-
-extern int     f_dayAfter;     /* days after current date */
-extern int     f_dayBefore;    /* days before current date */
-extern int     Friday;         /* day before weekend */
+/* Flags to determine the returned values by determinestyle() in parsedata.c */
+#define        F_NONE                  0x00000
+#define        F_MONTH                 0x00001
+#define        F_DAYOFWEEK             0x00002
+#define        F_DAYOFMONTH            0x00004
+#define        F_MODIFIERINDEX         0x00008
+#define        F_MODIFIEROFFSET        0x00010
+#define        F_SPECIALDAY            0x00020
+#define        F_ALLMONTH              0x00040
+#define        F_ALLDAY                0x00080
+#define        F_VARIABLE              0x00100
+#define        F_EASTER                0x00200
+#define        F_CNY                   0x00400
+#define        F_PASKHA                0x00800
+#define        F_NEWMOON               0x01000
+#define        F_FULLMOON              0x02000
+#define        F_MAREQUINOX            0x04000
+#define        F_SEPEQUINOX            0x08000
+#define        F_JUNSOLSTICE           0x10000
+#define        F_DECSOLSTICE           0x20000
+
+#define        STRING_EASTER           "Easter"
+#define        STRING_PASKHA           "Paskha"
+#define        STRING_CNY              "ChineseNewYear"
+#define STRING_NEWMOON         "NewMoon"
+#define STRING_FULLMOON                "FullMoon"
+#define STRING_MAREQUINOX      "MarEquinox"
+#define STRING_SEPEQUINOX      "SepEquinox"
+#define STRING_JUNSOLSTICE     "JunSolstice"
+#define STRING_DECSOLSTICE     "DecSolstice"
+
+#define        MAXCOUNT                125     /* Random number of maximum 
number of
+                                        * repeats of an event. Should be 52
+                                        * (number of weeks per year), if you
+                                        * want to show two years then it
+                                        * should be 104. If you are seeing
+                                        * more than this you are using this
+                                        * program wrong.
+                                        */
+
+/* 
+ * All the astronomical calculations are carried out for the meridian 120
+ * degrees east of Greenwich.
+ */
+#define UTCOFFSET_CNY          8.0             
+
+extern int     debug;          /* show parsing of the input */
+extern int     year1, year2;
+
+/* events.c */
+/*
+ * Event sorting related functions:
+ * - Use event_add() to create a new event
+ * - Use event_continue() to add more text to the last added event
+ * - Use event_print_all() to display them in time chronological order
+ */
+struct event *event_add(int, int, int, char *, int, char *, char *);
+void   event_continue(struct event *events, char *txt);
+void   event_print_all(FILE *fp);
+struct event {
+       int     year;
+       int     month;
+       int     day;
+       int     var;
+       char    *date;
+       char    *text;
+       char    *extra;
+       struct event *next;
+};
+
+/* locale.c */
 
 struct fixs {
        char    *name;
-       int     len;
+       size_t  len;
 };
+
+extern const char *days[];
+extern const char *fdays[];
+extern const char *fmonths[];
+extern const char *months[];
+extern const char *sequences[];
+extern struct fixs fndays[8];          /* full national days names */
+extern struct fixs fnmonths[13];       /* full national months names */
+extern struct fixs ndays[8];           /* short national days names */
+extern struct fixs nmonths[13];                /* short national month names */
+extern struct fixs nsequences[10];
+
+void   setnnames(void);
+void   setnsequences(char *);
+
+/* day.c */
+extern const struct tm tm0;
+extern char dayname[];
+void   settimes(time_t,int before, int after, int friday, struct tm *tp1, 
struct tm *tp2);
+time_t Mktime(char *);
+
+/* parsedata.c */
+int    parsedaymonth(char *, int *, int *, int *, int *, char **);
+void   dodebug(char *type);
+
+/* io.c */
+void   cal(void);
+void   closecal(FILE *);
+FILE   *opencal(void);
+
+/* ostern.c / pashka.c */
+int    paskha(int);
+int    easter(int);
+
+/* dates.c */
+extern int cumdaytab[][14];
+extern int mondaytab[][14];
+extern int debug_remember;
+void   generatedates(struct tm *tp1, struct tm *tp2);
+void   dumpdates(void);
+int    remember_ymd(int y, int m, int d);
+int    remember_yd(int y, int d, int *rm, int *rd);
+int    first_dayofweek_of_year(int y);
+int    first_dayofweek_of_month(int y, int m);
+int    walkthrough_dates(struct event **e);
+void   addtodate(struct event *e, int year, int month, int day);
+
+/* pom.c */
+#define        MAXMOONS        18
+void   pom(int year, double UTCoffset, int *fms, int *nms);
+void   fpom(int year, double utcoffset, double *ffms, double *fnms);
+
+/* sunpos.c */
+void   equinoxsolstice(int year, double UTCoffset, int *equinoxdays, int 
*solsticedays);
+void   fequinoxsolstice(int year, double UTCoffset, double *equinoxdays, 
double *solsticedays);
+int    calculatesunlongitude30(int year, int degreeGMToffset, int 
*ichinesemonths);

Modified: stable/8/usr.bin/calendar/calendars/calendar.australia
==============================================================================
--- stable/8/usr.bin/calendar/calendars/calendar.australia      Mon Aug 23 
22:04:30 2010        (r211722)
+++ stable/8/usr.bin/calendar/calendars/calendar.australia      Mon Aug 23 
22:09:25 2010        (r211723)
@@ -10,49 +10,63 @@
 LANG=en_AU.ISO8859-1
 
 /* Australia */
-Jan 26 Australia Day
-Mar/SunLast    Daylight Savings Time ends in ACT, NSW, SA, TAS and VIC.
-Apr 25 Anzac Day
+Jan 26         Australia Day
+Apr/SunFirst   Daylight Savings Time ends in ACT, NSW, SA, TAS and VIC.
+Apr 25         Anzac Day
 Jun/MonSecond  Queen's Birthday Holiday (Australia, except WA)
-Oct/SunLast    Daylight Savings Time starts in ACT, NSW, SA and VIC.
+Oct/SunFirst   Daylight Savings Time starts in ACT, NSW, SA and VIC.
 
 /* ACT, NSW, common */
-Mar 18 Canberra Day (ACT)
-8/MonFirst     Bank Holiday (ACT, NSW)
-10/MonFirst    Labour Day (ACT, NSW, SA)
+Mar 18         Canberra Day (ACT)
+Sep/MonLast    Family & Community Day (ACT)
+Aug/MonFirst   Bank Holiday (ACT, NSW)
+Oct/MonFirst   Labour Day (ACT, NSW, SA)
 
 /* Victoria */
-3/MonSecond    Labour Day (Vic)
-Nov/TueFirst   Melbourne Cup (Vic)
+Mar/MonSecond  Labour Day (VIC)
+Nov/TueFirst   Melbourne Cup (VIC)
 
-/* Tasmania */
-Feb 11 Regatta Day (Tas)
-Feb 27 Launceston Cup (Tas)
-Mar 11 Eight Hours Day (Tas)
-Oct/SunFirst   Daylight Savings Time starts in TAS.
-Oct 10 Launceston Show Day (Tas)
-Oct 24 Hobart Show Day (Tas)
-Nov 04 Recreation Day (N Tas)
+/* Tasmania
+ * http://www.wst.tas.gov.au/employment_info/public_holidays/html/2010
+ */
+Feb/MonSecond  Regatta Day (TAS)
+Feb/WedLast    Launceston Cup (TAS)
+Mar/TueFirst   King Island show (TAS)
+Mar/MonSecond  Eight Hours Day (TAS)
+Oct 10         Launceston Show Day (TAS)       /* Thursday preceding second 
Saturday in October */
+Oct 24         Hobart Show Day (TAS)           /* Thursday preceding fourth 
Saturday in October */
+Nov/MonFirst   Recreation Day (N TAS)          
+
+/*
+Oct/SatSecond-2        Launceston Show Day (TAS)       // Thursday preceding 
second Sat in October
+Oct/SatFourth-2        Hobart Show Day (TAS)           // Thursday preceding 
fourth Sat in October
+May/ThuFirst+1 Agfest (Circular Head only)     // Friday following the first 
Thursday in May
+Oct/SatFirst-1 Burnie Show                     // Friday preceding first 
Saturday in October
+Oct/SatThird-1 Flinders Island Show            // Friday preceding third 
Saturday in October
+
+DEVONPORT CUP Wednesday not earlier than fifth and not later than eleventh day 
of January
+DEVONPORT SHOW Friday nearest last day in November, but not later than first 
day of December
+*/
 
 /* South Australia */
 May/MonThird   Adelaide Cup (SA)
-Dec 26 Proclamation Day holiday (SA)
+Dec 26         Proclamation Day holiday (SA)
 
 /* Western Australia */
-3/MonFirst     Labour Day (WA)
-6/MonFirst     Foundation Day (WA)
-Sep 30 Queen's Birthday (WA)
+Mar/MonFirst   Labour Day (WA)
+Jun/MonFirst   Foundation Day (WA)
+Sep 30         Queen's Birthday (WA)
 
 /* Northern Territory */
-5/MonFirst     May Day (NT)
-7/FriFirst     Alice Springs Show Day (NT)
-7/FriSecond    Tennant Creek Show Day (NT)
-7/FriThird     Katherine Show Day (NT)
-7/FriLast      Darwin Show Day (NT)
-8/MonFirst     Picnic Day (NT)
+May/MonFirst   May Day (NT)
+Jul/FriFirst   Alice Springs Show Day (NT)
+Jul/FriSecond  Tennant Creek Show Day (NT)
+Jul/FriThird   Katherine Show Day (NT)
+Jul/FriLast    Darwin Show Day (NT)
+Aug/MonFirst   Picnic Day (NT)
 
 /* Queensland */
-5/MonFirst     Labour Day (Qld)
-Aug 14 RNA Show Day (Brisbane metro)
+May/MonFirst   Labour Day (QLD)
+Aug/WedSecond  RNA Show Day (Brisbane metro)   /* Second Last Wednesday */
 
 #endif

Modified: stable/8/usr.bin/calendar/calendars/calendar.dutch
==============================================================================
--- stable/8/usr.bin/calendar/calendars/calendar.dutch  Mon Aug 23 22:04:30 
2010        (r211722)
+++ stable/8/usr.bin/calendar/calendars/calendar.dutch  Mon Aug 23 22:09:25 
2010        (r211723)
@@ -10,25 +10,25 @@ Easter=Pasen
 /*
  * Feestdagen
  */
-01/01  Nieuwjaar
-01/06  Driekoningen
-04/01  Een April
-04/30  Koninginendag
-05/01  Dag van de Arbeid
-05/04  Dodenherdenking
-05/05  Bevrijdingsdag
-10/04  Dierendag
-11/01  Allerheilingen
-11/02  Allerzielen
-11/11  Sint Maarten
-11/11  Elfde-van-de-elfde
-12/05  Sinterklaas avond
-12/15  Koninkrijksdag
-12/24  Kerstavond
-12/25  Eerste kerstdag
-12/26  Tweede kerstdag
-12/28  Feest der Onnozele Kinderen
-12/31  Oudjaar
+jan/01 Nieuwjaar
+jan/06 Driekoningen
+apr/01 1 april
+apr/30 Koninginnedag
+mei/01 Dag van de Arbeid
+mei/04 Dodenherdenking
+mei/05 Bevrijdingsdag
+okt/04 Dierendag
+nov/01 Allerheiligen
+nov/02 Allerzielen
+nov/11 Sint Maarten
+nov/11 Elfde-van-de-elfde
+dec/05 Sinterklaas avond
+dec/15 Koninkrijksdag
+dec/24 Kerstavond
+dec/25 Eerste kerstdag
+dec/26 Tweede kerstdag
+dec/28 Feest der Onnozele Kinderen
+dec/31 Oudjaar
 
 /*
  * Pasen gerelateerd
@@ -38,12 +38,12 @@ Pasen-49    Carnaval
 Pasen-48       Carnaval
 Pasen-47       Carnaval (Vastenavond)
 Pasen-46       Aswoensdag
-Pasen-7        Palmzondag
-Pasen-3        Witte Donderdag
-Pasen-2        Goede vrijdag
-Pasen-1        Stille zaterdag
+Pasen-7                Palmzondag
+Pasen-3                Witte Donderdag
+Pasen-2                Goede vrijdag
+Pasen-1                Stille zaterdag
 Pasen          Eerste paasdag
-Pasen+1        Tweede paasdag
+Pasen+1                Tweede paasdag
 Pasen+39       Hemelvaartsdag
 Pasen+49       Eerste Pinksterdag
 Pasen+50       Tweede Pinksterdag
@@ -52,28 +52,28 @@ Pasen+56    Trinitatis
 /*
  * Misc
  */
-05/SunSecond   Moederdag
-06/SunThird    Vaderdag
-09/TueThird    Prinsjesdag
+mei/SunSecond  Moederdag
+jun/SunThird   Vaderdag
+sep/TueThird   Prinsjesdag
 
 /*
  * Het koningshuis
  */
-01/19  Prinses Margriet (1943)
-01/31  Koningin Beatrix (1938)
-02/17  Prins Willem III (1817 - 1890)
-02/18  Prinses Christina (1947)
-04/10  Prinses Ariane (2007)
-04/19  Prins Hendrik (1876 - 1934)
-04/27  Kroonprins Willem Alexander (1967)
-04/30  Koningin Juliana (1909 - 2004)
-04/30  Mr. Pieter van Vollenhoven (1939)
-05/17  Prinses Maxima (1971)
-06/26  Prinses Alexia (2005)
-06/29  Prins Bernhard (1911 - 2004)
-08/05  Prinses Irene (1939)
-08/31  Prinses Wilhelmina (1880 - 1962)
-09/06  Prins Claus (1925 - 2002)
-09/25  Prins Johan Friso (1968)
-10/11  Prins Constantijn (1969)
-12/07  Prinses Catharina-Amalia (2003)
+jan/19 Prinses Margriet (1943)
+jan/31 Koningin Beatrix (1938)
+feb/17 Prins Willem III (1817 - 1890)
+feb/18 Prinses Christina (1947)
+apr/10 Prinses Ariane (2007)
+apr/19 Prins Hendrik (1876 - 1934)
+apr/27 Kroonprins Willem Alexander (1967)
+apr/30 Koningin Juliana (1909 - 2004)
+apr/30 Mr. Pieter van Vollenhoven (1939)
+mei/17 Prinses Maxima (1971)
+jun/26 Prinses Alexia (2005)
+jun/29 Prins Bernhard (1911 - 2004)
+aug/05 Prinses Irene (1939)
+aug/31 Prinses Wilhelmina (1880 - 1962)
+sep/06 Prins Claus (1925 - 2002)
+sep/25 Prins Johan Friso (1968)
+okt/11 Prins Constantijn (1969)
+dec/07 Prinses Catharina-Amalia (2003)

Modified: stable/8/usr.bin/calendar/calendars/calendar.freebsd
==============================================================================
--- stable/8/usr.bin/calendar/calendars/calendar.freebsd        Mon Aug 23 
22:04:30 2010        (r211722)
+++ stable/8/usr.bin/calendar/calendars/calendar.freebsd        Mon Aug 23 
22:09:25 2010        (r211723)
@@ -72,6 +72,7 @@
 03/03  Doug White <dwh...@freebsd.org> born in Eugene, Oregon, United States, 
1977
 03/03  Gordon Tetlow <gor...@freebsd.org> born in Reno, Nevada, United States, 
1978
 03/04  Oleksandr Tymoshenko <go...@freebsd.org> born in Chernihiv, Ukraine, 
1980
+03/05  Baptiste Daroussin <b...@freebsd.org> born in Beauvais, France, 1980
 03/05  Philip Paeps <phi...@freebsd.org> born in Leuven, Belgium, 1983
 03/05  Ulf Lilleengen <l...@freebsd.org> born in Hamar, Norway, 1985
 03/06  Christopher Piazza <cpia...@freebsd.org> born in Kamloops, British 
Columbia, Canada, 1981
@@ -82,6 +83,7 @@
 03/12  Greg Lewis <gle...@freebsd.org> born in Adelaide, South Australia, 
Australia, 1969
 03/13  Alexander Leidinger <netch...@freebsd.org> born in Neunkirchen, 
Saarland, Germany, 1976
 03/13  Will Andrews <w...@freebsd.org> born in Pontiac, Michigan, United 
States, 1982
+03/14  Bernhard Froehlich <de...@freebsd.org> born in Graz, Styria, Austria, 
1985
 03/15  Paolo Pisati <p...@freebsd.org> born in Lodi, Italy, 1977
 03/15  Brian Fundakowski Feldman <gr...@freebsd.org> born in Alexandria, 
Virginia, United States, 1983
 03/17  Michael Smith <msm...@freebsd.org> born in Bankstown, New South Wales, 
Australia, 1971
@@ -91,6 +93,7 @@
 03/20  MANTANI Nobutaka <nobut...@freebsd.org> born in Hiroshima, Japan, 1978
 03/20  Cameron Grant <c...@freebsd.org> died in Hemel Hempstead, United 
Kingdom, 2005
 03/20  Henrik Brix Andersen <b...@freebsd.org> born in Aarhus, Denmark, 1978
+03/20  Joseph S. Atkinson <j...@freebsd.org> born in Batesville, Arkansas, 
United States, 1977
 03/22  Brad Davis <b...@freebsd.org> born in Farmington, New Mexico, United 
States, 1983
 03/23  Daniel C. Sobral <d...@freebsd.org> born in Brasilia, Distrito Federal, 
Brazil, 1971
 03/23  Benno Rice <be...@freebsd.org> born in Adelaide, South Australia, 
Australia, 1977
@@ -135,6 +138,7 @@
 05/11  Jesus Rodriguez <jes...@freebsd.org> born in Barcelona, Spain, 1972
 05/11  Roman Kurakin <r...@freebsd.org> born in Moscow, USSR, 1979
 05/13  Pete Fritchman <pe...@freebsd.org> born in Lansdale, Pennsylvania, 
United States, 1983
+05/14  Bruce Cran <bru...@freebsd.org> born in Cambridge, United Kingdom, 1981
 05/14  Tatsumi Hosokawa <hosok...@freebsd.org> born in Tokyo, Japan, 1968
 05/14  Shigeyuku Fukushima <sh...@freebsd.org> born in Osaka, Japan, 1974
 05/16  Johann Kois <jk...@freebsd.org> born in Wolfsberg, Austria, 1975
@@ -200,6 +204,7 @@
 07/19  Masafumi NAKANE <m...@freebsd.org> born in Okazaki, Aichi, Japan, 1972
 07/19  Simon L. Nielsen <si...@freebsd.org> born in Copenhagen, Denmark, 1980
 07/19  Gleb Smirnoff <gleb...@freebsd.org> born in Kharkov, USSR, 1981
+07/20  Andrey V. Elsukov <a...@freebsd.org> born in Kotelnich, Russian 
Federation, 1981
 07/22  James Housley <j...@freebsd.org> born in Chicago, Illinois, United 
States, 1965
 07/22  Jens Schweikhardt <schwe...@freebsd.org> born in Waiblingen, 
Baden-Wuerttemberg, Germany, 1967
 07/22  Lukas Ertl <l...@freebsd.org> born in Weissenbach/Enns, Steiermark, 
Austria, 1976
@@ -251,6 +256,7 @@
 09/12  Benedict Christopher Reuschling <b...@freebsd.org> born in Darmstadt, 
Germany, 1981
 09/15  Dima Panov <flu...@freebsd.org> born in Khabarovsk, Russian Federation, 
1978
 09/17  Maxim Bolotin <m...@freebsd.org> born in Rostov-on-Don, Russian 
Federation, 1976
+09/18  Matthew Fleming <m...@freebsd.org> born in Cleveland, Ohio, United 
States, 1975
 09/20  Kevin Lo <ke...@freebsd.org> born in Taipei, Taiwan, Republic of China, 
1972
 09/27  Neil Blakey-Milner <n...@freebsd.org> born in Port Elizabeth, South 
Africa, 1978
 09/27  Renato Botelho <ga...@freebsd.org> born in Araras, Sao Paulo, Brazil, 
1979
@@ -284,6 +290,7 @@
 11/10  Gregory Neil Shapiro <gshap...@freebsd.org> born in Providence, Rhode 
Island, United States, 1970
 11/13  John Baldwin <j...@freebsd.org> born in Stuart, Virginia, United 
States, 1977
 11/15  Lars Engels <l...@freebsd.org> born in Hilden, Nordrhein-Westfalen, 
Germany, 1980
+11/15  Tijl Coosemans <t...@freebsd.org> born in Duffel, Belgium, 1983
 11/16  Jose Maria Alcaide Salinas <j...@freebsd.org> born in Madrid, Spain, 
1962
 11/17  Ralf S. Engelschall <r...@freebsd.org> born in Dachau, Bavaria, 
Germany, 1972
 11/18  Thomas Quinot <tho...@freebsd.org> born in Paris, France, 1977

Modified: stable/8/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
==============================================================================
--- stable/8/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common    Mon Aug 
23 22:04:30 2010        (r211722)
+++ stable/8/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common    Mon Aug 
23 22:09:25 2010        (r211723)
@@ -18,6 +18,7 @@ LANG=ru_RU.KOI8-R
 10 ��� ���� ���������������� ���������
  1 ��� ��������� ���� ����������� �������
 03/SunSecond   ���� ���������� �������� � �����������
+11 ��� ���� ��������� ������� �������������
 18 ��� ���� ��������� �������
 03/SunThird    ���� ���������� ��������, �������� ������������ ��������� � 
�������-������������� ���������
 27 ��� ������������� ���� ������
@@ -33,22 +34,28 @@ LANG=ru_RU.KOI8-R
 17 ��� ������������� ���� ����������������
 18 ��� ������������� ���� ������
 24 ��� ���� ���������� ������������ � ��������
+26 ��� ���� ����������� �������������������
 27 ��� �������������� ���� ���������
 28 ��� ���� ������������
+30 ��� ���� �������� ������
+31 ��� ���� ���������� ����������
 05/SunLast     ���� ������
  1 ��� ���� ������ �����
+ 5 ��� ���� �������
  6 ��� ���������� ����
  8 ��� ���� ����������� ���������
 06/SunSecond   ���� ���������� ������ ��������������
 06/SunThird    ���� ������������ ���������
 22 ��� ���� ������ � ������ (������ ������� ������������� �����, 1941 ���)
 27 ��� ���� ��������
+29 ��� ���� �������� � ������������
 06/SatLast     ���� ������������ � ���������������
 07/SunFirst    ���� ���������� �������� � ������� �����
 07/SunSecond   ���� ������
 07/SunSecond   ���� ���������� �����
 07/SunThird    ���� ����������
 07/SunLast     ���� ������-�������� �����
+28 ��� ���� �������� ����
  6 ��� ���� ��������������� �����
 08/SunFirst    ���� ����������������
 12 ��� ���� ������-��������� ���
@@ -59,12 +66,16 @@ LANG=ru_RU.KOI8-R
 08/SunLast     ���� �������
  1 ��� ���� ������
  2 ��� ���� ���������� �������
+ 3 ��� ���� ������������ � ������ � �����������
+ 4 ��� ���� ����������� �� �������� �����������
 09/SunFirst    ���� ���������� �������� � ������� ��������������
 09/SunSecond   ���� ��������
 09/SunThird    ���� ���������� ����
+28 ��� ���� ��������� ������� ��������������
 09/SunLast     ���� ���������������
  1 ��� ���� ������� �����
- 4 ��� ���� ������-����������� ���
+ 1 ��� ���� ���������� �����
+ 4 ��� ���� ����������� �����
  5 ��� ���� �������
 14 ��� ������������� ���� ��������������
 10/SunSecond   ���� ���������� ��������� ��������� � ���������������� 
��������������
@@ -73,15 +84,19 @@ LANG=ru_RU.KOI8-R
 25 ��� ���� �����������
 30 ��� ���� ������ ����� ������������ ���������
 10/SunLast     ���� ���������� �������������� ����������
+ 7 ��� ���� ����������� ��������� 1917 ����
  9 ��� ��������� ���� ��������
 10 ��� ���� �������
 16 ��� ���� ������� ������
 17 ��� ������������� ���� ���������
-11/SunThird    ���� �������� ����� � ����������
+19 ��� ���� �������� ����� � ����������
 21 ��� ���� ���������� ��������� �������
 26 ��� ��������� ���� ����������
 11/SunLast     ���� ������
  1 ��� ��������� ���� ������ �� ������
+ 3 ��� ���� ������
+ 9 ��� ���� ������ ���������
+12 ��� ���� �����������
 17 ��� ���� �������� ����� ��������������� ����������
 20 ��� ���� ��������� ������� ������������
 22 ��� ���� ����������

Modified: stable/8/usr.bin/calendar/day.c
==============================================================================
--- stable/8/usr.bin/calendar/day.c     Mon Aug 23 22:04:30 2010        
(r211722)
+++ stable/8/usr.bin/calendar/day.c     Mon Aug 23 22:09:25 2010        
(r211723)
@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 1989, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
@@ -10,10 +10,6 @@
  * 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
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -34,9 +30,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <ctype.h>
 #include <err.h>
 #include <locale.h>
 #include <stdio.h>
@@ -44,123 +37,40 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <time.h>
 
-#include "pathnames.h"
 #include "calendar.h"
 
-struct tm              *tp;
-static const struct tm tm0;
-int                    *cumdays, yrdays;
-char                   dayname[10];
-
-
-/* 1-based month, 0-based days, cumulative */
-int    daytab[][14] = {
-       {0, -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364},
-       {0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
-};
-
-static char const *days[] = {
-       "sun", "mon", "tue", "wed", "thu", "fri", "sat", NULL,
-};
-
-static const char *months[] = {
-       "jan", "feb", "mar", "apr", "may", "jun",
-       "jul", "aug", "sep", "oct", "nov", "dec", NULL,
-};
-
-static struct fixs fndays[8];          /* full national days names */
-static struct fixs ndays[8];           /* short national days names */
-
-static struct fixs fnmonths[13];       /* full national months names */
-static struct fixs nmonths[13];                /* short national month names */
+time_t                 time1, time2;
+const struct tm                tm0;
+char                   dayname[100];
+int                    year1, year2;
 
 
 void
-setnnames(void)
-{
-       char buf[80];
-       int i, l;
-       struct tm tm;
-
-       for (i = 0; i < 7; i++) {
-               tm.tm_wday = i;
-               strftime(buf, sizeof(buf), "%a", &tm);
-               for (l = strlen(buf);
-                    l > 0 && isspace((unsigned char)buf[l - 1]);
-                    l--)
-                       ;
-               buf[l] = '\0';
-               if (ndays[i].name != NULL)
-                       free(ndays[i].name);
-               if ((ndays[i].name = strdup(buf)) == NULL)
-                       errx(1, "cannot allocate memory");
-               ndays[i].len = strlen(buf);
-
-               strftime(buf, sizeof(buf), "%A", &tm);
-               for (l = strlen(buf);
-                    l > 0 && isspace((unsigned char)buf[l - 1]);
-                    l--)
-                       ;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to