home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name pcwait -- Return a child program's exit code
- *
- * Synopsis excode = pcwait(pret_type);
- *
- * int excode Returned exit code
- * int *pret_type The manner of exit from the invoked
- * process. The values are:
- * 0 - Normal Termination (excode is valid)
- * 1 - Ctrl/Break
- * 2 - Critical Device Error
- * 3 - Terminated using DOS function 0x31
- * (terminate but stay resident).
- *
- * Description This function returns the exit code which is set by
- * PCEXIT in an invoked process (one called using PCEXEC).
- * The manner in which the the child process terminated is
- * returned as well. The exit code is returned only once;
- * subsequent calls to PCWAIT return zero values.
- *
- * Returns excode The value of the exit code, a number
- * between 0 and 255 set by PCEXIT.
- * *pret_type An integer indicating the manner
- * of exit. The values are:
- * 0 - Normal Termination (excode is valid)
- * 1 - Ctrl/Break
- * 2 - Critical Device Error
- * 3 - Terminated using DOS function 0x31
- * (terminate but stay resident).
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bprogctl.h>
- #include <butility.h>
-
- int pcwait(pret_type)
- int *pret_type;
- {
- DOSREG dos_reg;
-
- dos_reg.ax = 0x4d00; /* Function call 0x4D */
- dos(&dos_reg);
- *pret_type = uthibyte(dos_reg.ax);
-
- return((int)utlobyte(dos_reg.ax));
- }