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