Contents of the COOKIE.DOC file
COOKIE - Fortune Cookie
Thursday April 14, 1988
Documentation for COOKIE
Copyright (c) 1988, All rights reserved
1695 Barbara Lane
East Meadow, NY 11554
COPYRIGHT AND DISCLAIMER
This program and documentation are Copyrighted (C) 1988 by Howard
Kapustein, All Rights Reserved.
Use of this program acknowledges this disclaimer of warranty:
"This program is supplied as-is. The author disclaims all
warranties, expressed or implied, including, without limitation,
the warranties of merchantability and of fitness of this library
for any purpose. The author assumes no liability for damages
direct or consequential, which may result from the use of this
Furthermore, the cookies supplied with this program are NOT
covered by this copyright. They have come from several sources,
and include the following notice:
Warning: The fortunes contained in the data files provided for
use with COOKIE have been collected haphazardly from a cacophony
of sources, in number so huge it boggles the mind. It is impossible
to do any meaningful quality control on attributions, or lack
thereof, or exactness of the quote. Since this database is not
used for profit, and since entire works are not published, it
falls under fair use, as we understand it. However, if any
half-assed idiot decides to make a profit off this, they will
need to double check it all, and nobody not involved of such an
effort makes any warranty that anything in the database is not
already protected by laws, statutes, or big dark gruesome men
who consider bone breaking an art form.
Once again, let me stress that, although the PROGRAM is
copyrighted, the DATA files are distributed FREE. After the
many hours I have put into the program, asking a few dollars
for my work is justified. However, the data files are not
considered part of my program. I make absolutely no guarrantees,
warranties, etc. regarding their merchantibility. See Warning
above for further details.
COOKIE is distributed as "shareware." If you like COOKIE, send
me a picture postcard. If you really like COOKIE, you can send
money instead. I reccommend $5, but you may send whatever
amount you feel is right. Please keep in mind that I am a poor,
hard working college student, and all donations will be gratefully
COOKIE may not be distributed without this documentation.
CREDIT WHERE CREDIT IS DUE
To set the record straight, my program is 100% original with
one minor exception (well, as original as a fortune cookie
program can be nowadays.) Some of you may have noticed a program
by Tom Hanlin III in the Public Domain released in the file
COOKIE.ARC. The only non-original idea in my cookie program is the
data file format. Most cookie programs encode the data to save
disk space. I wanted a format that could be easily editied with a
text editor. After looking at his data file, I decided to use the
same format for several reasons: 1) it did the job, 2) it was
simple, and 3) did you ever try converting files from one format
to another? Well, to make the data file I used numerous sources,
but I won't say it was fun. So why create a totally new format?
I did NOT use any of his source code. To this day I don't know
what kind of indexing method he used. I did look his code over,
but only in a 'gee, this looks interesting' kind of way. I did not
mean any slur again Tom by using the same data format (if anything
quite the opposite) and I'm sorry for not mentioning this in the
documentation previously. Personally, I prefer my program over
Tom's but then again, I should, I wrote it for my convenience.
I hope this clears up the matter.
Don't forget about that beer Tom.
DESQview is a registered trademark of Quarterdeck Office Systems
WHAT IS COOKIE?
COOKIE is my own implementation similar to that available on
many systems. Like a fortune cookie you get at a chinese restaurant,
COOKIE will display a fortune picked at random from a data file.
HOW DO I SETUP COOKIE?
The COOKIE program should come with the following files:
COOKIE.DAT - small data file
COOKIE.DOC - this documentation file
COOKIE.DVP - DESQview(tm) setup file
COOKIE.EXE - the program (20 cookies)
CRUDE.DAT - rude data file (2398 cookies)
To use COOKIE you need the executable file (COOKIE.EXE), a
data file (COOKIE.DAT by default) and an index file (COOKIE.NDX
You may have noticed the index file is not supplied. To
create an index for a cookie data file, use the -c parameter (at
the command line type COOKIE -C) See Options for more info.
The default data file COOKIE.DAT is a small sample of 20
cookies rated PG copied from CRUDE.DAT. The rude data file
contains mixed PG and R cookies. The rude data file is not
entirely rude, but I felt the people out there who would be
offended by such things would like to know which files contain
potentially offensive material. The only way to extract the
non-rude cookies from the CRUDE.DAT file is to manually
edit them. Sorry, but I find them amusing. If you find some of
the material offensive, tough. This is America. You did not pay
me to write this program, I wrote it for my own amusement. He who
pays the piper calls the tune, eh?
If you want to use the larger cookie file (CRUDE.DAT) or one
of your own, just delete the COOKIE.DAT file and rename the file
you want as COOKIE.DAT (don't forget to -C reate the index.)
Don't worry about losing anything when you delete the COOKIE.DAT
from your disk, all 20 of them are in CRUDE.DAT.
WHAT FILES ARE USED BY COOKIE?
COOKIE will use the following precedence to determine what data
and index file to use:
1) Command line parameters: -i and -d parameters
2) Environment variables: SET COOKIEDAT and SET COOKIENDX
3) Default: the root directory of the current drive
By using the evironment variables or command line parameters
you can overrule the default location for the data and/or index
files. As of version 1.0, COOKIE only supports different
drive/path names. The filename CANNOT be changed. Regardless of
the method used to determine the location of the data files,
COOKIE will look for COOKIE.DAT and COOKIE.NDX. Perhaps a later
version will support user definable file names. I currently have
other things to do, but if I receive enough requests, well, who
I. DATA FILE
The data file needs the following format:
Line 1 of cookie(CR)
@Line 2 and after of same cookie(CR)
When I wrote COOKIE, I wanted a file format I could view
with a plain old text editor. The data file requires that any
cookie 2 or more lines long must have every line after the
first preceded by an @ sign. Also, each line must be
terminated with a carriage return/line feed (just hit enter
while in a text editor. On an IBM computer plain text has a
CR/LF pair at the end of the line.)
Here's a sample data file:
Murphy was an optimist.
Somewhere, Somehow, Someone's going to pay.
@ Part machine,
@ All cop.
@The future of law enforcement.
This data file has 3 cookies. Cookie #1 and #2 are both
only 1 liners. Cookie #3 has 5 lines (Part man...The future).
The @ signs tell COOKIE that the line is a continuation of
Note: Although it is possible to have cookies with lines
longer than 80 characters, I do not do it. There is
nothing wrong with it, but I have set COOKIE to read
lines of 80 characters in length, not including the
@ continuation symbol and terminating CR/LF. Longer
lines could have unpredictable results.
II. INDEX FILE
I highly reccommend not messing around with the index
files. If you have a problem, just create the index (-c).
But, for those of you interested, here's some info.
The index file is a text file listing offsets of the
beginning of cookies in the data file. The 1st line is a
count of the number of cookies indexed. Every subsequent
line is an offset from the beginning of the data file to
the beginning of each cookie.
COMMAND LINE PARAMETERS
Here is a list of the parameters supported by COOKIE:
-c = create index
-d = data file
-i = index file
-n = display cookie #
-p# = pick a cookie
-s = cookie statistics
-w[n] = wait for keypress
-?,-h = help
-c CREATE INDEX: Use this to create an index for the data file
specified (by default, evironment or command
line). This will create the file COOKIE.NDX at
the proper location.
-d DATA FILE: Specify the location of the data file. Highest
precedence (will overrule DOS environment variable
-i INDEX FILE: Specify the location of the index file. Highest
precedence (will overrule DOS environment
-n DISPLAY NUMBER: The cookie will also display its number in
-p# PICK A COOKIE: Allows you to pick a specific cookie from the
data file. Only cookies from 1 to the highest
cookie available can be selected (regardless
32767 is the maximum.) Ex: -p127 displays
the 127th cookie, if there is one.
-s STATISTICS: display some info about the selected data and
index files. Useful for checking validity of
-w[n] WAIT FOR KEYPRESS: with this option COOKIE will display its
fortune and then pause until a key is
pressed. If a number is specified, COOKIE
will wait until that key is pressed.
Ex: -w32 waits for space and then quits
(space is ASCII character 32). Extended
keys are supported (Alt, function keys,
etc.) To determine the wait code, use this
formula: 256*scan+ascii where scan is 0
for a normal key and 1 for an extended key.
Useful for oprating COOKIE with DESQview (tm).
-?,-h HELP: oh come on, it's kind of obvious, isn't it?
If you want to merge all of the cookie files together, or
add more to your current data files, just use a text editor and
append whatever you want onto the end. Make sure when you save
the file that it does not end in a blank line. It gave me a blank
cookie one time because of a blank line at the end of the file.
The data file should just end, no CR, no Ctrl-Z, nothing. The
last line should have the last line of whatever cookie, and NO
Be sure to create the index after changing the data file or
you may get unpredictable results.
When COOKIE creates an index file, it will overwrite/destroy
any existing file of the same name COOKIE.NDX at the same
If you believe an index file is bad, use the statistics (-s)
option. If the numbers do not match, that index file will not work
properly with that data file. The converse is not true. If the
numbers match, this does NOT mean that the files are ok. Just
that they are MOST LIKELY ok.
I used the random number generator that comes with TC 1.5.
This will initialize the random generator function based on the
time. Running COOKIE rapidly time after time you will notice some
cookies are repeated twice in a row. This is because you are not
giving your poor overworked PC enough time between executions for
the random number seed (the time) to change enough to generate a
different cookie. This only happens if for some godforsaken
reason you try running cookie many times at once (I tried this
with DESQview just for the hell of it and out of 10 cookies,
I only got 2 pairs. Then again, I use the CRUDE.DAT file as my
data file. Smaller data files will have more repeats, of course.)
INFORMATION / REQUIREMENTS
COOKIE was compiled with the interactive version of Turbo
C 1.5, optimized on SPEED, with full optimization turned on.
I have tested COOKIE on my system rather thoroughly, although
this does not guarrantee you won't have problems. I did
nothing impossible on any other computer (UNIX, Macintosh,
etc.) so there should be no problems. If you have difficulties,
feel free to contact me. My system:
- IBM PC
- DOS 3.20
- NEC V20 cpu
- PC Sprint (dandy little speed up plug in. No slot,
hardware switch for normal (4.77) and fast (~7) MHz
speeds and reboot. Between the board and the NEC my
machine plods along almost 2x as fast as a normal PC.
At only $95, I highly reccommend it. Call these guys
for more info:
Product: PC Sprint and/or NEC V20
PO BOX 11268
Shorewood, WI 53211
VOICE: (414) 963-2880
MODEM: (414) 964-5160
Version 1.0 - 3/24/88
- Initial release
Version 1.1 - 4/14/88
- bug fix: when displaying the last cookie in the file the last
line would be displayed twice. Fixed.
- I forgot to include the DESQview .DVP file with COOKIE 1.0
- modified the code to use TC 1.5's new global variables
(_argc, _argv). Be warned, when converting my FREE program to
Turbo C 1.5, I used the standard main(int argc, char *argv)
and only the 1st command line parameter would get through.
After extensive testing I can only believe it's the compiler's
fault. If can shed any light on this problem, please let me
know. For those of you who don't program, this paragraph says
earlier versions of COOKIE may not properly accept more than
one parameter (i.e. COOKIE -N -Dc:\cookie may not get the -D
I can't think of any more functions missing from COOKIE. It does
what I want, and I'm satisfied. If there are some features/changes
you'd like implemented, contact me and maybe I'll make them.
ABOUT THE AUTHOR
I am a junior at Rensselaer Polytechnic Institute majoring in
Computer Science. Since I don't graduate until May '89, my main
source of income is a summer job. If you are in the Long Island
New York City, and/or Troy/Albany area, I do micro consulting and
custom program design. If you're interested, I can be reached at
the addresses below.
DCOUNT 1.2 - Document/Text file info, find out all kinds of
information like # words, lines, pages, control
characters, etc. Many options.
FREE 1.3 - Free disk space, with options. Distributed with full
Turbo C source.
TCHK 0.70 - a Turbo C library, featuring date, time and string
manipulations, keyboard and video routines,
hardware and software identification, ANSI,
multitasking, math, financial, DOS, and menu
functions, and much more. Version 0.80 to support
TC 1.5 available soon
Thanks to the graciousness of the sysop at The BOSS, I now have
easier access to his BBS. The latest versions of my software can
be found there.
If there are some features you would like to see implemented, or
you have any suggestions, comments or questions, please don't
hesitate to contact me. I can be reached at the following:
Howard Kapustein Howard Kapustein
1695 Barbara Lane 404 Davison Hall
East Meadow, NY 11554 Rensselaer Polytechnic Institute
Phone: (516) 481-9612 Troy, NY 12180
Phone: (518) 276-7381
or at the following bulletin boards:
The Boss dBBS (201) 568-7293 *** Support BBS
The Tool Shop (602) 279-2673
These bulletin boards are places I can be reached by modem.
COOKIE (and all other software I release) is supported through
The BOSS. The Tool Shop is merely a BBS I frequently visit.
If you try to get in touch with me during the school year
(roughly Sep 1 - May 10, not counting winter break) PLEASE try to
reach me at college. If you call my home the odds are you won't
get much information as my parents aren't exactly computer people.