home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk408.lzh / DCmd / dcmd.doc < prev    next >
Text File  |  1990-11-21  |  4KB  |  93 lines

  1.  
  2.                 DCMD.DOC
  3.                  V1.00
  4.  
  5.                   Matthew Dillon
  6.  
  7.     DCMD is utility that monitors a CLI's console IO and copies it to
  8.     a user specified file.  The console IO is unaffected by this
  9.     monitoring.
  10.  
  11.     DCMD has one dangerous problem... there is no way for the monitoring
  12.     handler to know when there are no more references to its dummy device
  13.     port.  Thus, when you start a monitoring session with DCMD, you must
  14.     NEVER END THE SESSION UNTIL all programs that were *ever* run by the
  15.     shell being monitored have exited.    UNDER NO CIRCUMSTANCES MAY YOU
  16.     START A PROGRAM IN THE BACKGROUND AND THEN EXIT DCMD.  Programs which
  17.     detach themselves and otherwise have no references to the console
  18.     device are safe to leave running.
  19.  
  20.     I suggest that you always specify a file in RAM:, in case of crash.
  21.     DCMD munches on the innards of DOS and there is no guarentee that it
  22.     will be compatible with everything.
  23.  
  24.     DCMD consists of two programs:
  25.     DCMD
  26.     L:DCMD-HANDLER
  27.  
  28.     To start a session type DCMD <filename>, where <filename> is the file
  29.     to hold the monitored IO.  In almost all cases you will want to specify
  30.     a file in RAM:, especially because you can type or edit the file while
  31.     DCMD is writing to it.  If on a floppy or an HD the file can be read
  32.     only to the point of the last sync (see below).
  33.  
  34.     1> DCMD <filename>        start a monitoring session, the file is
  35.                 appended to.  If DCMD needs to create the
  36.                 file, it will close-reopen it in shared
  37.                 mode.
  38.  
  39.     1> DCMD            end a monitoring session
  40.  
  41.     1> DCMD sync        (or SYNC), forces DCMD to close-reopen the
  42.                 file, used when the file is not placed in
  43.                 the RAM: disk to allow reading of the file
  44.                 up the current point.
  45.  
  46.                 EXAMPLE SESSION
  47.  
  48.     1> DCMD T:test.out
  49.     BEGIN DCMD002EC4C0.PORT Fri Oct 12 14:34:51 1990
  50.     1> ECHO Hello
  51.     Hello
  52.     1> DIR T:
  53.       ...
  54.     1> DCMD
  55.     DCMD ended
  56.  
  57.     1> TYPE T:test.out
  58.        (your entire session is printed verbatim)
  59.  
  60.     Source to DCMD is included and compiles under DICE.  The code should be
  61.     easily portable to other compilers.
  62.  
  63.                 OPERATION
  64.  
  65.     DCMD creates a public message port named after the CLI process it is to
  66.     monitor, then redirects the console handler and current input and
  67.     output file handles for the CLI through this public port.
  68.  
  69.     DCMD then loads and runs DCMD-HANDLER as a separate processs.
  70.     DCMD-HANDLER's task name is the same as the port name and this is how
  71.     DCMD-HANDLER finds the port.  DCMD-HANDLER then sets up the public
  72.     port to signal it as messages come in.
  73.  
  74.     Whenever an ACTION_WRITE occurs DCMD-HANDLER does a Write() to the
  75.     monitor file before allowing the packet to resume its journey to the
  76.     console handler.  Whenever an ACTION_READ occurs DCMD-HANDLER routes
  77.     the reply port to itself then immediately sends the packet to the
  78.     console device.  The packet is returned to DCMD-HANDLER which then
  79.     Write()s the read data to the monitor file as well before returning
  80.     the packet to the originator of the request.
  81.  
  82.     DCMD and DCMD-HANDLER communicate and handshake through the public
  83.     message port via the signals SIGBREAKF_CTRL_D through SIGBREAKF_CTRL_F.
  84.     When exiting, DCMD sends a signal to DCMD-HANDLER requesting it to
  85.     exit, waits for the handshake, and then restore the cli.
  86.  
  87.     DCMD-HANDLER uses the _main entry point which, under DICE, does not
  88.     attempt to interpret any passed arguments or whether the process is
  89.     CLI or WORKBENCH based, but does initialize all data and BSS and
  90.     opens both the exec and DOS libraries.
  91.  
  92.  
  93.