home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / os2exec1.zip / OS2EXEC.DOC < prev    next >
Text File  |  1993-12-07  |  5KB  |  184 lines

  1. ===============================================================================
  2. os2exec.doc   EXECUTING OS/2 PROGRAMS FROM DOS SESSION      1.1b    07-Dec-1993
  3. ===============================================================================
  4.                                      Copyright (c) 1992-1993 by Eberhard Mattes
  5.  
  6. Files
  7. -----
  8.  
  9. os2exec.doc     This file
  10. os2exec.c       Source for os2exec.exe
  11. os2exec.exe     DOS program to execute OS/2 programs
  12. os2execd.c      Source for os2execd.exe
  13. os2execd.exe    OS/2 program which receives requests from DOS programs
  14. makefile        Makefile for compiling the two programs
  15.  
  16.  
  17. Copyright
  18. ---------
  19.  
  20. os2exec and os2execd are copyright (c) 1992-1993 by Eberhard Mattes.
  21. All rights are reserved.  Copying of these files is authorized only if
  22. (1) you are Eberhard Mattes, or if
  23. (2) you make absolutely no changes to your copy, or
  24. (3) you rename os2execd and os2exec and change the name of the named
  25.     pipe to something different from \pipe\os2exec.em
  26.  
  27. These restrictions are required to ensure that existing applications
  28. continue to work if you change os2execd.
  29.  
  30.  
  31. No Warranty
  32. -----------
  33.  
  34. NO WARRANTY: No guarantee is made as to the proper functioning of the
  35. software.  No liability will be admitted for damage resulting from
  36. using the software.
  37.  
  38.  
  39. Usage
  40. -----
  41.  
  42. Run
  43.  
  44.   os2execd
  45.  
  46. in a OS/2 session.  The following command line options are available:
  47.  
  48.   -s  switch windows (make the os2execd session active when executing
  49.       a command, switch back after executing the command).  os2exec
  50.       can override this option
  51.  
  52.   -v  verbose mode (display information for debugging)
  53.  
  54.  
  55. Type
  56.  
  57.   os2exec <command>
  58.  
  59. in a DOS session to let os2execd execute the OS/2 command <command> by
  60. invoking CMD.EXE.  All environment variables with the exception of
  61. COMSPEC, PROMPT and PATH are passed to the OS/2 session.  You can
  62. precede <command> with the following options:
  63.  
  64.   -o    redirect standard output and standard error of the OS/2
  65.         command to standard output of os2exec.  You'll see the output
  66.         of the OS/2 program in the DOS session
  67.  
  68.   -sn   don't switch windows; this option temporarily turns off the -s
  69.         option of os2execd
  70.  
  71.   -sy   do switch windows; this option temporarily turns on the -s
  72.         option of os2execd
  73.  
  74.   -x    don't call CMD.EXE, execute the program directly instead
  75.  
  76. Example:
  77.  
  78.   os2exec -x -sy editor myfile.txt
  79.  
  80. Type
  81.  
  82.   os2exec -q
  83.  
  84. in a DOS session to make os2execd quit.
  85.  
  86.  
  87. If one os2execd is running, only one DOS program at a time can connect
  88. to os2execd.  To allow for more DOS programs connecting to os2execd,
  89. run multiple instances of os2execd.
  90.  
  91.  
  92. Programming Interface
  93. ---------------------
  94.  
  95. If you want to write a DOS program which uses os2execd, here's what
  96. you have to do:
  97.  
  98.   - open a file named \pipe\os2exec.em in read/write mode
  99.  
  100.   - send messages
  101.  
  102.   - wait for response
  103.  
  104.   - close the file
  105.  
  106. Messages start with two bytes indicating the length of the message.
  107. These two bytes are not included in the length.  The low-order byte of
  108. the length is sent first.
  109.  
  110. The third byte of a message is a command character.  The following
  111. commands are available:
  112.  
  113.   A  Acknowledge for return code
  114.  
  115.   C  Execute command by CMD.EXE: command
  116.  
  117.   E  Send environment variable: name=value
  118.  
  119.   O  Send standard output and standard error of the next command
  120.  
  121.   Q  Stop os2execd.  You should wait for acknowledge before closing
  122.      the file
  123.  
  124.   S  Turn switching windows on or off (override the -s option of
  125.      os2exec).  The argument should be one character:
  126.  
  127.         D  revert to the setting of -s given on the command line of
  128.            os2execd (this is done automatically when estabilish a new
  129.            connection)
  130.  
  131.         N  turn -s off
  132.  
  133.         Y  turn -s on
  134.  
  135.   W  Set working directory: directory or d:directory
  136.  
  137.   X  Execute command directly: command
  138.  
  139. Starting at the forth byte the argument (see list above, the command
  140. is shown after the colon) should be sent.
  141.  
  142. os2execd sends back a response for the C and X commands using the same
  143. length/command/arguments format.  The following command bytes are
  144. defined:
  145.  
  146.   A  Acknowledge for Q command
  147.  
  148.   O  Output from the program; the argument contains the output (up to
  149.      256 bytes at a time)
  150.  
  151.   R  Program executed: return code (or -1 if failed)
  152.  
  153.  
  154. History
  155. -------
  156.  
  157. 1.1a:
  158.   os2exec: Add -o, -sn and -sy options
  159.   os2execd: Handle O request
  160.  
  161. 1.1b:
  162.   os2execd: Fix handle leak
  163.   Don't print \n when output is redirected to DOS client
  164.  
  165.  
  166. The Author
  167. ----------
  168.  
  169. The author of os2exec and os2execd is:
  170.  
  171.   Eberhard Mattes
  172.   Teckstraße 81
  173.   D-71696 Möglingen
  174.   Germany
  175.  
  176.   Internet: mattes@azu.informatik.uni-stuttgart.de        (subject to change)
  177.  
  178. No telephone calls please! It must be stressed that the author does
  179. not reply to letters if you don't include return postage
  180. (international postal reply coupon if you're outside Germany) and a
  181. self-addressed envelope.
  182.  
  183.                                   -- END --
  184.