| Home | Trees | Indices | Help |
|
|---|
|
|
fortune is a stripped-down implementation of the
classic BSD Unix fortune command. It combines the
capabilities of the strfile command (which produces the
fortune index file) and the fortune command (which
displays a random fortune). It reads the traditional
fortune program's text file format.
Usage:
fortune [OPTIONS] /path/to/fortunes OPTIONS -u, --update Update the index file. -q, --quiet When updating the index file, do so quietly.
If you omit the path, fortune looks at the
FORTUNE_FILE environment variable. If that environment
variable isn't set, fortune aborts.
A fortune cookie file is a text file full of quotes. The format is simple: The file consists of paragraphs separated by lines containing a single '%' character. For example:
A little caution outflanks a large cavalry.
-- Bismarck
%
A little retrospection shows that although many fine, useful software
systems have been designed by committees and built as part of multipart
projects, those software systems that have excited passionate fans are
those that are the products of one or a few designing minds, great
designers. Consider Unix, APL, Pascal, Modula, the Smalltalk interface,
even Fortran; and contrast them with Cobol, PL/I, Algol, MVS/370, and
MS-DOS.
-- Fred Brooks, Jr.
%
A man is not old until regrets take the place of dreams.
-- John Barrymore
For efficiency and speed, fortune uses an index file to
store the offsets and lengths of every fortune in the text fortune
file. So, before you can use fortune to read a random
fortune, you have to generate the data file. With the traditional BSD
fortune program, you used the strfile(8) command to
generate the index. With this fortune program, however, you
simply pass a special argument to the fortune command:
fortune -u /path/to/fortunes
That command will generate a binary
/path/to/fortunes.dat file that contains the index. You
should run fortune -u whenever you change the text fortune
file.
Once you have an index file, you can generate a random fortune
simply by running the fortune utility with the path to
your text fortunes file:
fortune /path/to/fortunes
This version of fortune does not provide some of the
more advanced capabilities of the original BSD program. For instance,
it lacks:
It does, however, provide the most important function: The ability to display a random quote from a set of quotes.
Copyright (c) 2008 Brian M. Clapper
This is free software, released under the following BSD-like license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
This product includes software developed by Brian M. Clapper (bmc@clapper.org, http://www.clapper.org/bmc/). That software is copyright (c) 2008 Brian M. Clapper.
Alternately, this acknowlegement may appear in the software itself, if and wherever such third-party acknowlegements normally appear.
THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRIAN M. CLAPPER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| Functions | |||
| str |
|
||
|
|||
|
|||
| Function Details |
Get a random fortune from the specified file. Barfs if the
corresponding
|
Create or update the data file for a fortune cookie file.
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue May 20 11:22:16 2008 | http://epydoc.sourceforge.net |