home *** CD-ROM | disk | FTP | other *** search
-
-
- QUOTE, v2.4
- -------------
- from TifaWARE
-
-
-
-
- What's New
- ----------
-
- With version 2.4 I have tweaked the code a bit more, adding a few
- assertions to aide in debugging and making use of some library routines I
- have developed. Users should not see any difference, apart from a much
- larger database of quotes included with the package!
-
- Version 2.3 of QUOTE contains an improved algorithm for randomly
- indexing into the quote database. It should now work ok even with small
- quote databases. Alas, the approach will mean somewhat slower performance
- since (a) two reads are done for each quote displayed and (b) quotes are
- displayed a character at a time. (Better buy that 486 machine now! :-)
-
- New to version 2.2 is a verbose reporting option - you can see at what
- point in the database each quote is selected. AT&T's getopt function is now
- used for a consistent method of option processing. Finally, two bugs were
- found and corrected: The first would cause unpredictable results if the
- database began with a '$'. The second would have made overflow errors more
- likely as the size of the database grew.
-
- Version 2.1 of QUOTE fixes a minor bug in the portion of code which
- computes a random location in the quote database. Previously, the index
- could be regarded as negative if the database exceeded roughly 32K in size.
- This would cause QUOTE to simply skip to the next iteration without
- printing any error message. This behaviour has been corrected, and QUOTE
- should now work correctly with files of any size.
-
- As of v2.0, QUOTE has been ported from assembler to C. This should
- make it easier to maintain and catch those inevitable bugs. Further, I
- expect it will mean the "randomness" of the quotes will improve now that
- Turbo C's rand() function is used to generate random numbers; contrast this
- with my feeble assembler routine which merely indexed into memory a few
- times! Also new to version 2.0 are commandline options to clear the
- screen, set the repetition count, display a brief help message, and (my
- favourite) alter QUOTE's default configuration. Refer to the source code
- for more specific information on QUOTE's revision history.
-
-
-
-
- Introduction
- ------------
-
-
- If you've used a mainframe computer then you're probably familiar
- with some type of random quote generator; eg, Cookie, Button, Fortune,
- etc... Reading quotes is an interesting and thought-provoking way to pass
- the time. After searching some software archives, though, I didn't find
- an adequate implementation for MS-DOS machines.
-
- I wrote QUOTE to fill this void in MS-DOS and designed it so users
- could easily modify its behaviour. QUOTE works by "randomly" selecting a
- quote from a database and then displaying it on the screen. The selection
- is "random" only in the sense that if you run the program again you won't
- necessarily see the same quote, not in a strict statistical sense. QUOTE
- is also configurable from the commandline, in case you're not happy with
- its default behaviour.
-
- As of this writing, the default quote database (QUOTE.DAT) contains
- over 750 quotes. Many of these reflect my inherent cynicism and reveal a
- lot about their authors; eg, "All the wastes in a year from a nuclear power
- plant could be stored under a desk." or "Abortion is advocated only by
- persons who have themselves been born." (both from Ronald Reagan). I've
- found them while reading books, magazines, newspapers, etc... as well as
- in compilations such as _Familiar Quotations_ (Bartlett) and _The Experts
- Speak_ (Cerf & Navasky). Most are in English, some in Latin (with
- translations), and a few are in Spanish (w/ and w/o translations).
-
- If you share my sense of humour, you may be content to use QUOTE with
- the database distributed with the program. Don't be afraid to make
- changes though - it's quite easy. The only thing you'll need is an editor
- or word processor capable of handling straight ASCII files. Each quote
- (except the first) must be delimited by dollar signs, '$', and be no longer
- than 512 characters. [Note that quotes cannot contain a dollar sign as
- part of the quote.] There are no other restrictions on the format of the
- quotes. Quotes can take up 2 lines or 10, or whatever! Whatever you put
- between two dollar signs will be treated as a quote. You can even use ANSI
- ESCape sequences to give emphasis to certain quotes or position them on the
- console! It's that simple!
-
-
-
-
- Usage
- -----
-
-
- QUOTE's operation is straightforward. As distributed, QUOTE will
- display a single random quote on the screen if it's invoked with no
- arguments. Options are provided to permit the user to clear the screen
- first, to display multiple quotes, to use an alternate quote database, or
- even to alter QUOTE's default configuration. After you've placed the
- program where DOS can find it, type QUOTE -? at the DOS prompt. You should
- see a brief help message similar to the following:
-
- TifaWARE QUOTE, v2.4a, displays randomly selected quotes.
- Copyright (c) 1991 by TifaWARE/George A. Theall.
-
- Usage: quote [options] [qdat]
-
- Options:
- -c = configure program using current arguments
- -rn = set the repetition count to n quotes
- -s[+,-] = clear/don't clear screen first
- -v = verbose reporting
- -? = provide this help message
-
- Qdat refers to the quote database. If it's not specified, then file
- QUOTE.DAT will be used.
-
- [If you don't remember anything else from reading the documentation, at
- least remember how to display this help message.]
-
- You probably won't find the '-v' option of must interest. It's mostly
- for debugging purposes - in case QUOTE claims some quotes are invalid.
- When you select this option, QUOTE will tell you the name of the database
- as well as what part of the database (in terms of characters) it has
- selected.
-
- The '-s' is used to clear the screen before displaying any quotes.
- Note that QUOTE looks for a supplemental argument following this option. If
- this argument begins with a '+', the screen will be cleared; otherwise, it
- will not. Only the first character matters; ie., "-s+", "-s +", "-s+c" and
- "-s +junk" all mean the same to QUOTE.
-
- If you're really bored with work, you'll probably get a lot of use out
- of the '-r' option. Simply specify the repetition count immediately after
- the '-r'; eg, '-r3', and QUOTE will display as many as you want. Note: if
- you call for 25000 quotes, you'll get 'em!
-
- The '-c' option lets you alter QUOTE's default configuration (with the
- exception of the '-?', '-v' and '-c' options). Assuming the program itself
- is on a disk with write-access (and, if you're running MS-DOS v2.xx, that
- it's in the current directory), you can update QUOTE's configuration by
- specifying '-c' along with whatever arguments you'd like. For example,
- suppose you'd like to scan C:\USR\ETC\Quote.Dat for quotes and clear the
- screen first by default. Simply type "QUOTE -c -s+ C:\USR\ETC\Quote.Dat"
- once; from then on, QUOTE will read from the specified file and erase the
- screen first unless you explicitly override this behaviour with a different
- set of commandline arguments.
-
- Only one other argument can be used with QUOTE - the name of an
- alternate quote database. And this must follow any options you might
- specify. If more than one name is found, it's assumed you need help with
- QUOTE's usage.
-
- All regular output from QUOTE is written to a device called stdout,
- which is normally your computer's screen. Using the DOS redirection
- characters '>' and '|', you could send this output to a disk file, printer,
- or even use it as input into another program. [Refer to your DOS manual
- for more information on output redirection.] The flexibility of this
- approach should be clear.
-
-
-
-
- If You Have Any Trouble
- -----------------------
-
-
- QUOTE will attempt to let you know of any problems that arise. Here
- are the messages you might see and how you should deal with them:
-
- quote: illegal option -- x.
- - Type "QUOTE -?" for a list of valid options.
-
- quote: option requires an argument -- x.
- - Type "QUOTE -?" for a list of valid options and supply
- supplemental arguments as necessary.
-
- quote: invalid rep count; 1 used instead.
- - You must specify a positive integer when invoking QUOTE
- with the '-r' option. Note the program makes no attempt
- to second-guess the user here; ie, it's just as happy
- with a repetition count of 9381 as with one of 2.
-
- quote: unable to write new configuration to QUOTE.COM.
- - To configure the program, QUOTE needs write-access to a
- copy of itself. If you're not running MS-DOS v3.x or
- better, QUOTE.COM must be in the current directory when
- configuring; otherwise, this message probably means the
- drive with QUOTE.COM is write-protected.
-
- quote: new configuration of QUOTE.COM accepted.
- - This is only an informative message, not an error. It
- means exactly what it says.
-
- quote: can't open QUOTE.DAT.
- - QUOTE was unable to open the specified quote database.
- Check the spelling and make sure the file actually
- exists. If it does, your drive's likely bad.
-
- quote: invalid quote found around ==>blah, blah, blah...<==.
- - When QUOTE finds a bad quote, it prints the contents
- of its buffer. Make sure that the offending quote is
- is delineated by '$'s and that no quote is larger than
- 512 characters; some editing may be necessary to meet
- this limit. Also, don't forget the first quote must
- *not* begin with a '$'.
-
- quote: error while reading from QUOTE.DAT.
- - This error should never occur, but... It means QUOTE
- managed to open the database but encountered an error
- when selecting a random quote.
-
- These error messages are written to the standard error device. In this
- way, they won't disappear down a pipe or into a file should you try to
- redirect QUOTE's output.
-
- Additionally, QUOTE uses a return code to convey information about
- the success or failure of its operation. Possible return values are:
-
- Code Meaning
- ---- -------
- 0 Success
- 1 Help message was displayed
- 2 Program was configured
- 10 Unable to open file
- 15 Trouble reading from file
- 20 Unable to write to device
-
- You can test for these codes using the ERRORLEVEL variable in a batch file.
-
-
-
-
- Requirements
- ------------
-
-
- TifaWARE QUOTE runs on machines operating under MS-DOS v2.xx or later,
- and requires roughly 15K of memory. It uses a BIOS call to clear the
- screen but does not otherwise require PC-compatibility.
-
-
-
-
- Who Owns It?
- ---------------
-
-
- The source code for QUOTE is public domain. I do, however, retain the
- copyright on the compiled program in order to abide by the license
- agreement for TURBO C++; you may freely redistribute and use it.
-
- QUOTE carries no obligation on my part to support users or provide
- future upgrades. I have tried to write clean code and believe it to be
- "bug-free". Nevertheless, you must use this program ***AT YOUR OWN
- RISK***.
-
- As author of QUOTE, I ask of you two things: First, if you
- redistribute this program please keep together my original source code,
- documentation, and executable. This just makes it easier for others to
- use the software. Second, let me hear what you think of QUOTE - your
- comments on a postcard would be appreciated. Enjoy!
-
-
-
-
- Kudos
- -----
-
-
- Borland deserves a great deal of credit for its compiler and stand-
- alone debugger. Together these products make C programming a joy.
-
-
-
-
-
- George A. Theall
-
- TifaWARE
- 506 South 41st St., #3M
- Philadelphia, PA. 19104
- U.S.A.
-
- +1 215 662 0558
-
- GTHEALL@PENNDRLS.UPENN.EDU (Internet)
-