1.\" Copyright (c) 1989, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.Dd December 17, 2023 29.Dt CALENDAR 1 30.Os 31.Sh NAME 32.Nm calendar 33.Nd reminder service 34.Sh SYNOPSIS 35.Nm 36.Op Fl A Ar num 37.Op Fl a 38.Op Fl B Ar num 39.Op Fl D Ar moon|sun 40.Op Fl d 41.Op Fl F Ar friday 42.Op Fl f Ar calendarfile 43.Op Fl l Ar longitude 44.Oo 45.Bk -words 46.Fl t Ar dd Ns 47.Sm off 48.Op . Ar mm Op . Ar year 49.Sm on 50.Ek 51.Oc 52.Op Fl U Ar UTC-offset 53.Op Fl W Ar num 54.Sh DESCRIPTION 55The 56.Nm 57utility checks the current directory for a file named 58.Pa calendar 59and displays lines that fall into the specified date range. 60On the day before a weekend (normally Friday), events for the next 61three days are displayed. 62.Pp 63The following options are available: 64.Bl -tag -width Ds 65.It Fl A Ar num 66Print lines from today and the next 67.Ar num 68days (forward, future). 69.It Fl a 70Process the ``calendar'' files for users found in 71.Pa /etc/passwd 72and mail the results 73to them. 74This can result in multiple messages for specific files, since 75.Pa /etc/passwd 76does not require home directories to be unique. 77In particular, by default 78.Ar root , 79.Ar toor 80and 81.Ar daemon 82share the same home directory. 83If this directory contains calendar information, 84.Nm 85will process the file three times. 86.Pp 87This option requires super-user privileges. 88.It Fl B Ar num 89Print lines from today and the previous 90.Ar num 91days (backward, past). 92.It Fl D Ar moon|sun 93Print UTC offset, longitude and moon or sun information. 94.It Fl d 95Debug option: print current date information. 96.It Fl F Ar friday 97Specify which day of the week is ``Friday'' (the day before the 98weekend begins). 99Default is 5. 100.It Fl f Pa calendarfile 101Use 102.Pa calendarfile 103as the default calendar file. 104.It Fl l Ar longitude 105Perform lunar and solar calculations from this longitude. 106If neither longitude nor UTC offset is specified, the calculations will 107be based on the difference between UTC time and localtime. 108If both are specified, UTC offset overrides longitude. 109.It Xo Fl t 110.Sm off 111.Ar dd 112.Op . Ar mm Op . Ar year 113.Sm on 114.Xc 115For test purposes only: set date directly to argument values. 116.It Fl U Ar UTC-offset 117Perform lunar and solar calculations from this UTC offset. 118If neither UTC offset nor longitude is specified, the calculations 119will be based on the difference between UTC time and localtime. 120If both are specified, UTC offset overrides longitude. 121.It Fl W Ar num 122Print lines from today and the next 123.Ar num 124days (forward, future). 125Ignore weekends when calculating the number of days. 126.El 127.Sh FILE FORMAT 128To handle calendars in your national code table you can specify 129.Dq LANG=<locale_name> 130in the calendar file as early as possible. 131.Pp 132To handle the local name of sequences, you can specify them as: 133.Dq SEQUENCE=<first> <second> <third> <fourth> <fifth> <last> 134in the calendar file as early as possible. 135.Pp 136The names of the following special days are recognized: 137.Bl -tag -width 123456789012345 -compact 138.It Easter 139Catholic Easter. 140.It Paskha 141Orthodox Easter. 142.It NewMoon 143The lunar New Moon. 144.It FullMoon 145The lunar Full Moon. 146.It MarEquinox 147The solar equinox in March. 148.It JunSolstice 149The solar solstice in June. 150.It SepEquinox 151The solar equinox in September. 152.It DecSolstice 153The solar solstice in December. 154.It ChineseNewYear 155The first day of the Chinese year. 156.El 157These names may be reassigned to their local names via an assignment 158like 159.Dq Easter=Pasen 160in the calendar file. 161.Pp 162Other lines should begin with a month and day. 163They may be entered in almost any format, either numeric or as character 164strings. 165If the proper locale is set, national month and weekday 166names can be used. 167A single asterisk (``*'') matches every month. 168A day without a month matches that day of every week. 169A month without a day matches the first of that month. 170Two numbers default to the month followed by the day. 171Lines with leading tabs default to the last entered date, allowing 172multiple line specifications for a single date. 173.Pp 174The names of the recognized special days may be followed by a 175positive or negative integer, like: 176.Dq Easter+3 177or 178.Dq Paskha-4 . 179.Pp 180Weekdays may be followed by ``-4'' ...\& ``+5'' (aliases for 181last, first, second, third, fourth) for moving events like 182``the last Monday in April''. 183.Pp 184By convention, dates followed by an asterisk are not fixed, i.e., change 185from year to year. 186.Pp 187Day descriptions start after the first <tab> character in the line; 188if the line does not contain a <tab> character, it is not displayed. 189If the first character in the line is a <tab> character, it is treated as 190a continuation of the previous line. 191.Pp 192The 193.Nm 194file is preprocessed by a limited subset of 195.Xr cpp 1 196internally, allowing the inclusion of shared files such as 197lists of company holidays or meetings. 198This limited subset consists of \fB#include\fR, \fB#define\fR, 199\fB#undef\fR, \fB#ifdef\fR, \fB#ifndef\fR, \fB#else\fR, \fB#warning\fR, 200and \fB#error\fR. 201.Pp 202Conditions can be nested and the consistency of opening and closing 203instructions is checked. 204Only the first word after #define is used as the name of the 205condition variable being defined. 206More than word following #ifdef, #ifndef, or #undef is considered a syntax 207error, since names cannot include white-space. 208Included files are parsed in a global scope with regard to the condition 209variables being defined or tested therein. 210All conditional blocks are implicitly closed at the end of a file, 211and missing #endif instructions are assumed to be present on implied 212succeeding lines. 213.Pp 214If the shared file is not referenced by a full pathname, 215.Nm 216searches in the same order of precedence described in 217.Sx FILES . 218.Pp 219Blank lines and text protected by the C comment syntax 220.Ql /* ... */ 221or 222.Ql // 223are ignored, but the latter only at the beginning of a line or after 224white space to allow for URLs in calendar entries. 225.Pp 226Some possible calendar entries (<tab> characters highlighted by 227\fB\et\fR sequence): 228.Bd -unfilled -offset indent 229LANG=C 230Easter=Ostern 231 232#include <calendar.usholiday> 233#include <calendar.birthday> 234 2356/15\fB\et\fRJune 15 (if ambiguous, will default to month/day). 236Jun. 15\fB\et\fRJune 15. 23715 June\fB\et\fRJune 15. 238Thursday\fB\et\fREvery Thursday. 239June\fB\et\fREvery June 1st. 24015 *\fB\et\fR15th of every month. 2412010/4/15\fB\et\fR15 April 2010 242 243May Sun+2\fB\et\fRsecond Sunday in May (Muttertag) 24404/SunLast\fB\et\fRlast Sunday in April, 245\fB\et\fRsummer time in Europe 246Easter\fB\et\fREaster 247Ostern-2\fB\et\fRGood Friday (2 days before Easter) 248Paskha\fB\et\fROrthodox Easter 249 250.Ed 251.Sh FILES 252.Bl -tag -width calendar.christian -compact 253.It Pa calendar 254file in current directory. 255.It Pa ~/.calendar 256.Pa calendar 257HOME directory. 258A chdir is done into this directory if it exists. 259.It Pa ~/.calendar/calendar 260calendar file to use if no calendar file exists in the current directory. 261.It Pa ~/.calendar/nomail 262do not send mail if this file exists. 263.It Pa /usr/share/calendar 264system wide location of calendar files provided as part of the base system. 265.It Pa /usr/local/share/calendar 266system wide location for calendar files provided by a port or package. 267.El 268.Pp 269The order of precedence in searches for a calendar file is: 270current directory, ~/.calendar, /usr/local/share/calendar, /usr/share/calendar. 271Files of similar names are ignored in lower precedence locations. 272.Pp 273The following default calendar files are provided by the 274deskutils/calendar-data port. 275.Pp 276.Bl -tag -width calendar.southafrica -compact 277.It Pa calendar.all 278File which includes all the default files. 279.It Pa calendar.australia 280Calendar of events in Australia. 281.It Pa calendar.birthday 282Births and deaths of famous (and not-so-famous) people. 283.It Pa calendar.christian 284Christian holidays. 285This calendar should be updated yearly by the local system administrator 286so that roving holidays are set correctly for the current year. 287.It Pa calendar.computer 288Days of special significance to computer people. 289.It Pa calendar.croatian 290Calendar of events in Croatia. 291.It Pa calendar.dutch 292Calendar of events in the Netherlands. 293.It Pa calendar.freebsd 294Birthdays of 295.Fx 296committers. 297.It Pa calendar.french 298Calendar of events in France. 299.It Pa calendar.german 300Calendar of events in Germany. 301.It Pa calendar.history 302Everything else, mostly U.S.\& historical events. 303.It Pa calendar.holiday 304Other holidays, including the not-well-known, obscure, and 305.Em really 306obscure. 307.It Pa calendar.judaic 308Jewish holidays. 309The entries for this calendar have been obtained from the 310deskutils/hebcal port. 311.It Pa calendar.music 312Musical events, births, and deaths. 313Strongly oriented toward rock 'n' roll. 314.It Pa calendar.newzealand 315Calendar of events in New Zealand. 316.It Pa calendar.russian 317Russian calendar. 318.It Pa calendar.southafrica 319Calendar of events in South Africa. 320.It Pa calendar.usholiday 321U.S.\& holidays. 322This calendar should be updated yearly by the local system administrator 323so that roving holidays are set correctly for the current year. 324.It Pa calendar.world 325Includes all calendar files except for national files. 326.El 327.Sh COMPATIBILITY 328The 329.Nm 330program previously selected lines which had the correct date anywhere 331in the line. 332This is no longer true, the date is only recognized when it occurs 333at the beginning of a line. 334.Sh SEE ALSO 335.Xr at 1 , 336.Xr mail 1 , 337.Xr cron 8 338.Sh HISTORY 339A 340.Nm 341command appeared in 342.At v7 . 343.Sh NOTES 344Chinese New Year is calculated at 120 degrees east of Greenwich, 345which roughly corresponds with the east coast of China. 346For people west of China, this might result that the start of Chinese 347New Year and the day of the related new moon might differ. 348.Pp 349The phases of the moon and the longitude of the sun are calculated 350against the local position which corresponds with 30 degrees times 351the time-difference towards Greenwich. 352.Pp 353The new and full moons are happening on the day indicated: They 354might happen in the time period in the early night or in the late 355evening. 356It does not indicate that they are starting in the night on that date. 357.Pp 358Because of minor differences between the output of the formulas 359used and other sources on the Internet, Druids and Werewolves should 360double-check the start and end time of solar and lunar events. 361.Sh BUGS 362The 363.Nm 364does only recognise the cpp directives #include, #define, #ifdef, 365#ifndef and #else. 366It supports nested conditions, but does not perform any validation 367on the correct use and nesting of conditions. 368#endif without prior #ifdef or #define is ignored and #else outside 369a conditional section skips input lines up to the next #endif. 370.Pp 371There is no possibility to properly specify the local position 372needed for solar and lunar calculations. 373