#include <arpbase.h>
#include <arp_proto.h>
#include "Launch.h"
#include "LaunchPriv.h"


/*
 *	NAME
 *		IsParent -- verifies if the process is a parent to another one.
 *
 *	SYNOPSIS
 *		pp = IsParent (Proc)
 *
 *		struct ProcPair *IsParent (struct Process *);
 *
 *	FUNCTION
 *		Check if the process has started a child process and if the
 *		child is still active.
 *
 *	DESCRIPTION
 *		Scan the process pair linked list for a pair which is has the
 *		input process as the parent.  If it find one, return a pointer
 *		to it.
 *
 *	INPUT
 *		Proc - a pointer to the process to be checked.
 *
 *	OUTPUT
 *		pp - a ProcPair structure pointer.
 *
 *	NOTE
 *		Assume Forbid() has been called to make sure the list is not
 *		modified while we scan it.
 *
 *	HISTORY
 *		1992/09/06	Pierre Baillargeon		Creation
 *
 *	SEE ALSO
 *		IsChild()
 */

struct ProcPair *IsParent (struct Process *Proc)
{
	struct ProcPair *pp;
	if (NULL != ProcPairList)
	{
		for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
		{
			if (Proc == pp->pp_Parent)
				return pp;
		}
	}
	return NULL;
}
