home *** CD-ROM | disk | FTP | other *** search
-
-
- SCRIPT Version 1.1 - Save console output to a file
-
- I hereby release this program into the public domain. Do with
- it as you please. I would appreciate it if my name were left
- in the source code somewhere.
-
- DISCLAIMER:
-
- I have had no problems with this program to date, but I have
- no doubt that there are TSR's and other beasties lurking out there that
- will interact in weird and wonderful ways with this program.
- I accept no responsibility for any trashed FAT's or otherwise,
- that might result from a war of the above sort. I have tested the
- program only under MS-DOS 3.2.
-
- WHAT IT DOES:
-
- SCRIPT is similar to the UNIX program of the same name.
- While running SCRIPT, output that appears on the console,
- will also be saved into a file for later perusal.
-
- USAGE:
-
- SCRIPT is called from the DOS command line thusly:
-
- "script [-f outputfile] [-a] [command]"
-
- Output is saved into the file "outputfile" if is given. Default
- is the file "typescript" in the current directory. If the "-a"
- option is given, SCRIPT appends to "outputfile" rather than
- truncating it first.
-
- SCRIPT optionally takes a command as argument. If one is given,
- this command is executed rather than a copy of "command.com". If
- "command" is a command.com builtin, it must be given as argument to
- "command /c". An example usage is:
-
- script -f junk command /c echo hello world
-
- SCRIPT terminates when the command running under it terminates.
-
- PROGRAM OPERATION:
-
- SCRIPT works by intercepting the DOS function call interrupt
- "int 21". When a program running under SCRIPT executes an "int 21",
- SCRIPT examines the DOS function call to determine whether it will
- result in output going to the console. If such is the case, SCRIPT
- will save this output in an internal buffer and pass the call on to
- the real DOS so that it does the actual console output. When the
- internal buffer is full, SCRIPT flushes it to disk. To do this,
- SCRIPT uses the undocumented DOS function call 50h - SETPSP.
- I have no idea which versions of DOS support this function call.
-
- NOTES:
-
- SCRIPT keeps the output file open throughout it's entire operation.
- If a chkdsk is run while SCRIPT is active, it may report lost clusters
- and other such things. Do not reclaim these clusters; they probably
- belong the SCRIPT's output file.
-
- Do not install any TSR's while running script.
-
- Do not forget that script is running. If you do, you may run out
- of disk space fairly quickly. You can tell whether script is active
- by trying to run it again. If it was active, the new invocation
- will abort with an error message.
-
- BUGS:
-
- On output, SCRIPT first writes all the data to the output
- file, and then chains to DOS so that DOS does the actual console
- output. If a ^C is hit while this console output is taking place,
- console output is stopped. However this data has already been
- written to the output file. The result is that more data can appear
- in the output file than actually appeared on the screen.
-
- If a ^C is typed while a program running under SCRIPT is waiting
- for input, SCRIPT can become confused and may stop saving output
- to the output file. See the source code for an explanation of this
- phenomenon.
-
- If a program outputs to the console by calling the BIOS,
- or by writing directly to the hardware, this output will not
- be saved in the output file. There are probably even ways of
- doing output through DOS that SCRIPT does not handle properly.
-
- COMPILING:
-
- SCRIPT was written using Turbo C version 2.0 and TASM 1.0.
- A makefile is provided, although it may not work with Borlands
- make program.
-
- Suggestions and Bug reports will be much appreciated.
- graham@sce.carleton.ca (Doug Graham)
-