Debian Codegraph @

upstream/opensuse-tumbleweed/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 " [" -acefilosw "] [" -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..SS Options
63 The options are as follows:
64 .TP
65 .B -a
66 Choose from all lists of maxims, both offensive and not. (See the
67 .B -o
68 option for more information on offensive fortunes.)
69 .TP
70 .B -c
71 Show the cookie file from which the fortune came.
72 .TP
73 .B -e
74 Consider all fortune files to be of equal size (see discussion below
75 on multiple files).
76 .TP
77 .B -f
78 Print out the list of files which would be searched, but don't
79 print a fortune.
80 .TP
81 .B -l
82 Long dictums only. See
83 .B -n
84 on how ``long'' is defined in this sense.
85 .TP
86 .BI "-m " pattern
87 Print out all fortunes which match the basic regular expression
88 .IR pattern .
89 The syntax of these expressions depends on how your system defines
90 .BR re_comp "(3) or " regcomp (3),
91 but it should nevertheless be similar to the syntax used in
92 .BR grep (1).
93 .sp
94 .RS
95 The fortunes are output to standard output, while the names of the file
96 from which each fortune comes are printed to standard error. Either or
97 both can be redirected; if standard output is redirected to a file, the
98 result is a valid fortunes database file. If standard error is
99 .I also
100 redirected to this file, the result is
101 .IR "still valid" ,
102 .B but there will be ``bogus''
103 .BR fortunes ,
104 i.e. the filenames themselves, in parentheses. This can be useful if you
105 wish to remove the gathered matches from their original files, since each
106 filename\-record will precede the records from the file it names.
107 .RE
108 .TP
109 .BI "-n " length
110 Set the longest fortune length (in characters) considered to be
111 ``short'' (the default is 160). All fortunes longer than this are
112 considered ``long''. Be careful! If you set the length too short and
113 ask for short fortunes, or too long and ask for long ones, fortune goes
114 into a never\-ending thrash loop.
115 .TP
116 .B -o
117 Choose only from potentially offensive aphorisms. The -o option is
118 ignored if a fortune directory is specified.
119 .sp
120 .B Please, please, please request a potentially
121 .B offensive fortune if and only if
122 .B you believe, deep in your heart,
123 .B that you are willing to be
124 .B offended. (And that you'll just quit
125 .BR using " -o " rather
126 .B than give us grief about it,
127 .B okay?)
128 .sp
129 .RS
130 \&... let us keep in mind the basic governing philosophy of The
131 Brotherhood, as handsomely summarized in these words: we believe in
132 healthy, hearty laughter \-\- at the expense of the whole human race, if
133 needs be. Needs be.
134 .RS
135 \-\-H. Allen Smith, "Rude Jokes"
136 .RE
137 .RE
138 .TP
139 .B -s
140 Short apothegms only. See
141 .B -n
142 on which fortunes are considered ``short''.
143 .TP
144 .B -i
145 Ignore case for
146 .IR -m
147 patterns.
148 .TP
149 .B -w
150 Wait before termination for an amount of time calculated from the
151 number of characters in the message. This is useful if it is executed
152 as part of the logout procedure to guarantee that the message can be
153 read before the screen is cleared.
154 .PP
155 The user may specify alternate sayings. You can specify a specific
156 file, a directory which contains one or more files, or the special word
157 .I all
158 which says to use all the standard databases. Any of these may be
159 preceded by a percentage, which is a number
160 .I n
161 between 0 and 100 inclusive, followed by a
162 .IR % .
163 If it is, there will be a
164 .I n
165 percent probability that an adage will be picked from that file or
166 directory. If the percentages do not sum to 100, and there are
167 specifications without percentages, the remaining percent will apply
168 to those files and/or directories, in which case the probability of
169 selecting from one of them will be based on their relative sizes.
170 .PP
171 As an example, given two databases
172 .IR funny " and " not\-funny ", with " funny
173 twice as big (in number of fortunes, not raw file size), saying
174 .RS
175 .sp
176 .B fortune
177 .I funny not\-funny
178 .sp
179 .RE
180 will get you fortunes out of
181 .I funny
182 two\-thirds of the time. The command
183 .RS
184 .sp
185 .B fortune
186 .RI "90% " funny " 10% " not\-funny
187 .sp
188 .RE
189 will pick out 90% of its fortunes from
190 .I funny
191 (the ``10% not\-funny'' is unnecessary, since 10% is all that's left).
192 .PP
193 The
194 .B -e
195 option says to consider all files equal; thus
196 .RS
197 .sp
198 .B fortune -e
199 .I funny not\-funny
200 .sp
201 .RE
202 is equivalent to
203 .RS
204 .sp
205 .B fortune
206 .RI "50% " funny " 50% " not\-funny
207 .sp
208 .RE
209 This fortune also supports the BSD method of appending ``-o'' to
210 database names to specify offensive fortunes. However this is
211 .B not
212 how fortune stores them: offensive fortunes are stored in a separate
213 directory without the ``-o'' infix. A plain name (i.e., not a path to a
214 file or directory) that ends in ``-o'' will be assumed to be an
215 offensive database, and will have its suffix stripped off and be
216 searched in the offensive directory (even if the neither of the
217 .IR -a " or " -o
218 options were specified). This feature is not only for
219 backwards\-compatibility, but also to allow users to distinguish between
220 inoffensive and offensive databases of the same name.
221 .PP
222 For example, assuming there is a database named
223 .I definitions
224 in both the inoffensive and potentially offensive collections, then the
225 following command will select an inoffensive definition 90% of the time,
226 and a potentially offensive definition for the remaining 10%:
227 .RS
228 .sp
229 .B fortune
230 90%
231 .I definitions definitions\-o
232 .RE
233 .SH FILES
234 Note: these are the defaults as defined at compile time.
235 .PP
236 .PD 0
237 .TP
238 .I /usr/share/fortune/cookies
239 Directory for innoffensive fortunes.
240 .TP
241 .I /usr/share/fortune/cookies/off
242 Directory for offensive fortunes.
243 .PD
244 .PP
245 If a particular set of fortunes is particularly unwanted, there is an
246 easy solution: delete the associated
247 .I .dat
248 file. This leaves the data intact, should the file later be wanted, but
249 since
250 .B fortune
251 no longer finds the pointers file, it ignores the text file.
252 .SH BUGS
253 The division of fortunes into offensive and non\-offensive by directory,
254 rather than via the `-o' file infix, is not 100% compatible with
255 original BSD fortune. Although the `-o' infix is recognised as referring
256 to an offensive database, the offensive database files still need to be
257 in a separate directory. The workaround, of course, is to move the `-o'
258 files into the offensive directory (with or without renaming), and to
259 use the
260 .B -a
261 option.
262 .PP
263 The supplied fortune databases have been attacked, in order to correct
264 orthographical and grammatical errors, and particularly to reduce
265 redundancy and repetition and redundancy. But especially to avoid
266 repetitiousness. This has not been a complete success. In the process,
267 some fortunes may also have been lost.
268 .PP
269 The fortune databases are now divided into a larger number of smaller
270 files, some organized by format (poetry, definitions), and some by
271 content (religion, politics). There are parallel files in the main
272 directory and in the offensive files directory (e.g., fortunes/definitions and
273 fortunes/off/definitions). Not all the potentially offensive fortunes are in
274 the offensive fortunes files, nor are all the fortunes in the offensive
275 files potentially offensive, probably, though a strong attempt has been
276 made to achieve greater consistency. Also, a better division might be
277 made.
278 .SH HISTORY
279 This version of fortune is based on the NetBSD fortune 1.4, but with a
280 number of bug fixes and enhancements.
281 .PP
282 The original fortune/strfile format used a single file; strfile read the
283 text file and converted it to null\-delimited strings, which were stored
284 after the table of pointers in the .dat file. By NetBSD fortune 1.4,
285 this had changed to two separate files: the .dat file was only the header
286 (the table of pointers, plus flags; see
287 .IR strfile.h ),
288 and the text strings were left in their own file. The potential problem
289 with this is that text file and header file may get out of synch, but the
290 advantage is that the text files can be easily edited without resorting
291 to unstr, and there is a potential savings in disk space (on the
292 assumption that the sysadmin kept both .dat file with strings and the
293 text file).
294 .PP
295 Many of the enhancements made over the NetBSD version assumed a Linux
296 system, and thus caused it to fail under other platforms, including BSD.
297 The source code has since been made more generic, and currently works on
298 SunOS 4.x as well as Linux, with support for more platforms expected in
299 the future. Note that some bugs were inadvertently discovered and fixed
300 during this process.
301 .PP
302 At a guess, a great many people have worked on this program, many without
303 leaving attributions.
304 .SH SEE ALSO
305 .BR re_comp "(3), " regcomp "(3), " strfile "(1), "
306 .BR unstr (1)