Thanks for the revert. I handcrafted https://reviews.freebsd.org/D23581 <https://reviews.freebsd.org/D23581> a while ago, and this took me two days.
Gordon > Am 03.03.2020 um 01:20 schrieb Conrad Meyer <c...@freebsd.org>: > > Author: cem > Date: Tue Mar 3 00:20:08 2020 > New Revision: 358562 > URL: https://svnweb.freebsd.org/changeset/base/358562 > > Log: > Add extremely useful calendar(1) application to FreeBSD > > It does extremely useful things like execute sendmail and spew dubiously > accurate factoids. > > From the feedback, it seems like it is an essential utility in a modern unix > and not at all a useless bikeshed. How do those Linux people live without > it? > Reverts r358561. > > Added: > head/tools/build/options/WITHOUT_CALENDAR > - copied unchanged from r358560, head/tools/build/options/WITHOUT_CALENDAR > head/usr.bin/calendar/Makefile > - copied unchanged from r358560, head/usr.bin/calendar/Makefile > head/usr.bin/calendar/Makefile.depend > - copied unchanged from r358560, head/usr.bin/calendar/Makefile.depend > head/usr.bin/calendar/calendar.1 > - copied unchanged from r358560, head/usr.bin/calendar/calendar.1 > head/usr.bin/calendar/calendar.c > - copied unchanged from r358560, head/usr.bin/calendar/calendar.c > head/usr.bin/calendar/calendar.h > - copied unchanged from r358560, head/usr.bin/calendar/calendar.h > head/usr.bin/calendar/calendars/calendar.all > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.all > head/usr.bin/calendar/calendars/calendar.australia > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.australia > head/usr.bin/calendar/calendars/calendar.birthday > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.birthday > head/usr.bin/calendar/calendars/calendar.brazilian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.brazilian > head/usr.bin/calendar/calendars/calendar.christian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.christian > head/usr.bin/calendar/calendars/calendar.computer > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.computer > head/usr.bin/calendar/calendars/calendar.croatian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.croatian > head/usr.bin/calendar/calendars/calendar.dutch > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.dutch > head/usr.bin/calendar/calendars/calendar.french > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.french > head/usr.bin/calendar/calendars/calendar.german > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.german > head/usr.bin/calendar/calendars/calendar.history > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.history > head/usr.bin/calendar/calendars/calendar.holiday > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.holiday > head/usr.bin/calendar/calendars/calendar.hungarian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.hungarian > head/usr.bin/calendar/calendars/calendar.judaic > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.judaic > head/usr.bin/calendar/calendars/calendar.lotr > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.lotr > head/usr.bin/calendar/calendars/calendar.music > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.music > head/usr.bin/calendar/calendars/calendar.newzealand > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.newzealand > head/usr.bin/calendar/calendars/calendar.russian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.russian > head/usr.bin/calendar/calendars/calendar.southafrica > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.southafrica > head/usr.bin/calendar/calendars/calendar.ukrainian > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.ukrainian > head/usr.bin/calendar/calendars/calendar.usholiday > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.usholiday > head/usr.bin/calendar/calendars/calendar.world > - copied unchanged from r358560, > head/usr.bin/calendar/calendars/calendar.world > head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/ > - copied from r358560, head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/ > head/usr.bin/calendar/calendars/de_DE.ISO8859-1/ > - copied from r358560, head/usr.bin/calendar/calendars/de_DE.ISO8859-1/ > head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/ > - copied from r358560, head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/ > head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/ > - copied from r358560, head/usr.bin/calendar/calendars/hr_HR.ISO8859-2/ > head/usr.bin/calendar/calendars/hu_HU.ISO8859-2/ > - copied from r358560, head/usr.bin/calendar/calendars/hu_HU.ISO8859-2/ > head/usr.bin/calendar/calendars/pt_BR.ISO8859-1/ > - copied from r358560, head/usr.bin/calendar/calendars/pt_BR.ISO8859-1/ > head/usr.bin/calendar/calendars/pt_BR.UTF-8/ > - copied from r358560, head/usr.bin/calendar/calendars/pt_BR.UTF-8/ > head/usr.bin/calendar/calendars/ru_RU.KOI8-R/ > - copied from r358560, head/usr.bin/calendar/calendars/ru_RU.KOI8-R/ > head/usr.bin/calendar/calendars/ru_RU.UTF-8/ > - copied from r358560, head/usr.bin/calendar/calendars/ru_RU.UTF-8/ > head/usr.bin/calendar/calendars/uk_UA.KOI8-U/ > - copied from r358560, head/usr.bin/calendar/calendars/uk_UA.KOI8-U/ > head/usr.bin/calendar/dates.c > - copied unchanged from r358560, head/usr.bin/calendar/dates.c > head/usr.bin/calendar/day.c > - copied unchanged from r358560, head/usr.bin/calendar/day.c > head/usr.bin/calendar/events.c > - copied unchanged from r358560, head/usr.bin/calendar/events.c > head/usr.bin/calendar/io.c > - copied unchanged from r358560, head/usr.bin/calendar/io.c > head/usr.bin/calendar/locale.c > - copied unchanged from r358560, head/usr.bin/calendar/locale.c > head/usr.bin/calendar/ostern.c > - copied unchanged from r358560, head/usr.bin/calendar/ostern.c > head/usr.bin/calendar/parsedata.c > - copied unchanged from r358560, head/usr.bin/calendar/parsedata.c > head/usr.bin/calendar/paskha.c > - copied unchanged from r358560, head/usr.bin/calendar/paskha.c > head/usr.bin/calendar/pathnames.h > - copied unchanged from r358560, head/usr.bin/calendar/pathnames.h > head/usr.bin/calendar/pom.c > - copied unchanged from r358560, head/usr.bin/calendar/pom.c > head/usr.bin/calendar/sunpos.c > - copied unchanged from r358560, head/usr.bin/calendar/sunpos.c > head/usr.bin/calendar/tests/ > - copied from r358560, head/usr.bin/calendar/tests/ > head/usr.sbin/periodic/etc/daily/300.calendar > - copied unchanged from r358560, > head/usr.sbin/periodic/etc/daily/300.calendar > Modified: > head/ObsoleteFiles.inc > head/share/man/man5/periodic.conf.5 > head/share/man/man5/src.conf.5 > head/share/man/man7/hier.7 > head/tools/tools/nanobsd/dhcpd/common > head/tools/tools/nanobsd/embedded/common > head/usr.bin/Makefile > head/usr.bin/leave/leave.1 > head/usr.sbin/periodic/etc/daily/Makefile > head/usr.sbin/periodic/periodic.conf > > Modified: head/ObsoleteFiles.inc > ============================================================================== > --- head/ObsoleteFiles.inc Mon Mar 2 23:37:47 2020 (r358561) > +++ head/ObsoleteFiles.inc Tue Mar 3 00:20:08 2020 (r358562) > @@ -36,11 +36,6 @@ > # xargs -n1 | sort | uniq -d; > # done > > -# 20200302: calendar(1) removed > -OLD_DIRS+=usr/share/calendar > -OLD_FILES+=usr/bin/calendar > -OLD_FILES+=usr/share/man/man1/calendar.1.gz > - > # 20200301: bktr removed > OLD_DIRS+=usr/include/dev/bktr > OLD_FILES+=usr/include/dev/bktr/ioctl_bktr.h > > Modified: head/share/man/man5/periodic.conf.5 > ============================================================================== > --- head/share/man/man5/periodic.conf.5 Mon Mar 2 23:37:47 2020 > (r358561) > +++ head/share/man/man5/periodic.conf.5 Tue Mar 3 00:20:08 2020 > (r358562) > @@ -273,6 +273,13 @@ Set to > if you want the > .Pa /etc/mail/aliases > file backed up and modifications to be displayed in your daily output. > +.It Va daily_calendar_enable > +.Pq Vt bool > +Set to > +.Dq Li YES > +if you want to run > +.Nm calendar Fl a > +daily. > .It Va daily_accounting_enable > .Pq Vt bool > Set to > @@ -963,6 +970,7 @@ is shared or distributed. > .El > .Sh SEE ALSO > .Xr apropos 1 , > +.Xr calendar 1 , > .Xr df 1 , > .Xr diff 1 , > .Xr gzip 1 , > > Modified: head/share/man/man5/src.conf.5 > ============================================================================== > --- head/share/man/man5/src.conf.5 Mon Mar 2 23:37:47 2020 > (r358561) > +++ head/share/man/man5/src.conf.5 Tue Mar 3 00:20:08 2020 > (r358562) > @@ -271,6 +271,9 @@ is set explicitly) > .El > .It Va WITHOUT_BZIP2_SUPPORT > Set to build some programs without optional bzip2 support. > +.It Va WITHOUT_CALENDAR > +Set to not build > +.Xr calendar 1 . > .It Va WITHOUT_CAPSICUM > Set to not build Capsicum support into system programs. > When set, it enforces these options: > > Modified: head/share/man/man7/hier.7 > ============================================================================== > --- head/share/man/man7/hier.7 Mon Mar 2 23:37:47 2020 > (r358561) > +++ head/share/man/man7/hier.7 Tue Mar 3 00:20:08 2020 > (r358562) > @@ -442,6 +442,10 @@ system daemons & system utilities (executed by users) > architecture-independent files > .Pp > .Bl -tag -width Fl -compact > +.It Pa calendar/ > +a variety of pre-fab calendar files; > +see > +.Xr calendar 1 > .It Pa dict/ > word lists; > see > > Copied: head/tools/build/options/WITHOUT_CALENDAR (from r358560, > head/tools/build/options/WITHOUT_CALENDAR) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/tools/build/options/WITHOUT_CALENDAR Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/tools/build/options/WITHOUT_CALENDAR) > @@ -0,0 +1,3 @@ > +.\" $FreeBSD$ > +Set to not build > +.Xr calendar 1 . > > Modified: head/tools/tools/nanobsd/dhcpd/common > ============================================================================== > --- head/tools/tools/nanobsd/dhcpd/common Mon Mar 2 23:37:47 2020 > (r358561) > +++ head/tools/tools/nanobsd/dhcpd/common Tue Mar 3 00:20:08 2020 > (r358562) > @@ -104,6 +104,7 @@ WITHOUT_ACPI=true > WITHOUT_ATM=true > WITHOUT_AUDIT=true > WITHOUT_BLUETOOTH=true > +WITHOUT_CALENDAR=true > WITHOUT_DICT=true > WITHOUT_EXAMPLES=true > WITHOUT_GAMES=true > > Modified: head/tools/tools/nanobsd/embedded/common > ============================================================================== > --- head/tools/tools/nanobsd/embedded/common Mon Mar 2 23:37:47 2020 > (r358561) > +++ head/tools/tools/nanobsd/embedded/common Tue Mar 3 00:20:08 2020 > (r358562) > @@ -135,6 +135,7 @@ WITHOUT_ACPI=true > WITHOUT_ATM=true > WITHOUT_AUDIT=true > WITHOUT_BLUETOOTH=true > +WITHOUT_CALENDAR=true > WITHOUT_DICT=true > WITHOUT_EXAMPLES=true > WITHOUT_GAMES=true > > Modified: head/usr.bin/Makefile > ============================================================================== > --- head/usr.bin/Makefile Mon Mar 2 23:37:47 2020 (r358561) > +++ head/usr.bin/Makefile Tue Mar 3 00:20:08 2020 (r358562) > @@ -195,6 +195,7 @@ SUBDIR.${MK_AT}+= at > SUBDIR.${MK_ATM}+= atm > SUBDIR.${MK_BLUETOOTH}+= bluetooth > SUBDIR.${MK_BSD_CPIO}+= cpio > +SUBDIR.${MK_CALENDAR}+= calendar > SUBDIR.${MK_CLANG}+= clang > SUBDIR.${MK_DIALOG}+= dpv > SUBDIR.${MK_EE}+= ee > > Copied: head/usr.bin/calendar/Makefile (from r358560, > head/usr.bin/calendar/Makefile) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/calendar/Makefile Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/usr.bin/calendar/Makefile) > @@ -0,0 +1,117 @@ > +# @(#)Makefile 8.1 (Berkeley) 6/6/93 > +# $FreeBSD$ > + > +.include <src.opts.mk> > + > +PROG= calendar > +SRCS= calendar.c locale.c events.c dates.c parsedata.c io.c day.c \ > + ostern.c paskha.c pom.c sunpos.c > +LIBADD= m util > +INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \ > + hr_HR.ISO8859-2 hu_HU.ISO8859-2 pt_BR.ISO8859-1 \ > + pt_BR.UTF-8 ru_RU.KOI8-R ru_RU.UTF-8 uk_UA.KOI8-U > +DE_LINKS= de_DE.ISO8859-15 > +FR_LINKS= fr_FR.ISO8859-15 > + > +.if ${MK_ICONV} == "yes" > +CFLAGS+= -DWITH_ICONV > +.endif > + > +FILESGROUPS+= CALS > +CALS= calendars/calendar.all \ > + calendars/calendar.australia \ > + calendars/calendar.birthday \ > + calendars/calendar.brazilian \ > + calendars/calendar.christian \ > + calendars/calendar.computer \ > + calendars/calendar.croatian \ > + calendars/calendar.dutch \ > + calendars/calendar.freebsd \ > + calendars/calendar.french \ > + calendars/calendar.german \ > + calendars/calendar.history \ > + calendars/calendar.holiday \ > + calendars/calendar.hungarian \ > + calendars/calendar.judaic \ > + calendars/calendar.lotr \ > + calendars/calendar.music \ > + calendars/calendar.newzealand \ > + calendars/calendar.russian \ > + calendars/calendar.southafrica \ > + calendars/calendar.ukrainian \ > + calendars/calendar.usholiday \ > + calendars/calendar.world > +CALSDIR= ${SHAREDIR}/calendar > + > +CAL_de_AT.ISO_8859-15= calendar.feiertag > + > +CAL_de_DE.ISO8859-1= calendar.all \ > + calendar.feiertag \ > + calendar.geschichte \ > + calendar.kirche \ > + calendar.literatur \ > + calendar.musik \ > + calendar.wissenschaft > + > +CAL_fr_FR.ISO8859-1= calendar.all \ > + calendar.fetes \ > + calendar.french \ > + calendar.jferies \ > + calendar.proverbes > + > +CAL_hr_HR.ISO8859-2= calendar.all \ > + calendar.praznici > + > +CAL_hu_HU.ISO8859-2= calendar.all \ > + calendar.nevnapok \ > + calendar.unnepek > + > +CAL_pt_BR.ISO8859-1= calendar.all \ > + calendar.commemorative \ > + calendar.holidays \ > + calendar.mcommemorative > + > +CAL_pt_BR.UTF-8= calendar.all \ > + calendar.commemorative \ > + calendar.holidays \ > + calendar.mcommemorative > + > +CAL_ru_RU.KOI8-R= calendar.all \ > + calendar.common \ > + calendar.holiday \ > + calendar.military \ > + calendar.orthodox \ > + calendar.pagan > + > +CAL_ru_RU.UTF-8= calendar.all \ > + calendar.common \ > + calendar.holiday \ > + calendar.military \ > + calendar.orthodox \ > + calendar.pagan > + > +CAL_uk_UA.KOI8-U= calendar.all \ > + calendar.holiday \ > + calendar.misc \ > + calendar.orthodox > + > +.for lang in ${INTER} > +FILESGROUPS+= CALS_${lang} > +CALS_${lang}DIR= ${SHAREDIR}/calendar/${lang} > +.for file in ${CAL_${lang}} > +CALS_${lang}+= ${file:S@^@calendars/${lang}/@} > +.endfor > +.endfor > + > + > +.for link in ${DE_LINKS} > +SYMLINKS+= de_DE.ISO8859-1 ${SHAREDIR}/calendar/${link} > +.endfor > +.for link in ${FR_LINKS} > +SYMLINKS+= fr_FR.ISO8859-1 ${SHAREDIR}/calendar/${link} > +.endfor > + > +HAS_TESTS= > +SUBDIR.${MK_TESTS}+= tests > + > +.include <bsd.prog.mk> > > Copied: head/usr.bin/calendar/Makefile.depend (from r358560, > head/usr.bin/calendar/Makefile.depend) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/calendar/Makefile.depend Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/usr.bin/calendar/Makefile.depend) > @@ -0,0 +1,18 @@ > +# $FreeBSD$ > +# Autogenerated - do NOT edit! > + > +DIRDEPS = \ > + gnu/lib/csu \ > + include \ > + include/xlocale \ > + lib/${CSU_DIR} \ > + lib/libc \ > + lib/libcompiler_rt \ > + lib/msun \ > + > + > +.include <dirdeps.mk> > + > +.if ${DEP_RELDIR} == ${_DEP_RELDIR} > +# local dependencies - needed for -jN in clean tree > +.endif > > Copied: head/usr.bin/calendar/calendar.1 (from r358560, > head/usr.bin/calendar/calendar.1) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/calendar/calendar.1 Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/usr.bin/calendar/calendar.1) > @@ -0,0 +1,333 @@ > +.\" Copyright (c) 1989, 1990, 1993 > +.\" The Regents of the University of California. All rights reserved. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 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. 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. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 > +.\" $FreeBSD$ > +.\" > +.Dd July 24, 2016 > +.Dt CALENDAR 1 > +.Os > +.Sh NAME > +.Nm calendar > +.Nd reminder service > +.Sh SYNOPSIS > +.Nm > +.Op Fl A Ar num > +.Op Fl a > +.Op Fl B Ar num > +.Op Fl D Ar moon|sun > +.Op Fl d > +.Op Fl F Ar friday > +.Op Fl f Ar calendarfile > +.Op Fl l Ar longitude > +.Oo > +.Bk -words > +.Fl t Ar dd Ns > +.Sm off > +.Op . Ar mm Op . Ar year > +.Sm on > +.Ek > +.Oc > +.Op Fl U Ar UTC-offset > +.Op Fl W Ar num > +.Sh DESCRIPTION > +The > +.Nm > +utility checks the current directory for a file named > +.Pa calendar > +and displays lines that fall into the specified date range. > +On the day before a weekend (normally Friday), events for the next > +three days are displayed. > +.Pp > +The following options are available: > +.Bl -tag -width Ds > +.It Fl A Ar num > +Print lines from today and the next > +.Ar num > +days (forward, future). > +.It Fl a > +Process the ``calendar'' files of all users and mail the results > +to them. > +This requires super-user privileges. > +.It Fl B Ar num > +Print lines from today and the previous > +.Ar num > +days (backward, past). > +.It Fl D Ar moon|sun > +Print UTC offset, longitude and moon or sun information. > +.It Fl d > +Debug option: print current date information. > +.It Fl F Ar friday > +Specify which day of the week is ``Friday'' (the day before the > +weekend begins). > +Default is 5. > +.It Fl f Pa calendarfile > +Use > +.Pa calendarfile > +as the default calendar file. > +.It Fl l Ar longitude > +Perform lunar and solar calculations from this longitude. > +If neither longitude nor UTC offset is specified, the calculations will > +be based on the difference between UTC time and localtime. > +If both are specified, UTC offset overrides longitude. > +.It Xo Fl t > +.Sm off > +.Ar dd > +.Op . Ar mm Op . Ar year > +.Sm on > +.Xc > +For test purposes only: set date directly to argument values. > +.It Fl U Ar UTC-offset > +Perform lunar and solar calculations from this UTC offset. > +If neither UTC offset nor longitude is specified, the calculations > +will be based on the difference between UTC time and localtime. > +If both are specified, UTC offset overrides longitude. > +.It Fl W Ar num > +Print lines from today and the next > +.Ar num > +days (forward, future). > +Ignore weekends when calculating the number of days. > +.El > +.Sh FILE FORMAT > +To handle calendars in your national code table you can specify > +.Dq LANG=<locale_name> > +in the calendar file as early as possible. > +.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 September. > +.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 > +strings. > +If the proper locale is set, national month and weekday > +names can be used. > +A single asterisk (``*'') matches every month. > +A day without a month matches that day of every week. > +A month without a day matches the first of that month. > +Two numbers default to the month followed by the day. > +Lines with leading tabs default to the last entered date, allowing > +multiple line specifications for a single date. > +.Pp > +The names of the recognized special days may be followed by a > +positive or negative integer, like: > +.Dq Easter+3 > +or > +.Dq Paskha-4 . > +.Pp > +Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for > +last, first, second, third, fourth) for moving events like > +``the last Monday in April''. > +.Pp > +By convention, dates followed by an asterisk are not fixed, i.e., change > +from year to year. > +.Pp > +Day descriptions start after the first <tab> character in the line; > +if the line does not contain a <tab> character, it is not displayed. > +If the first character in the line is a <tab> character, it is treated as > +a continuation of the previous line. > +.Pp > +The > +.Nm > +file is preprocessed by a limited subset of > +.Xr cpp 1 > +internally, allowing the inclusion of shared files such as > +lists of company holidays or meetings. > +This limited subset consists of \fB#include #ifndef #endif\fR and > \fB#define\fR. > +If the shared file is not referenced by a full pathname, > +.Xr calendar 1 > +searches in the current (or home) directory first, and then in the > +directory > +.Pa /usr/share/calendar . > +Empty lines and lines protected by the C commenting syntax > +.Pq Li /* ... */ > +are ignored. > +.Pp > +Some possible calendar entries (<tab> characters highlighted by > +\fB\et\fR sequence) > +.Bd -unfilled -offset indent > +LANG=C > +Easter=Ostern > + > +#include <calendar.usholiday> > +#include <calendar.birthday> > + > +6/15\fB\et\fRJune 15 (if ambiguous, will default to month/day). > +Jun. 15\fB\et\fRJune 15. > +15 June\fB\et\fRJune 15. > +Thursday\fB\et\fREvery Thursday. > +June\fB\et\fREvery June 1st. > +15 *\fB\et\fR15th of every month. > +2010/4/15\fB\et\fR15 April 2010 > + > +May Sun+2\fB\et\fRsecond Sunday in May (Muttertag) > +04/SunLast\fB\et\fRlast Sunday in April, > +\fB\et\fRsummer time in Europe > +Easter\fB\et\fREaster > +Ostern-2\fB\et\fRGood Friday (2 days before Easter) > +Paskha\fB\et\fROrthodox Easter > + > +.Ed > +.Sh FILES > +.Bl -tag -width calendar.christian -compact > +.It Pa calendar > +file in current directory. > +.It Pa ~/.calendar > +.Pa calendar > +HOME directory. > +A chdir is done into this directory if it exists. > +.It Pa ~/.calendar/calendar > +calendar file to use if no calendar file exists in the current directory. > +.It Pa ~/.calendar/nomail > +do not send mail if this file exists. > +.El > +.Pp > +The following default calendar files are provided in > +.Pa /usr/share/calendar: > +.Pp > +.Bl -tag -width calendar.southafrica -compact > +.It Pa calendar.all > +File which includes all the default files. > +.It Pa calendar.australia > +Calendar of events in Australia. > +.It Pa calendar.birthday > +Births and deaths of famous (and not-so-famous) people. > +.It Pa calendar.christian > +Christian holidays. > +This calendar should be updated yearly by the local system administrator > +so that roving holidays are set correctly for the current year. > +.It Pa calendar.computer > +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 > +committers. > +.It Pa calendar.french > +Calendar of events in France. > +.It Pa calendar.german > +Calendar of events in Germany. > +.It Pa calendar.history > +Everything else, mostly U.S.\& historical events. > +.It Pa calendar.holiday > +Other holidays, including the not-well-known, obscure, and > +.Em really > +obscure. > +.It Pa calendar.judaic > +Jewish holidays. > +The entries for this calendar have been obtained from the port > +deskutils/hebcal. > +.It Pa calendar.music > +Musical events, births, and deaths. > +Strongly oriented toward rock 'n' roll. > +.It Pa calendar.newzealand > +Calendar of events in New Zealand. > +.It Pa calendar.russian > +Russian calendar. > +.It Pa calendar.southafrica > +Calendar of events in South Africa. > +.It Pa calendar.usholiday > +U.S.\& holidays. > +This calendar should be updated yearly by the local system administrator > +so that roving holidays are set correctly for the current year. > +.It Pa calendar.world > +Includes all calendar files except for national files. > +.El > +.Sh COMPATIBILITY > +The > +.Nm > +program previously selected lines which had the correct date anywhere > +in the line. > +This is no longer true, the date is only recognized when it occurs > +at the beginning of a line. > +.Sh SEE ALSO > +.Xr at 1 , > +.Xr mail 1 , > +.Xr cron 8 > +.Sh HISTORY > +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 does not 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 > +internal cpp does not correctly do #ifndef and will discard the rest > +of the file if a #ifndef is triggered. > +It also has a maximum of 50 include file and/or 100 #defines > +and only recognises #include, #define and > +#ifndef. > +.Pp > +There is no possibility to properly specify the local position > +needed for solar and lunar calculations. > > Copied: head/usr.bin/calendar/calendar.c (from r358560, > head/usr.bin/calendar/calendar.c) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/calendar/calendar.c Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/usr.bin/calendar/calendar.c) > @@ -0,0 +1,258 @@ > +/*- > + * SPDX-License-Identifier: BSD-3-Clause > + * > + * Copyright (c) 1989, 1993, 1994 > + * The Regents of the University of California. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 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. 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. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#ifndef lint > +static const char copyright[] = > +"@(#) Copyright (c) 1989, 1993\n\ > + The Regents of the University of California. All rights reserved.\n"; > +#endif > + > +#if 0 > +#ifndef lint > +static char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; > +#endif > +#endif > + > +#include <sys/cdefs.h> > +__FBSDID("$FreeBSD$"); > + > +#include <sys/types.h> > +#include <err.h> > +#include <errno.h> > +#include <locale.h> > +#include <login_cap.h> > +#include <langinfo.h> > +#include <pwd.h> > +#include <stdio.h> > +#include <stdlib.h> > +#include <string.h> > +#include <time.h> > +#include <unistd.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; > +static char *DEBUG = NULL; > +static time_t f_time = 0; > +double UTCOffset = UTCOFFSET_NOTSET; > +int EastLongitude = LONGITUDE_NOTSET; > +#ifdef WITH_ICONV > +const char *outputEncoding = NULL; > +#endif > + > +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:D:dF:f:l:t:U:W:?")) != -1) > + switch (ch) { > + case '-': /* backward contemptible */ > + case 'a': > + if (getuid()) { > + errno = EPERM; > + err(1, NULL); > + } > + doall = 1; > + break; > + > + case 'W': /* we don't need no steenking Fridays */ > + Friday = -1; > + /* FALLTHROUGH */ > + > + case 'A': /* days after current date */ > + f_dayAfter = atoi(optarg); > + if (f_dayAfter < 0) > + errx(1, "number of days must be positive"); > + break; > + > + case 'B': /* days before current date */ > + f_dayBefore = atoi(optarg); > + if (f_dayBefore < 0) > + errx(1, "number of days must be positive"); > + break; > + > + case 'D': /* debug output of sun and moon info */ > + DEBUG = optarg; > + break; > + > + case 'd': /* debug output of current date */ > + debug = 1; > + break; > + > + case 'F': /* Change the time: When does weekend start? */ > + Friday = atoi(optarg); > + break; > + > + case 'f': /* other calendar file */ > + calendarFile = optarg; > + break; > + > + case 'l': /* Change longitudal position */ > + EastLongitude = strtol(optarg, NULL, 10); > + break; > + > + case 't': /* other date, for tests */ > + f_time = Mktime(optarg); > + break; > + > + case 'U': /* Change UTC offset */ > + UTCOffset = strtod(optarg, NULL); > + break; > + > + case '?': > + default: > + usage(); > + } > + > + argc -= optind; > + argv += optind; > + > + if (argc) > + usage(); > + > + /* use current time */ > + if (f_time <= 0) > + (void)time(&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) { > + pid_t pid; > + > + if (chdir(pw->pw_dir) == -1) > + continue; > + pid = fork(); > + if (pid < 0) > + err(1, "fork"); > + if (pid == 0) { > + login_cap_t *lc; > + > + lc = login_getpwclass(pw); > + if (setusercontext(lc, pw, pw->pw_uid, > + LOGIN_SETALL) != 0) > + errx(1, "setusercontext"); > + cal(); > + exit(0); > + } > + } > + else { > +#ifdef WITH_ICONV > + /* Save the information about the encoding used in the > terminal. */ > + outputEncoding = strdup(nl_langinfo(CODESET)); > + if (outputEncoding == NULL) > + errx(1, "cannot allocate memory"); > +#endif > + cal(); > + } > + exit(0); > +} > + > + > +static void __dead2 > +usage(void) > +{ > + > + fprintf(stderr, "%s\n%s\n%s\n", > + "usage: calendar [-A days] [-a] [-B days] [-D sun|moon] [-d]", > + " [-F friday] [-f calendarfile] [-l longitude]", > + " [-t dd[.mm[.year]]] [-U utcoffset] [-W days]" > + ); > + exit(1); > +} > > Copied: head/usr.bin/calendar/calendar.h (from r358560, > head/usr.bin/calendar/calendar.h) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/calendar/calendar.h Tue Mar 3 00:20:08 2020 > (r358562, copy of r358560, head/usr.bin/calendar/calendar.h) > @@ -0,0 +1,206 @@ > +/*- > + * SPDX-License-Identifier: BSD-3-Clause > + * > + * Copyright (c) 1989, 1993, 1994 > + * The Regents of the University of California. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 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. 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. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#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 time_t t1, t2; > +extern const char *calendarFile; > +extern int yrdays; > +extern struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon; > +extern struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice; > +extern double UTCOffset; > +extern int EastLongitude; > +#ifdef WITH_ICONV > +extern const char *outputEncoding; > +#endif > + > +#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) > + > +/* 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 F_YEAR 0x40000 > + > +#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; > + 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 */ > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"