xref: /freebsd/usr.bin/ncal/ncal.1 (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1.\"-
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 1997 Wolfgang Helbig
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 March 7, 2019
29.Dt CAL 1
30.Os
31.Sh NAME
32.Nm cal ,
33.Nm ncal
34.Nd displays a calendar and the date of Easter
35.Sh SYNOPSIS
36.Nm
37.Op Fl 3hjMy
38.Op Fl A Ar number
39.Op Fl B Ar number
40.Oo
41.Op Ar month
42.Ar year
43.Oc
44.Nm
45.Op Fl 3hjM
46.Op Fl A Ar number
47.Op Fl B Ar number
48.Fl m Ar month
49.Op Ar year
50.Nm ncal
51.Op Fl 3hjJpwy
52.Op Fl A Ar number
53.Op Fl B Ar number
54.Op Fl s Ar country_code
55.Oo
56.Op Ar month
57.Ar year
58.Oc
59.Nm ncal
60.Op Fl 3hJeo
61.Op Fl A Ar number
62.Op Fl B Ar number
63.Op Ar year
64.Nm ncal
65.Op Fl CN
66.Op Fl H Ar yyyy-mm-dd
67.Op Fl d Ar yyyy-mm
68.Sh DESCRIPTION
69The
70.Nm
71utility displays a simple calendar in traditional format and
72.Nm ncal
73offers an alternative layout, more options and the date of Easter.
74The new format is a little cramped but it makes a year fit
75on a 25x80 terminal.
76If arguments are not specified,
77the current month is displayed.
78.Pp
79The options are as follows:
80.Bl -tag -width indent
81.It Fl h
82Toggle highlighting of today.
83By default highlighting is enabled if stdout is a TTY.
84.It Fl J
85Display Julian Calendar, if combined with the
86.Fl e
87option, display date of Easter according to the Julian Calendar.
88.It Fl e
89Display date of Easter (for western churches).
90.It Fl j
91Display Julian days (days one-based, numbered from January 1).
92.It Fl M
93Display Monday as the first day of the week in
94.Nm cal
95mode.
96.It Fl m Ar month
97Display the specified
98.Ar month .
99If
100.Ar month
101is specified as a decimal number, it may be followed by the letter
102.Ql f
103or
104.Ql p
105to indicate the following or preceding month of that number,
106respectively.
107.It Fl o
108Display date of Orthodox Easter (Greek and Russian
109Orthodox Churches).
110.It Fl p
111Print the country codes and switching days from Julian to Gregorian
112Calendar as they are assumed by
113.Nm ncal .
114The country code as determined from the local environment is marked
115with an asterisk.
116.It Fl s Ar country_code
117Assume the switch from Julian to Gregorian Calendar at the date
118associated with the
119.Ar country_code .
120If not specified,
121.Nm ncal
122tries to guess the switch date from the local environment or
123falls back to September 2, 1752.
124This was when Great
125Britain and her colonies switched to the Gregorian Calendar.
126.It Fl w
127Print the number of the week below each week column.
128.It Fl y
129Display a calendar for the specified year.
130.It Fl 3
131Display the previous, current and next month surrounding today.
132.It Fl A Ar number
133Display the
134.Ar number
135of months after the current month.
136.It Fl B Ar number
137Display the
138.Ar number
139of months before the current month.
140.It Fl C
141Switch to
142.Nm cal
143mode.
144.It Fl N
145Switch to
146.Nm ncal
147mode.
148.It Fl d Ar yyyy-mm
149Use
150.Ar yyyy-mm
151as the current date (for debugging of date selection).
152.It Fl H Ar yyyy-mm-dd
153Use
154.Ar yyyy-mm-dd
155as the current date (for debugging of highlighting).
156.El
157.Pp
158A single parameter specifies the year (1\(en9999) to be displayed;
159note the year must be fully specified:
160.Dq Li cal 89
161will
162.Em not
163display a calendar for 1989.
164Two parameters denote the month and
165year; the month is either a number between 1 and 12, or a full or
166abbreviated name as specified by the current locale.
167Month and
168year default to those of the current system clock and time zone (so
169.Dq Li cal -m 8
170will display a calendar for the month of August in the current
171year).
172.Pp
173Not all options can be used together.
174For example
175.Dq Li -3 -A 2 -B 3 -y -m 7
176would mean:
177show me the three months around the seventh month, three before
178that, two after that and the whole year.
179.Nm ncal
180will warn about these combinations.
181.Pp
182A year starts on January 1.
183.Pp
184Highlighting of dates is disabled if stdout is not a tty.
185.Sh SEE ALSO
186.Xr calendar 3 ,
187.Xr strftime 3
188.Sh STANDARDS
189The
190.Nm
191utility is compliant with the
192X/Open System Interfaces option of the
193.St -p1003.1-2008
194specification.
195.Pp
196The flags
197.Op Fl 3ehJMopwy ,
198as well as the ability to specify a month name as a single argument,
199are extensions to that specification.
200.Pp
201The week number computed by
202.Fl w
203is compliant with the
204.St -iso8601
205specification.
206.Sh HISTORY
207A
208.Nm
209command appeared in
210.At v1 .
211The
212.Nm ncal
213command appeared in
214.Fx 2.2.6 .
215.Sh AUTHORS
216The
217.Nm ncal
218command and manual were written by
219.An Wolfgang Helbig Aq Mt helbig@FreeBSD.org .
220.Sh BUGS
221The assignment of Julian\(enGregorian switching dates to country
222codes is historically naive for many countries.
223.Pp
224Not all options are compatible and using them in different orders
225will give varying results.
226