Dec 112017
 
Redirects printer output to file.
File PRNDSK.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Redirects printer output to file.
File Name File Size Zip Size Zip Type
PRNDSK.ASM 41161 11173 deflated
PRNDSK.COM 3568 1879 deflated
PRNDSK.DOC 12562 3847 deflated

Download File PRNDSK.ZIP Here

Contents of the PRNDSK.DOC file








PRNDSK Version 1.00
A Printer-To-Disk Redirector


INTRODUCTION
------------

PRNDSK is a utility that redirects output intended for a printer
or communications port and sends it to a disk file or other
device. It is intended to make it easy to capture disk copies of
printed output and screen dumps. It can also be used to discard
printer output by redirecting it to the NUL device, and you can
even use disk files as "virtual printers" if your computer does
not have the printer ports you need.

PRNDSK is written for the IBM PC and closely compatible
computers, running MS-DOS version 2.00 or later. Although it
tries hard to be reliable, it is very likely that there are
computers and programs with which it will not work. If you have
problems, or suggestions for improvements, contact the author:

David H. Rifkind
3993 N. Campbell Ave., #53
Tucson, Arizona 85719

BIXMail: drifkind

PRNDSK and this document are copyright 1987.


SYNOPSIS
--------

There are three basic formats for the PRNDSK command:

1. PRNDSK [/C][/F]
Displays information about devices currently being
redirected, or closes all files (/C), or flushes them
to disk (/F) while leaving them open.

2. PRNDSK device [/C][/F][/N][/T]
Displays redirection information about the specified
device, or closes its redirection file (/C), flushes it
to disk (/F), or sets or clears the transparency mode
(/N, /T).

3. PRNDSK device=filespec [/A][/T]
Begins redirecting a device to the file specified. The
/A switch is used to append to an already existing
file, and /T to set the transparent redirection mode.

















"Device" may be one of the following names:

LPT1 through LPT3 Printer ports 1 to 3
COM1 or COM2 Serial ports 1 and 2
PRN Same as LPT1
AUX Same as COM1

"Filespec" may be any unambiguous file specification. Legal
examples include:

PRINTER.TXT
A:COM1.TXT
..\LISTING
C:\DEVEL\PRINTER.TXT
NUL


REDIRECTING OUTPUT
----------- ------

To direct output intended for a printer or serial port to a file,
enter the following command:

PRNDSK device=filespec

"Device" should be replaced by the name of an output device:
LPT1, LPT2, LPT3, COM1, COM2, PRN or AUX. "Filespec" is replaced
by the name of a file to receive the output. Here is an example
of a legal command:

PRNDSK PRN=PRINTER.TXT

This will result in output to the printer being sent instead to
the file PRINTER.TXT in the current drive and directory. A drive
and path name may also be included in the filespec:

PRNDSK COM1=C:\FILES\LOGFILE.COM

In fact, "filespec" may be any MS-DOS file or device name,
including CON, NUL, or even a printer or serial port! If output
is redirected to a serial port or printer port, it is not further
redirected. To make this clear (or at least clearer):

PRNDSK PRN=COM1
PRNDSK COM1=COMM.TXT

In this example, output sent to the PRN device will go to serial
port number 1; it will NOT go to the file COMM.TXT.



















There are two switches which may be included with this form of
the PRNDSK command. The /A switch:

PRNDSK device=filespec/A

causes data to be appended to the output file. If the /A switch
is not included, the file will be erased before beginning output.

The /T switch:

PRNDSK device=filespec/T

results in transparent output--characters output will go to both
the redirection file AND to the specified device. This allows
you to make both a soft and a hard copy at the same time.

Once redirection to a file is begun, the disk containing that
file should not be removed. Close the file (see OUTPUT CONTROL)
first.


OUTPUT CONTROL
------ -------

To close an output file and terminate redirection for that
device, use this command:

PRNDSK device/C
or PRNDSK/C

The second version closes all files and terminates all
redirection.


PRNDSK also lets you flush an output file, that is, update the
file directory information on the disk without closing it. Make
whatever use of this that you can:

PRNDSK device/F
or PRNDSK/F


DEVICE STATUS
------ ------

To keep track of what devices you have redirected, PRNDSK will
show you the status of each device it handles. To find out to
what file a given device is being directed, enter:

PRNDSK device

For example:

PRNDSK PRN














The reply might be:

LPT1=C:\FILES\PRINTER.TXT

If the device is set for transparent redirection, the file name
will be followed by a "/T":

LPT1=C:\FILES\PRINTER.TXT/T

If redirection to the file has been stopped due to a DOS error,
the error message will be shown after the file name:

LPT1=C:\NONESUCH\PRINTER.TXT
Path not found

Finally, if the device in question is not being redirected, there
will be no reply. To list all devices being redirected, type:

PRNDSK

Note: the way the filename is reported varies slightly with
different versions of MS-DOS. In DOS 2.xx, the filename is
reported exactly as you entered it. In DOS 3.xx, the complete
unambiguous filespec is given.

PRNDSK PRN=..\FILES\PRINTER.TXT

DOS 2.xx: LPT1=..\FILES\PRINTER.TXT
DOS 3.xx: LPT1=C:\SUBDIR\FILES\PRINTER.TXT


CHANGING MODES
-------- -----

A redirected device may be switched into and out of the
transparent mode using one of the following commands:

PRNDSK device/T to set transparent mode
PRNDSK device/N to clear transparent mode

"/N" is a mnemonic for "not transparent", and deserves an award
as one of the least mnemonic mnemonics ever.


ERROR HANDLING
----- --------

If any DOS error occurs while PRNDSK is trying to write to a
file, the associated device will become "inactive". Attempts to
write to the device will generate printer I/O errors (for the
printer ports) or timeout errors (for the serial ports). The
device will remain inactive until it is closed (by PRNDSK/C).















COMPATIBILITY
-------------

PRNDSK intercepts the IBM PC's BIOS INT 14h and INT 17h vectors
(the serial and printer service interrupts). It may not work
correctly with other programs which also take over those vectors.

In most cases, PRNDSK will work with printer buffer software if
it is loaded AFTER that software. Due to the design of the IBM
PC's ROM BIOS, a great number of programs that use the serial
ports will not work with PRNDSK. However, if your serial ports
are being used for simple output devices such as printers or
plotters, it should work. Don't be surprised, though, if your
modem attached to COM2 prevents your using PRNDSK with the
printer attached to COM1.


PECULIARITIES
-------------

"Peculiarity" is the word we have chosen to describe some of the
stranger aspects of PRNDSK's operation. The word "feature" might
also be used. Use of the term "bug" is frowned upon.

In order to work correctly with DOS, PRNDSK keeps track of calls
to the various DOS services. This allows it to decide when it is
safe to write to the disk, and when to wait for a better time.
It is not always possible to make this decision correctly, so
PRNDSK adopts a conservative approach: it never writes to the
disk unless it is quite sure that it is safe.

Under some circumstances, it may be impossible to write to the
disk for a considerable period of time. When this happens,
PRNDSK can lose some characters which were sent to the printer.
This is rare, and may happen with some programs and not with
others. One simple example which will demonstrate this is:

COPY somefile PRN

where "somefile" is more than about 2K bytes long. There is no
apparent good solution for this problem.

Another peculiarity has to do with opening files. Under some
circumstances, this sequence of commands:

CHDIR \FIRST
PRNDSK PRN=PRINTER.TXT
CHDIR \SECOND

will result in PRINTER.TXT appearing in directory SECOND instead
of FIRST. This will happen only (1) when using DOS 2.xx and (2)
the first time that PRNDSK is run (that is, if PRNDSK is already
resident in memory, this will not happen).














If this behavior causes a problem, you can follow the first
PRNDSK command with:

PRNDSK PRN/F

which will ensure that the file ends up in the correct directory.


PROGRAM NOTES
------- -----

This is the first publicly released version of PRNDSK. There are
other programs that do about the same thing. I hope that PRNDSK
is more reliable and more functional than the others. I also
hope that you find it useful.

This first version is fairly rough in several ways. Since it
uses a 2K buffer for each of five devices, over 8K of memory is
wasted if only one is being redirected. There are also all those
darned "peculiarities" (see above). If there is enough interest
in PRNDSK, I might get ambitious and make improvements.

This is copyrighted material. No fee is charged for its use.
You may reproduce and distribute it as you see fit, but please do
not distribute modified or incomplete copies.

28 Feb 1987



































 December 11, 2017  Add comments

Leave a Reply