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