xref: /freebsd/usr.bin/ncal/ncal.1 (revision 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6)
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
82Turns off highlighting of today.
83.It Fl J
84Display Julian Calendar, if combined with the
85.Fl e
86option, display date of Easter according to the Julian Calendar.
87.It Fl e
88Display date of Easter (for western churches).
89.It Fl j
90Display Julian days (days one-based, numbered from January 1).
91.It Fl M
92Display Monday as the first day of the week in
93.Nm cal
94mode.
95.It Fl m Ar month
96Display the specified
97.Ar month .
98If
99.Ar month
100is specified as a decimal number, it may be followed by the letter
101.Ql f
102or
103.Ql p
104to indicate the following or preceding month of that number,
105respectively.
106.It Fl o
107Display date of Orthodox Easter (Greek and Russian
108Orthodox Churches).
109.It Fl p
110Print the country codes and switching days from Julian to Gregorian
111Calendar as they are assumed by
112.Nm ncal .
113The country code as determined from the local environment is marked
114with an asterisk.
115.It Fl s Ar country_code
116Assume the switch from Julian to Gregorian Calendar at the date
117associated with the
118.Ar country_code .
119If not specified,
120.Nm ncal
121tries to guess the switch date from the local environment or
122falls back to September 2, 1752.
123This was when Great
124Britain and her colonies switched to the Gregorian Calendar.
125.It Fl w
126Print the number of the week below each week column.
127.It Fl y
128Display a calendar for the specified year.
129.It Fl 3
130Display the previous, current and next month surrounding today.
131.It Fl A Ar number
132Display the
133.Ar number
134of months after the current month.
135.It Fl B Ar number
136Display the
137.Ar number
138of months before the current month.
139.It Fl C
140Switch to
141.Nm cal
142mode.
143.It Fl N
144Switch to
145.Nm ncal
146mode.
147.It Fl d Ar yyyy-mm
148Use
149.Ar yyyy-mm
150as the current date (for debugging of date selection).
151.It Fl H Ar yyyy-mm-dd
152Use
153.Ar yyyy-mm-dd
154as the current date (for debugging of highlighting).
155.El
156.Pp
157A single parameter specifies the year (1\(en9999) to be displayed;
158note the year must be fully specified:
159.Dq Li cal 89
160will
161.Em not
162display a calendar for 1989.
163Two parameters denote the month and
164year; the month is either a number between 1 and 12, or a full or
165abbreviated name as specified by the current locale.
166Month and
167year default to those of the current system clock and time zone (so
168.Dq Li cal -m 8
169will display a calendar for the month of August in the current
170year).
171.Pp
172Not all options can be used together.
173For example
174.Dq Li -3 -A 2 -B 3 -y -m 7
175would mean:
176show me the three months around the seventh month, three before
177that, two after that and the whole year.
178.Nm ncal
179will warn about these combinations.
180.Pp
181A year starts on January 1.
182.Pp
183Highlighting of dates is disabled if stdout is not a tty.
184.Sh SEE ALSO
185.Xr calendar 3 ,
186.Xr strftime 3
187.Sh STANDARDS
188The
189.Nm
190utility is compliant with the
191X/Open System Interfaces option of the
192.St -p1003.1-2008
193specification.
194.Pp
195The flags
196.Op Fl 3ehJMopwy ,
197as well as the ability to specify a month name as a single argument,
198are extensions to that specification.
199.Pp
200The week number computed by
201.Fl w
202is compliant with the
203.St -iso8601
204specification.
205.Sh HISTORY
206A
207.Nm
208command appeared in
209.At v1 .
210The
211.Nm ncal
212command appeared in
213.Fx 2.2.6 .
214.Sh AUTHORS
215The
216.Nm ncal
217command and manual were written by
218.An Wolfgang Helbig Aq Mt helbig@FreeBSD.org .
219.Sh BUGS
220The assignment of Julian\(enGregorian switching dates to country
221codes is historically naive for many countries.
222.Pp
223Not all options are compatible and using them in different orders
224will give varying results.
225