SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from RedHat 5.X fortune-mod-1.0-5.i386.rpm

FORTUNE

Section: UNIX Reference Manual (6)
Updated: 19 April 94 [May. 97]
Index 

NAME

fortune - print a random, hopefully interesting, adage 

SYNOPSIS

fortune [-aefilosw] [-nlength] [-m pattern] [[n%] file/dir/all] 

DESCRIPTION

Whenfortuneis run with no arguments it prints out a random epigram. Epigrams aredivided into several categories, where each category is sub-dividedinto those which are potentially offensive and those which are not. 

Options

The options are as follows:
-a
Choose from all lists of maxims, both offensive and not. (See the-o option for more information on offensive fortunes.)
-e
Consider all fortune files to be of equal size (see discussion belowon multiple files).
-f
Print out the list of files which would be searched, but don'tprint a fortune.
-l
Long dictums only. See -non how ``long'' is defined in this sense.
-m pattern
Print out all fortunes which match the basic regular expressionpattern.The syntax of these expressions depends on how your system definesre_comp(3) or regcomp(3),but it should nevertheless be similar to the syntax used ingrep(1).

The fortunes are output to standard output, while the names of the filefrom which each fortune comes are printed to standard error. Either orboth can be redirected; if standard output is redirected to a file, theresult is a valid fortunes database file. If standard error is alsoredirected to this file, the result is still valid,but there will be ``bogus''fortunes,i.e. the filenames themselves, in parentheses. This can be useful if youwish to remove the gathered matches from their original files, since eachfilename-record will precede the records from the file it names.
-n length
Set the longest fortune length (in characters) considered to be``short'' (the default is 160). All fortunes longer than this areconsidered ``long''. Be careful! If you set the length too short andask for short fortunes, or too long and ask for long ones, fortune goesinto a never-ending thrash loop.
-o
Choose only from potentially offensive aphorisms.

Please, please, please request a potentiallyoffensive fortune if and only ifyou believe, deep in your heart,that you are willing to beoffended. (And that you'll just quitusing -o ratherthan give us grief about it,okay?)

... let us keep in mind the basic governing philosophy of TheBrotherhood, as handsomely summarized in these words: we believe inhealthy, hearty laughter -- at the expense of the whole human race, ifneeds be. Needs be.
--H. Allen Smith, "Rude Jokes"
-s
Short apothegms only. See-non which fortunes are considered ``short''.
-i
Ignore case for -mpatterns.
-w
Wait before termination for an amount of time calculated from thenumber of characters in the message. This is useful if it is executedas part of the logout procedure to guarantee that the message can beread before the screen is cleared.

The user may specify alternate sayings. You can specify a specificfile, a directory which contains one or more files, or the special word allwhich says to use all the standard databases. Any of these may bepreceded by a percentage, which is a number nbetween 0 and 100 inclusive, followed by a %.If it is, there will be a npercent probability that an adage will be picked from that file ordirectory. If the percentages do not sum to 100, and there arespecifications without percentages, the remaining percent will applyto those files and/or directories, in which case the probability ofselecting from one of them will be based on their relative sizes.

As an example, given two databases funny and not-funny, with funnytwice as big (in number of fortunes, not raw file size), saying

fortunefunny not-funny

will get you fortunes out of funnytwo-thirds of the time. The command

fortune90% funny 10% not-funny

will pick out 90% of its fortunes from funny(the ``10% not-funny'' is unnecessary, since 10% is all that's left).

The -eoption says to consider all files equal; thus

fortune -efunny not-funny

is equivalent to

fortune50% funny 50% not-funny

This fortune also supports the BSD method of appending ``-o'' todatabase names to specify offensive fortunes. However this isnothow fortune stores them: offensive fortunes are stored in a seperatedirectory without the ``-o'' infix. A plain name (i.e., not a path to afile or directory) that ends in ``-o'' will be assumed to be anoffensive database, and will have its suffix stripped off and besearched in the offensive directory (even if the neither of the-a or -ooptions were specified). This feature is not only forbackwards-compatibility, but also to allow users to distinguish betweeninoffensive and offensive databases of the same name.

For example, assuming there is a database nameddefinitionsin both the inoffensive and potentially offensive collections, then thefollowing command will select an inoffensive definition 90% of the time,and a potentially offensive definition for the remaining 10%:

fortune90%definitions definitions-o

 

FILES

Note: these are the defaults as defined at compile time.

/usr/share/games/fortunes
Directory for innoffensive fortunes.
/usr/share/games/fortunes/off
Directory for offensive fortunes.

If a particular set of fortunes is particularly unwanted, there is aneasy solution: delete the associated.datfile. This leaves the data intact, should the file later be wanted, butsince fortuneno longer finds the pointers file, it ignores the text file. 

BUGS

The division of fortunes into offensive and non-offensive by directory,rather than via the `-o' file infix, is not 100% compatible withoriginal BSD fortune. Although the `-o' infix is recognised as referringto an offensive database, the offensive database files still need to bein a seperate directory. The workaround, of course, is to move the `-o'files into the offensive directory (with or without renaming), and touse the-aoption.

The supplied fortune databases have been attacked, in order to correctorthographical and grammatical errors, and particularly to reduceredundancy and repetition and redundancy. But especially to avoidrepititiousness. This has not been a complete success. In the process,some fortunes may also have been lost.

The fortune databases are now divided into a larger number of smallerfiles, some organized by format (poetry, definitions), and some bycontent (religion, politics). There are parallel files in the maindirectory and in the offensive files directory (e.g., fortunes/definitions andfortunes/off/definitions). Not all the potentially offensive fortunes are inthe offensive fortunes files, nor are all the fortunes in the offensivefiles potentially offensive, probably, though a strong attempt has beenmade to achieve greater consistency. Also, a better division might bemade. 

HISTORY

This version of fortune is based on the NetBSD fortune 1.4, but with anumber of bug fixes and enhancements.

The original fortune/strfile format used a single file; strfile read thetext file and converted it to null-delimited strings, which were storedafter 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; seestrfile.h),and the text strings were left in their own file. The potential problemwith this is that text file and header file may get out of synch, but theadvantage is that the text files can be easily edited without resortingto unstr, and there is a potential savings in disk space (on theassumption that the sysadmin kept both .dat file with strings and thetext file).

Many of the enhancements made over the NetBSD version assumed a Linuxsystem, and thus caused it to fail under other platforms, including BSD.The source code has since been made more generic, and currently works onSunOS 4.x as well as Linux, with support for more platforms expected inthe future. Note that some bugs were inadvertantly discovered and fixedduring this process.

At a guess, a great many people have worked on this program, many withoutleaving attributions. 

SEE ALSO

re_comp(3), regcomp(3), strfile(1), unstr(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
Options
FILES
BUGS
HISTORY
SEE ALSO

This document was created byman2html,using the manual pages.