home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / PCWAIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  1.4 KB  |  50 lines

  1. /**
  2. *
  3. * Name        pcwait -- Return a child program's exit code
  4. *
  5. * Synopsis    excode = pcwait(pret_type);
  6. *
  7. *        int excode      Returned exit code
  8. *        int *pret_type      The manner of exit from the invoked
  9. *                  process.  The values are:
  10. *                  0 - Normal Termination (excode is valid)
  11. *                  1 - Ctrl/Break
  12. *                  2 - Critical Device Error
  13. *                  3 - Terminated using DOS function 0x31
  14. *                      (terminate but stay resident).
  15. *
  16. * Description    This function returns the exit code which is set by
  17. *        PCEXIT in an invoked process (one called using PCEXEC).
  18. *        The manner in which the the child process terminated is
  19. *        returned as well.  The exit code is returned only once;
  20. *        subsequent calls to PCWAIT return zero values.
  21. *
  22. * Returns    excode          The value of the exit code, a number
  23. *                  between 0 and 255 set by PCEXIT.
  24. *        *pret_type      An integer indicating the manner
  25. *                  of exit.  The values are:
  26. *                  0 - Normal Termination (excode is valid)
  27. *                  1 - Ctrl/Break
  28. *                  2 - Critical Device Error
  29. *                  3 - Terminated using DOS function 0x31
  30. *                      (terminate but stay resident).
  31. *
  32. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  33. *
  34. **/
  35.  
  36. #include <bprogctl.h>
  37. #include <butility.h>
  38.  
  39. int pcwait(pret_type)
  40. int *pret_type;
  41. {
  42.     DOSREG dos_reg;
  43.  
  44.     dos_reg.ax = 0x4d00;          /* Function call 0x4D          */
  45.     dos(&dos_reg);
  46.     *pret_type = uthibyte(dos_reg.ax);
  47.  
  48.     return((int)utlobyte(dos_reg.ax));
  49. }
  50.