#!/bin/bash
#
# Licensed Materials - Property of IBM 
# @EPEE_PID@
# (C) Copyright IBM Corp. 2008  All Rights Reserved.



###########################################################
# Begin variables and constants
SUCCESS=0
FAILURE=-1
arg1=$1
arg2=$2
declare -i pid=0
# End variables and constants
###########################################################

###########################################################
# Begin isOnlyDigits()
# Method to ensure input argument contains only digits
isOnlyDigits()
{
	[ $# -eq 1 ] || return $FAILURE

	case $1 in
		*[!0-9]*|"") return $FAILURE;;
		*) return $SUCCESS;;
	esac
}
# End isOnlyDigits()
###########################################################

###########################################################
# Begin execution
if isOnlyDigits "$arg1"
then
	pid=$arg1
fi

if (( $pid > 0 ))
then
	typeset pidexist=`ps h $pid | grep $arg2`
	if [ "$pidexist" ]
	then
		# The process exists and is an eclipse process
		retvalue=1
	else
		# The process does not exist
		retvalue=0
	fi
else
	retvalue=-1
fi

exit $retvalue;
# End execution
###########################################################
