#!/bin/sh
#
# @(#)getpath.sh	1.1 7/20/93 09:55:03 - Elan Computer Group, Inc. (c) 1993
#
# Find full path to this program and set:
#
#	PROG_FULLPATH - Full path to this program
#
basename()
{
	AZzz=${1-.}
	AZzz=`expr //$AZzz : "\(.*\)\/$" \| $AZzz`
	BZzz=`expr //$AZzz : '.*/\(.*\)'`
	expr $BZzz : "\(.*\)$2$" \| $BZzz
}

dirname()
{
	expr ${1-.}'/' : '\(/\)[^/]*/$' \
	\| ${1-.}'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \
	\| .
}

FindPathDir()
{
	(IFS=':';
	for DIR in $PATH
	do
		if [ -x "$DIR/$1" ]; then
			echo "$DIR"
			return;
		fi
	done
	echo .
	)
}


PROG=$0

case "$PROG" in

	*/*)	PROG_DIR=`dirname $PROG`;;

	*)	PROG_BASE=`basename $PROG`
		PROG_DIR=`FindPathDir $PROG_BASE`
		;;
esac

PROG_FULLPATH=`(cd $PROG_DIR; pwd)`

echo $PROG_FULLPATH
