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