home *** CD-ROM | disk | FTP | other *** search
- ===============================================================================
- os2exec.doc EXECUTING OS/2 PROGRAMS FROM DOS SESSION 1.1b 07-Dec-1993
- ===============================================================================
- Copyright (c) 1992-1993 by Eberhard Mattes
-
- Files
- -----
-
- os2exec.doc This file
- os2exec.c Source for os2exec.exe
- os2exec.exe DOS program to execute OS/2 programs
- os2execd.c Source for os2execd.exe
- os2execd.exe OS/2 program which receives requests from DOS programs
- makefile Makefile for compiling the two programs
-
-
- Copyright
- ---------
-
- os2exec and os2execd are copyright (c) 1992-1993 by Eberhard Mattes.
- All rights are reserved. Copying of these files is authorized only if
- (1) you are Eberhard Mattes, or if
- (2) you make absolutely no changes to your copy, or
- (3) you rename os2execd and os2exec and change the name of the named
- pipe to something different from \pipe\os2exec.em
-
- These restrictions are required to ensure that existing applications
- continue to work if you change os2execd.
-
-
- No Warranty
- -----------
-
- NO WARRANTY: No guarantee is made as to the proper functioning of the
- software. No liability will be admitted for damage resulting from
- using the software.
-
-
- Usage
- -----
-
- Run
-
- os2execd
-
- in a OS/2 session. The following command line options are available:
-
- -s switch windows (make the os2execd session active when executing
- a command, switch back after executing the command). os2exec
- can override this option
-
- -v verbose mode (display information for debugging)
-
-
- Type
-
- os2exec <command>
-
- in a DOS session to let os2execd execute the OS/2 command <command> by
- invoking CMD.EXE. All environment variables with the exception of
- COMSPEC, PROMPT and PATH are passed to the OS/2 session. You can
- precede <command> with the following options:
-
- -o redirect standard output and standard error of the OS/2
- command to standard output of os2exec. You'll see the output
- of the OS/2 program in the DOS session
-
- -sn don't switch windows; this option temporarily turns off the -s
- option of os2execd
-
- -sy do switch windows; this option temporarily turns on the -s
- option of os2execd
-
- -x don't call CMD.EXE, execute the program directly instead
-
- Example:
-
- os2exec -x -sy editor myfile.txt
-
- Type
-
- os2exec -q
-
- in a DOS session to make os2execd quit.
-
-
- If one os2execd is running, only one DOS program at a time can connect
- to os2execd. To allow for more DOS programs connecting to os2execd,
- run multiple instances of os2execd.
-
-
- Programming Interface
- ---------------------
-
- If you want to write a DOS program which uses os2execd, here's what
- you have to do:
-
- - open a file named \pipe\os2exec.em in read/write mode
-
- - send messages
-
- - wait for response
-
- - close the file
-
- Messages start with two bytes indicating the length of the message.
- These two bytes are not included in the length. The low-order byte of
- the length is sent first.
-
- The third byte of a message is a command character. The following
- commands are available:
-
- A Acknowledge for return code
-
- C Execute command by CMD.EXE: command
-
- E Send environment variable: name=value
-
- O Send standard output and standard error of the next command
-
- Q Stop os2execd. You should wait for acknowledge before closing
- the file
-
- S Turn switching windows on or off (override the -s option of
- os2exec). The argument should be one character:
-
- D revert to the setting of -s given on the command line of
- os2execd (this is done automatically when estabilish a new
- connection)
-
- N turn -s off
-
- Y turn -s on
-
- W Set working directory: directory or d:directory
-
- X Execute command directly: command
-
- Starting at the forth byte the argument (see list above, the command
- is shown after the colon) should be sent.
-
- os2execd sends back a response for the C and X commands using the same
- length/command/arguments format. The following command bytes are
- defined:
-
- A Acknowledge for Q command
-
- O Output from the program; the argument contains the output (up to
- 256 bytes at a time)
-
- R Program executed: return code (or -1 if failed)
-
-
- History
- -------
-
- 1.1a:
- os2exec: Add -o, -sn and -sy options
- os2execd: Handle O request
-
- 1.1b:
- os2execd: Fix handle leak
- Don't print \n when output is redirected to DOS client
-
-
- The Author
- ----------
-
- The author of os2exec and os2execd is:
-
- Eberhard Mattes
- Teckstraße 81
- D-71696 Möglingen
- Germany
-
- Internet: mattes@azu.informatik.uni-stuttgart.de (subject to change)
-
- No telephone calls please! It must be stressed that the author does
- not reply to letters if you don't include return postage
- (international postal reply coupon if you're outside Germany) and a
- self-addressed envelope.
-
- -- END --
-