home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d2xx / d282 / rcs.lha / RCS / rcs.zoo / rcs / rsbx.lib / childstatus.c next >
C/C++ Source or Header  |  1989-11-04  |  2KB  |  71 lines

  1. /****** rsbx.lib/ChildStatus() ***********************************************
  2. *
  3. *   NAME
  4. *    ChildStatus -- Check completion status of child process.
  5. *
  6. *   SYNOPSIS
  7. *    completion = ChildStatus(child, status)
  8. *
  9. *    struct ChildNode *ChildStatus(struct ChildNode *, long *);
  10. *
  11. *   FUNCTION
  12. *    Checks if a child process has completed and sets status to the return
  13. *        code from the child process if it has.
  14. *
  15. *   INPUTS
  16. *    child         - Child process identifier returned from LaunchChildX();
  17. *    status        - Pointer to a long to place the return code from the
  18. *                    child process in.
  19. *
  20. *   RESULT
  21. *    completion    - Child process identifier if child is a child process
  22. *                    of this process and has completed. If child is a child
  23. *                    process of this process and has not completed, then
  24. *            completion is 0 and status is set to 0. If child is
  25. *                    not a child procewss of this process, then completion
  26. *                    is 0 and status will be non-zero.
  27. *
  28. *   NOTES
  29. *
  30. *   SEE ALSO
  31. *    CreateFamily(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
  32. *    OrphanChild(), OrphanChildren(), WaitChild().
  33. *
  34. *   BUGS
  35. *    None known.
  36. *
  37. ******************************************************************************
  38. *
  39. */
  40.  
  41. #include <rsbx/childtasking.h>
  42.  
  43. struct ChildNode *ChildStatus(struct ChildNode *child, long *status)
  44.     {
  45.     struct ChildNode *node;
  46.  
  47.     EmptyMorgue();
  48.  
  49.     for (node = (struct ChildNode *)_Children->ChildList.mlh_Head;
  50.         node->node.mln_Succ;
  51.         node = (struct ChildNode *)node->node.mln_Succ)
  52.         {
  53.         if (node == child)
  54.             {
  55.             if (!child->notice.noticeptr)
  56.                 {
  57.                 *status = child->notice.ret;
  58.                 return child;
  59.                 }
  60.             else
  61.                 {
  62.                 *status = 0;
  63.                 return 0;
  64.                 }
  65.             }
  66.         }
  67.  
  68.     *status = -1;
  69.     return 0;
  70.     }
  71.