Debian Codegraph @

upstream/debian-unstable/man6/fortune.6

raw
1 .\" $NetBSD: fortune.6,v 1.4 1995/03/23 08:28:37 cgd Exp $
2 .\"
3 .\" Copyright (c) 1985, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Ken Arnold.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. All advertising materials mentioning features or use of this software
18 .\" must display the following acknowledgement:
19 .\" This product includes software developed by the University of
20 .\" California, Berkeley and its contributors.
21 .\" 4. Neither the name of the University nor the names of its contributors
22 .\" may be used to endorse or promote products derived from this software
23 .\" without specific prior written permission.
24 .\"
25 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" SUCH DAMAGE.
36 .\"
37 .\" @(#)fortune.6 8.3 (Berkeley) 4/19/94
38 .\"
39 .\" This version of the man page has been modified heavily, like the
40 .\" program it documents. Some of the changes may be exclusive to
41 .\" Linux. Amy A. Lewis, September, 1995.
42 .\"
43 .\" Changes Copyright (c) 1997 Dennis L. Clark. All rights reserved.
44 .\"
45 .\" The changes in this file may be freely redistributed, modified or
46 .\" included in other software, as long as both the above copyright
47 .\" notice and these conditions appear intact.
48 .\"
49 .TH FORTUNE 6 "19 April 94 [May. 97]" "BSD Experimental" "UNIX Reference Manual"
50 .SH NAME
51 fortune \- print a random, hopefully interesting, adage
52 .SH SYNOPSIS
53 .BR fortune " [" \-acefilosuw "] [" \-n
54 .IR length "] ["
55 .B \-m
56 .IR pattern "] [[" n% "] " file/dir/all ]
57 .SH DESCRIPTION
58 When
59 .B fortune
60 is run with no arguments it prints out a random epigram. Epigrams are
61 divided into several categories, where each category is sub\-divided
62 into those which are potentially offensive and those which are not.
63 .SS Options
64 The options are as follows:
65 .TP
66 .B \-a
67 Choose from all lists of maxims, both offensive and not. (See the
68 .B \-o
69 option for more information on offensive fortunes.)
70 .TP
71 .B \-c
72 Show the cookie file from which the fortune came.
73 .TP
74 .B \-e
75 Consider all fortune files to be of equal size (see discussion below
76 on multiple files).
77 .TP
78 .B \-f
79 Print out the list of files which would be searched, but don't
80 print a fortune.
81 .TP
82 .B \-l
83 Long dictums only. See
84 .B \-n
85 on how ``long'' is defined in this sense.
86 .TP
87 .BI "\-m " pattern
88 Print out all fortunes which match the basic regular expression
89 .IR pattern .
90 The syntax of these expressions depends on how your system defines
91 .BR re_comp "(3) or " regcomp (3),
92 but it should nevertheless be similar to the syntax used in
93 .BR grep (1).
94 .sp
95 .RS
96 The fortunes are output to standard output, while the names of the file
97 from which each fortune comes are printed to standard error. Either or
98 both can be redirected; if standard output is redirected to a file, the
99 result is a valid fortunes database file. If standard error is
100 .I also
101 redirected to this file, the result is
102 .IR "still valid" ,
103 .B but there will be ``bogus''
104 .BR fortunes ,
105 i.e. the filenames themselves, in parentheses. This can be useful if you
106 wish to remove the gathered matches from their original files, since each
107 filename\-record will precede the records from the file it names.
108 .RE
109 .TP
110 .BI "\-n " length
111 Set the longest fortune length (in characters) considered to be
112 ``short'' (the default is 160). All fortunes longer than this are
113 considered ``long''. Be careful! If you set the length too short and
114 ask for short fortunes, or too long and ask for long ones, fortune goes
115 into a never\-ending thrash loop.
116 .TP
117 .B \-o
118 Choose only from potentially offensive aphorisms. The \-o option is
119 ignored if a fortune directory is specified.
120 .sp
121 .B Please, please, please request a potentially
122 .B offensive fortune if and only if
123 .B you believe, deep in your heart,
124 .B that you are willing to be
125 .B offended. (And that you'll just quit
126 .BR using " \-o " rather
127 .B than give us grief about it,
128 .B okay?)
129 .sp
130 .RS
131 \&... let us keep in mind the basic governing philosophy of The
132 Brotherhood, as handsomely summarized in these words: we believe in
133 healthy, hearty laughter \-\- at the expense of the whole human race, if
134 needs be. Needs be.
135 .RS
136 \-\-H. Allen Smith, "Rude Jokes"
137 .RE
138 .RE
139 .TP
140 .B \-s
141 Short apothegms only. See
142 .B \-n
143 on which fortunes are considered ``short''.
144 .TP
145 .B \-i
146 Ignore case for
147 .IR \-m
148 patterns.
149 .TP
150 .B \-w
151 Wait before termination for an amount of time calculated from the
152 number of characters in the message. This is useful if it is executed
153 as part of the logout procedure to guarantee that the message can be
154 read before the screen is cleared.
155 .TP
156 .B \-u
157 Don't translate UTF\-8 fortunes to the locale when searching or translating.
158 .PP
159 The user may specify alternate sayings. You can specify a specific
160 file, a directory which contains one or more files, or the special word
161 .I all
162 which says to use all the standard databases. Any of these may be
163 preceded by a percentage, which is a number
164 .I n
165 between 0 and 100 inclusive, followed by a
166 .IR % .
167 If it is, there will be a
168 .I n
169 percent probability that an adage will be picked from that file or
170 directory. If the percentages do not sum to 100, and there are
171 specifications without percentages, the remaining percent will apply
172 to those files and/or directories, in which case the probability of
173 selecting from one of them will be based on their relative sizes.
174 .PP
175 As an example, given two databases
176 .IR funny " and " not\-funny ", with " funny
177 twice as big (in number of fortunes, not raw file size), saying
178 .RS
179 .sp
180 .B fortune
181 .I funny not\-funny
182 .sp
183 .RE
184 will get you fortunes out of
185 .I funny
186 two\-thirds of the time. The command
187 .RS
188 .sp
189 .B fortune
190 .RI "90% " funny " 10% " not\-funny
191 .sp
192 .RE
193 will pick out 90% of its fortunes from
194 .I funny
195 (the ``10% not\-funny'' is unnecessary, since 10% is all that's left).
196 .PP
197 The
198 .B \-e
199 option says to consider all files equal; thus
200 .RS
201 .sp
202 .B fortune \-e
203 .I funny not\-funny
204 .sp
205 .RE
206 is equivalent to
207 .RS
208 .sp
209 .B fortune
210 .RI "50% " funny " 50% " not\-funny
211 .sp
212 .RE
213 .SH FILES
214 Note: these are the defaults as defined at compile time.
215 .PP
216 .PD 0
217 .TP
218 .I /usr/share/games/fortunes
219 Directory for innoffensive fortunes.
220 .TP
221 .I /usr/share/games/fortunes/off
222 Directory for offensive fortunes.
223 .PD
224 .PP
225 If a particular set of fortunes is particularly unwanted, there is an
226 easy solution: delete the associated
227 .I .dat
228 file. This leaves the data intact, should the file later be wanted, but
229 since
230 .B fortune
231 no longer finds the pointers file, it ignores the text file.
232 .SH BUGS
233 The supplied fortune databases have been attacked, in order to correct
234 orthographical and grammatical errors, and particularly to reduce
235 redundancy and repetition and redundancy. But especially to avoid
236 repetitiousness. This has not been a complete success. In the process,
237 some fortunes may also have been lost.
238 .PP
239 The fortune databases are now divided into a larger number of smaller
240 files, some organized by format (poetry, definitions), and some by
241 content (religion, politics). There are parallel files in the main
242 directory and in the offensive files directory (e.g., fortunes/definitions and
243 fortunes/off/definitions). Not all the potentially offensive fortunes are in
244 the offensive fortunes files, nor are all the fortunes in the offensive
245 files potentially offensive, probably, though a strong attempt has been
246 made to achieve greater consistency. Also, a better division might be
247 made.
248 .PP
249 When passing files to fortune, directories must be specified by absolute
250 pathnames, and filenames starting with a dot are ignored. See:
251 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=241888
252 .SH HISTORY
253 This version of fortune is based on the NetBSD fortune 1.4, but with a
254 number of bug fixes and enhancements.
255 .PP
256 The original fortune/strfile format used a single file; strfile read the
257 text file and converted it to null\-delimited strings, which were stored
258 after the table of pointers in the .dat file. By NetBSD fortune 1.4,
259 this had changed to two separate files: the .dat file was only the header
260 (the table of pointers, plus flags; see
261 .IR strfile.h ),
262 and the text strings were left in their own file. The potential problem
263 with this is that text file and header file may get out of synch, but the
264 advantage is that the text files can be easily edited without resorting
265 to unstr, and there is a potential savings in disk space (on the
266 assumption that the sysadmin kept both .dat file with strings and the
267 text file).
268 .PP
269 Many of the enhancements made over the NetBSD version assumed a Linux
270 system, and thus caused it to fail under other platforms, including BSD.
271 The source code has since been made more generic, and currently works on
272 SunOS 4.x as well as Linux, with support for more platforms expected in
273 the future. Note that some bugs were inadvertently discovered and fixed
274 during this process.
275 .PP
276 At a guess, a great many people have worked on this program, many without
277 leaving attributions.
278 .SH SEE ALSO
279 .BR re_comp "(3), " regcomp "(3), " strfile "(1), "
280 .BR unstr (1)