Debian Codegraph @

upstream/mageia-cauldron/man6/fortune.6

raw
1 '\" t
2 .\" Title: FORTUNE
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 19 April 94 [May. 97]
6 .\" Manual: UNIX Reference Manual
7 .\" Source: BSD Experimental
8 .\" Language: English
9 .\"
10 .TH "FORTUNE" "6" "19 April 94 [May\&. 97]" "BSD Experimental" "UNIX Reference Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30
31 .SH "NAME"
32 fortune \- print a random, hopefully interesting, adage
33
34 .SH "SYNOPSIS"
35 .HP \w'\fBfortune\fR\ 'u
36
37 \fBfortune\fR [\-acefilosw]
38 [\-n\ \fIlength\fR]
39 [\-m\ \fIpattern\fR]
40 [[\fIn%\fR]\ \fIfile/dir/all\fR]
41
42 .SH "DESCRIPTION"
43 .PP
44 When
45 \fBfortune\fR
46 is run with no arguments it prints out a random epigram\&. Epigrams are divided into several categories, where each category is sub\-divided into those which are potentially offensive and those which are not\&.
47
48 .SS "Options"
49 .PP
50 The options are as follows:
51
52 .PP
53 \fB\-a\fR
54 .RS 4
55
56 Choose from all lists of maxims, both offensive and not\&. (See the
57 \fB\-o\fR
58 option for more information on offensive fortunes\&.)
59
60 .RE
61 .PP
62 \fB\-c\fR
63 .RS 4
64
65 Show the cookie file from which the fortune came\&.
66
67 .RE
68 .PP
69 \fB\-e\fR
70 .RS 4
71
72 Consider all fortune files to be of equal size (see discussion below on multiple files)\&.
73
74 .RE
75 .PP
76 \fB\-f\fR
77 .RS 4
78
79 Print out the list of files which would be searched, but don\*(Aqt print a fortune\&.
80
81 .RE
82 .PP
83 \fB\-l\fR
84 .RS 4
85
86 Long dictums only\&. See
87 \fB\-n\fR
88 on how \(lqlong\(rq is defined in this sense\&.
89
90 .RE
91 .PP
92 \fB\-m \fR\fIpattern\fR
93 .RS 4
94
95 Print out all fortunes which match the basic regular expression
96 \fIpattern\fR\&. The syntax of these expressions depends on how your system defines
97 \fBre_comp\fR(3)
98 or
99 \fBregcomp\fR(3), but it should nevertheless be similar to the syntax used in
100 \fBgrep\fR(1)\&.
101
102 The fortunes are output to standard output, while the names of the file from which each fortune comes are printed to standard error\&. Either or both can be redirected; if standard output is redirected to a file, the result is a valid fortunes database file\&. If standard error is
103 \fIalso\fR
104 redirected to this file, the result is
105 \fIstill valid\fR,
106 \fBbut there will be \(lqbogus\(rq\fR
107 \fBfortunes\fR, i\&.e\&. the filenames themselves, in parentheses\&. This can be useful if you wish to remove the gathered matches from their original files, since each filename\-record will precede the records from the file it names\&.
108
109 .RE
110 .PP
111 \fB\-n \fR\fIlength\fR
112 .RS 4
113
114 Set the longest fortune length (in characters) considered to be \(lqshort\(rq (the default is 160)\&. All fortunes longer than this are considered \(lqlong\(rq\&. Be careful! If you set the length too short and ask for short fortunes, or too long and ask for long ones, fortune goes into a never\-ending thrash loop\&.
115
116 .RE
117
118 .PP
119 \fB\-o\fR Choose only from potentially offensive aphorisms\&. The \-o option is ignored if a fortune directory is specified\&.
120 .RS 4
121
122 \fBPlease, please, please request a potentially\fR
123 \fBoffensive fortune if and only if\fR
124 \fByou believe, deep in your heart,\fR
125 \fBthat you are willing to be\fR
126 \fBoffended\&. (And that you\*(Aqll just quit\fR
127 \fBusing\fR
128 \-o
129 \fBrather\fR
130 \fBthan give us grief about it,\fR
131 \fBokay?)\fR
132
133 \&.\&.\&. let us keep in mind the basic governing philosophy of The Brotherhood, as handsomely summarized in these words: we believe in healthy, hearty laughter \-\- at the expense of the whole human race, if needs be\&. Needs be\&.
134
135 \-\-H\&. Allen Smith, "Rude Jokes"
136
137 .RE
138
139 .PP
140 \fB\-s\fR
141 .RS 4
142
143 Short apothegms only\&. See
144 \fB\-n\fR
145 on which fortunes are considered \(lqshort\(rq\&.
146
147 .RE
148 .PP
149 \fB\-i\fR
150 .RS 4
151
152 Ignore case for
153 \fB\-m\fR
154 patterns\&.
155
156 .RE
157 .PP
158 \fB\-w\fR
159 .RS 4
160
161 Wait before termination for an amount of time calculated from the number of characters in the message\&. This is useful if it is executed as part of the logout procedure to guarantee that the message can be read before the screen is cleared\&.
162
163 .RE
164
165 .PP
166 The user may specify alternate sayings\&. You can specify a specific file, a directory which contains one or more files, or the special word
167 \fIall\fR
168 which says to use all the standard databases\&. Any of these may be preceded by a percentage, which is a number
169 \fIn\fR
170 between 0 and 100 inclusive, followed by a
171 \fI%\fR\&. If it is, there will be a
172 \fIn\fR
173 percent probability that an adage will be picked from that file or directory\&. If the percentages do not sum to 100, and there are specifications without percentages, the remaining percent will apply to those files and/or directories, in which case the probability of selecting from one of them will be based on their relative sizes\&.
174
175 .PP
176 As an example, given two databases
177 \fIfunny\fR
178 and
179 \fInot\-funny\fR, with
180 \fIfunny\fR
181 twice as big (in number of fortunes, not raw file size), saying
182
183 .PP
184 \fBfortune\fR
185 \fIfunny not\-funny\fR
186
187 .PP
188 will get you fortunes out of
189 \fIfunny\fR
190 two\-thirds of the time\&. The command
191
192 .PP
193 \fBfortune\fR
194 90%
195 \fIfunny\fR
196 10%
197 \fInot\-funny\fR
198
199 .PP
200 will pick out 90% of its fortunes from
201 \fIfunny\fR
202 (the \(lq10% not\-funny\(rq is unnecessary, since 10% is all that\*(Aqs left)\&.
203
204 .PP
205 The
206 \fB\-e\fR
207 option says to consider all files equal; thus
208
209 .PP
210 \fBfortune \-e\fR
211 \fIfunny not\-funny\fR
212
213 .PP
214 is equivalent to
215
216 .PP
217 \fBfortune\fR
218 50%
219 \fIfunny\fR
220 50%
221 \fInot\-funny\fR
222
223 .PP
224 This fortune also supports the BSD method of appending \(lq\-o\(rq to database names to specify offensive fortunes\&. However this is
225 \fBnot\fR
226 how fortune stores them: offensive fortunes are stored in a separate directory without the \(lq\-o\(rq infix\&. A plain name (i\&.e\&., not a path to a file or directory) that ends in \(lq\-o\(rq will be assumed to be an offensive database, and will have its suffix stripped off and be searched in the offensive directory (even if the neither of the
227 \fB\-a\fR
228 or
229 \fB\-o\fR
230 options were specified)\&. This feature is not only for backwards\-compatibility, but also to allow users to distinguish between inoffensive and offensive databases of the same name\&.
231
232 .PP
233 For example, assuming there is a database named
234 \fIdefinitions\fR
235 in both the inoffensive and potentially offensive collections, then the following command will select an inoffensive definition 90% of the time, and a potentially offensive definition for the remaining 10%:
236
237 .PP
238 \fBfortune\fR
239 90%
240 \fIdefinitions definitions\-o\fR
241
242 .SH "FILES"
243 .PP
244 Note: these are the defaults as defined at compile time\&.
245
246 .PP
247 \fI/usr/share/games/fortunes\fR
248 Directory for innoffensive fortunes\&.
249
250 .PP
251 \fI/usr/share/games/fortunes/off\fR
252 Directory for offensive fortunes\&.
253
254 .PP
255 If a particular set of fortunes is particularly unwanted, there is an easy solution: delete the associated
256 \fB\&.dat\fR
257 file\&. This leaves the data intact, should the file later be wanted, but since
258 \fBfortune\fR
259 no longer finds the pointers file, it ignores the text file\&.
260
261 .SH "BUGS"
262 .PP
263 The division of fortunes into offensive and non\-offensive by directory, rather than via the `\-o\*(Aq file infix, is not 100% compatible with original BSD fortune\&. Although the `\-o\*(Aq infix is recognised as referring to an offensive database, the offensive database files still need to be in a separate directory\&. The workaround, of course, is to move the `\-o\*(Aq files into the offensive directory (with or without renaming), and to use the
264 \fB\-a\fR
265 option\&.
266
267 .PP
268 The supplied fortune databases have been attacked, in order to correct orthographical and grammatical errors, and particularly to reduce redundancy and repetition and redundancy\&. But especially to avoid repetitiousness\&. This has not been a complete success\&. In the process, some fortunes may also have been lost\&.
269
270 .PP
271 The fortune databases are now divided into a larger number of smaller files, some organized by format (poetry, definitions), and some by content (religion, politics)\&. There are parallel files in the main directory and in the offensive files directory (e\&.g\&., fortunes/definitions and fortunes/off/definitions)\&. Not all the potentially offensive fortunes are in the offensive fortunes files, nor are all the fortunes in the offensive files potentially offensive, probably, though a strong attempt has been made to achieve greater consistency\&. Also, a better division might be made\&.
272
273 .SH "HISTORY"
274 .PP
275 This version of fortune is based on the NetBSD fortune 1\&.4, but with a number of bug fixes and enhancements\&.
276
277 .PP
278 The original fortune/strfile format used a single file; strfile read the text file and converted it to null\-delimited strings, which were stored after the table of pointers in the \&.dat file\&. By NetBSD fortune 1\&.4, this had changed to two separate files: the \&.dat file was only the header (the table of pointers, plus flags; see
279 \fIstrfile\&.h\fR), and the text strings were left in their own file\&. The potential problem with this is that text file and header file may get out of synch, but the advantage is that the text files can be easily edited without resorting to unstr, and there is a potential savings in disk space (on the assumption that the sysadmin kept both \&.dat file with strings and the text file)\&.
280
281 .PP
282 Many of the enhancements made over the NetBSD version assumed a Linux system, and thus caused it to fail under other platforms, including BSD\&. The source code has since been made more generic, and currently works on SunOS 4\&.x as well as Linux, with support for more platforms expected in the future\&. Note that some bugs were inadvertently discovered and fixed during this process\&.
283
284 .PP
285 At a guess, a great many people have worked on this program, many without leaving attributions\&.
286
287 .SH "SEE ALSO"
288 .PP
289 \fBre_comp\fR(3),
290 \fBregcomp\fR(3),
291 \fBstrfile\fR(1),
292 \fBunstr\fR(1)
293