home *** CD-ROM | disk | FTP | other *** search
-
- DCMD.DOC
- V1.00
-
- Matthew Dillon
-
- DCMD is utility that monitors a CLI's console IO and copies it to
- a user specified file. The console IO is unaffected by this
- monitoring.
-
- DCMD has one dangerous problem... there is no way for the monitoring
- handler to know when there are no more references to its dummy device
- port. Thus, when you start a monitoring session with DCMD, you must
- NEVER END THE SESSION UNTIL all programs that were *ever* run by the
- shell being monitored have exited. UNDER NO CIRCUMSTANCES MAY YOU
- START A PROGRAM IN THE BACKGROUND AND THEN EXIT DCMD. Programs which
- detach themselves and otherwise have no references to the console
- device are safe to leave running.
-
- I suggest that you always specify a file in RAM:, in case of crash.
- DCMD munches on the innards of DOS and there is no guarentee that it
- will be compatible with everything.
-
- DCMD consists of two programs:
- DCMD
- L:DCMD-HANDLER
-
- To start a session type DCMD <filename>, where <filename> is the file
- to hold the monitored IO. In almost all cases you will want to specify
- a file in RAM:, especially because you can type or edit the file while
- DCMD is writing to it. If on a floppy or an HD the file can be read
- only to the point of the last sync (see below).
-
- 1> DCMD <filename> start a monitoring session, the file is
- appended to. If DCMD needs to create the
- file, it will close-reopen it in shared
- mode.
-
- 1> DCMD end a monitoring session
-
- 1> DCMD sync (or SYNC), forces DCMD to close-reopen the
- file, used when the file is not placed in
- the RAM: disk to allow reading of the file
- up the current point.
-
- EXAMPLE SESSION
-
- 1> DCMD T:test.out
- BEGIN DCMD002EC4C0.PORT Fri Oct 12 14:34:51 1990
- 1> ECHO Hello
- Hello
- 1> DIR T:
- ...
- 1> DCMD
- DCMD ended
-
- 1> TYPE T:test.out
- (your entire session is printed verbatim)
-
- Source to DCMD is included and compiles under DICE. The code should be
- easily portable to other compilers.
-
- OPERATION
-
- DCMD creates a public message port named after the CLI process it is to
- monitor, then redirects the console handler and current input and
- output file handles for the CLI through this public port.
-
- DCMD then loads and runs DCMD-HANDLER as a separate processs.
- DCMD-HANDLER's task name is the same as the port name and this is how
- DCMD-HANDLER finds the port. DCMD-HANDLER then sets up the public
- port to signal it as messages come in.
-
- Whenever an ACTION_WRITE occurs DCMD-HANDLER does a Write() to the
- monitor file before allowing the packet to resume its journey to the
- console handler. Whenever an ACTION_READ occurs DCMD-HANDLER routes
- the reply port to itself then immediately sends the packet to the
- console device. The packet is returned to DCMD-HANDLER which then
- Write()s the read data to the monitor file as well before returning
- the packet to the originator of the request.
-
- DCMD and DCMD-HANDLER communicate and handshake through the public
- message port via the signals SIGBREAKF_CTRL_D through SIGBREAKF_CTRL_F.
- When exiting, DCMD sends a signal to DCMD-HANDLER requesting it to
- exit, waits for the handshake, and then restore the cli.
-
- DCMD-HANDLER uses the _main entry point which, under DICE, does not
- attempt to interpret any passed arguments or whether the process is
- CLI or WORKBENCH based, but does initialize all data and BSS and
- opens both the exec and DOS libraries.
-
-
-