xref: /freebsd/usr.bin/fortune/fortune/fortune.6 (revision d6b92ffa)
1.\" Copyright (c) 1985, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Ken Arnold.
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.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)fortune.6	8.3 (Berkeley) 4/19/94
32.\" $FreeBSD$
33.\"
34.Dd November 7, 2007
35.Dt FORTUNE 6
36.Os
37.Sh NAME
38.Nm fortune
39.Nd "print a random, hopefully interesting, adage"
40.Sh SYNOPSIS
41.Nm
42.Op Fl aDefilosw
43.Op Fl m Ar pattern
44.Oo
45.Op Ar \&N%
46.Ar file Ns / Ns Ar directory Ns / Ns Cm all
47.Oc
48.Sh DESCRIPTION
49When
50.Nm
51is run with no arguments it prints out a random epigram.
52Epigrams are divided into several categories, where each category
53is subdivided into those which are potentially offensive and those
54which are not.
55The options are as follows:
56.Bl -tag -width indent
57.It Fl a
58Choose from all lists of maxims, both offensive and not.
59(See the
60.Fl o
61option for more information on offensive fortunes.)
62.It Fl D
63Enable additional debugging output.
64Specify this option multiple times for more verbose output.
65Only available if compiled with
66.Li -DDEBUG .
67.It Fl e
68Consider all fortune files to be of equal size (see discussion below
69on multiple files).
70.It Fl f
71Print out the list of files which would be searched, but do not
72print a fortune.
73.It Fl l
74Long dictums only.
75.It Fl m Ar pattern
76Print out all fortunes which match the regular expression
77.Ar pattern .
78See
79.Xr regex 3
80for a description of patterns.
81.It Fl o
82Choose only from potentially offensive aphorisms.
83.Bf -symbolic
84Please, please, please request a potentially offensive fortune if and
85only if you believe, deep down in your heart, that you are willing
86to be offended.
87(And that if you are not willing, you will just quit using
88.Fl o
89rather than give us
90grief about it, okay?)
91.Ef
92.Bd -unfilled -offset indent
93\&... let us keep in mind the basic governing philosophy
94of The Brotherhood, as handsomely summarized in these words:
95we believe in healthy, hearty laughter -- at the expense of
96the whole human race, if needs be.
97Needs be.
98                           --H. Allen Smith, "Rude Jokes"
99.Ed
100.It Fl s
101Short apothegms only.
102.It Fl i
103Ignore case for
104.Fl m
105patterns.
106.It Fl w
107Wait before termination for an amount of time calculated from the
108number of characters in the message.
109This is useful if it is executed as part of the logout procedure
110to guarantee that the message can be read before the screen is cleared.
111.El
112.Pp
113The user may specify alternate sayings.
114You can specify a specific file, a directory which contains one or
115more files, or the special word
116.Cm all
117which says to use all the standard databases.
118Any of these may be preceded by a percentage, which is a number
119.Ar N
120between 0 and 100 inclusive, followed by a
121.Ql % .
122If it is, there will be an
123.Ar N
124percent probability that an adage will be picked from that file
125or directory.
126If the percentages do not sum to 100, and there are specifications
127without percentages, the remaining percent will apply to those files
128and/or directories, in which case the probability of selecting from
129one of them will be based on their relative sizes.
130.Pp
131As an example, given two databases
132.Pa funny
133and
134.Pa not-funny ,
135with
136.Pa funny
137twice as big, saying
138.Pp
139.Dl "fortune funny not-funny"
140.Pp
141will get you fortunes out of
142.Pa funny
143two-thirds of the time.
144The command
145.Pp
146.Dl "fortune 90% funny 10% not-funny"
147.Pp
148will pick out 90% of its fortunes from
149.Pa funny
150(the
151.Dq Li "10% not-funny"
152is unnecessary, since 10% is all that is left).
153The
154.Fl e
155option says to consider all files equal;
156thus
157.Pp
158.Dl "fortune -e funny not-funny"
159.Pp
160is equivalent to
161.Pp
162.Dl "fortune 50% funny 50% not-funny"
163.Sh ENVIRONMENT
164.Bl -tag -width ".Ev FORTUNE_PATH"
165.It Ev FORTUNE_PATH
166The search path for the data files.
167It is a colon-separated list of directories in which
168.Nm
169looks for data files.
170If not set it will default to
171.Pa /usr/share/games/fortune .
172If none of the directories specified exist, it will print a warning and exit.
173.It Ev FORTUNE_SAVESTATE
174If set, fortune will save some state about what fortune
175it was up to on disk.
176.El
177.Sh FILES
178.Bl -tag -width ".Pa /usr/share/games/fortune/*"
179.It Pa /usr/share/games/fortune/*
180the fortunes databases (those files ending
181.Dq Pa -o
182contain the
183.Sy offensive
184fortunes)
185.El
186.Sh SEE ALSO
187.Xr arc4random_uniform 3 ,
188.Xr regcomp 3 ,
189.Xr regex 3 ,
190.Xr strfile 8
191