Why is fortune writing to the fortunes.dat file?

Jonathan I. Kamens jik at athena.mit.edu
Fri May 26 05:10:05 AEST 1989


In article <883 at apctrc.UUCP> zjat02 at trc.amoco.com (Jon A. Tankersley) writes:
>The subject says it all.  This requires /usr/games to be mounted rw.
>I can understand things like hack and the like that keep usage information
>but does fortune really need this?  I strip out most of the games, but
>fortune has kinda universal approval.  Would it be better to have it
>try the rw open and not try to write if it has ro access?

The fortune program doesn't really return a "random" fortune each time
it is run.  Instead, it goes through the fortunes.dat file
sequentially, and each time the program is run it prints out the next
appropriate fortune.

In order to keep track of where it is in the file, it has to write its
current location to the file after each time it reads a fortune.

I've looked at the code for a few minutes and it's a bit obscure (to
me at least), but this is the general idea of what occurs.  Anybody
know more details (like the format of the binary data at the beginning
of the .dat files, for example)?

Jonathan Kamens			              USnail:
MIT Project Athena				410 Memorial Drive, No. 223F
jik at Athena.MIT.EDU				Cambridge, MA 02139-4318
Office: 617-253-4261			      Home: 617-225-8218



More information about the Comp.unix.questions mailing list