#!/bin/sh
#
#	NAME
#		add_xp_bin
#
#	SYNOPSIS
#		add_xp_bin
#
#	DESCRIPTION
#		A startup script to be used to prepend the user's path with
# 		the TEKXP_BIN directory (default /usr/lib/X11/XP/bin).  If
#		the script is sourced, it also sets the TEKXP_ROOT and
#		TEKXP_BIN environment variables, if not already defined.
#
#		The system administrator or user may add $TEKXP_BIN
#		to their path so that they can access xmodmap and
#		xsetprop.  They can run this script to accomplish this.
#		If they do not add this directory, XPstartup, via this
#		script, will add it to the beginning of their path.
#		However, the scripts do not assume that the user's path
#		includes the XP bin directory; XPkeymap looks for the
#		environment variable TEKXP_BIN which points to a
#		site-defined directory for TEKXP programs, else uses the
#		common bin directory configured during V4 tape install.
#		The TEKXP_BIN variable allows using one XP tree with
#		multiple host binaries on a file server in a heterogeneous
#		network.  If the xsetprop utility cannot be found in the
#		Tekxp bin directory, we fall back to the user's path,
#		assume that the xsetprop and Tek xmodmap utilities are not
#		available, and skip the system and keyboard-dependent site
#		keymap file loading.
#
#	ENVIRONMENT VARIABLES
#	    TEKXP_ROOT
#	        contains the path to the XP directory tree that
#	        contains the following files.  Default is
#	        "/usr/lib/X11/XP".
#	    XP_ROOT
#	        Old equivalent of TEKXP_ROOT used in V3 XPstartup;
#	        "/usr/lib/X11".  Overridden by TEKXP_ROOT.
#	    PATH
#	        Must include the host-supplied X bin directory, to obtain
#		the xterm and xrdb programs.  Other X utilities are obtained
#	        from $TEKXP_BIN, else $TEKXP_ROOT/bin.  Programs in
#	        $TEKXP_ROOT/bin are linked at installation to one of 4300,
#	        XD88, hp, mips, risc_ultrix, sco, sun3, sun4, or vax_ultrix.
#		XPstartup is not supported on vms.
#	    TEKXP_BIN
#	        Points to a site-defined directory for TEKXP programs,
#	        so that one file server can support sessions on multiple
#		types of hosts.  If not defined, $TEKXP_ROOT/bin is used.
#
#	RCS VERSION
#		$Header: /tmp_mnt/vol/nwd/tools/media/X11/XP/bin/RCS/add_xp_bin,v 1.1 1991/05/29 15:56:07 glennw Exp $
#

if [ ! "$TEKXP_ROOT" ]
then
    if [ "$XP_ROOT" ]
    then
    	# XP_ROOT is the old variable set to /usr/lib/X11.
    	TEKXP_ROOT=$XP_ROOT/XP
    else
	TEKXP_ROOT=/usr/lib/X11/XP
    fi
    export TEKXP_ROOT
fi

if [ ! "$TEKXP_BIN" ]
then
    TEKXP_BIN=$TEKXP_ROOT/bin
    export TEKXP_BIN
fi
#
# Add $TEKXP_BIN to user's path if it or some specific bin/<host>
# directory is not there already.
#
if  [ "`echo $PATH | fgrep \\$TEKXP_BIN`" = "" -a \
      "`echo $PATH | fgrep $TEKXP_BIN`" = "" ]
then
    PATH="$TEKXP_BIN:`echo $PATH`"
    export PATH
fi
