# $RCSfile: user,v $
# $Revision: 1.3 $
# $Name:  $
# $Date: 2009/01/13 16:59:17 $
# $Author: agibert $

# EnvMng Environment configuration
#
# description: User configuration
#-------------------------------------------------------------------------------

case "$1" in
	*profile)
		#----------------------------------------------------------------------------
		# PATH definitions
		#----------------------------------------------------------------------------
		   path=.:~/bin
		libpath=~/lib
		manpath=~/man

		export       PATH=$(envmng_path_add       "$PATH"       "$path")
		export SHLIB_PATH=$(envmng_path_add "$SHLIB_PATH" "$shlib_path")
		export    MANPATH=$(envmng_path_add    "$MANPATH"   "$man_path")

		if $( which xemacs >/dev/null )
		then
			export EDITOR=xemacs
		else
			export EDITOR=vi
		fi

		if $( which less >/dev/null )
		then
			export PAGER=less
		else
			export PAGER=more
		fi

		set -o emacs
#		set -o vi
	;;

	*rc)
                tty_bold="$(tput bold)"
                 tty_off="$(tput rmso)"
                  tty_c1="$(tput setf 1)"
                  tty_c2="$(tput setf 2)"
                  tty_c3="$(tput setf 3)"
                  tty_c4="$(tput setf 4)"
                  tty_c5="$(tput setf 5)"
                  tty_c6="$(tput setf 6)"
                  tty_c7="$(tput setf 7)"

                case $shell in
                        *bash)
                                tty_bold="\[${tty_bold}\]"
                                 tty_off="\[${tty_off}\]"
                                  tty_c1="\[${tty_c1}\]"
                                  tty_c2="\[${tty_c2}\]"
                                  tty_c3="\[${tty_c3}\]"
                                  tty_c4="\[${tty_c4}\]"
                                  tty_c5="\[${tty_c5}\]"
                                  tty_c6="\[${tty_c6}\]"
                                  tty_c7="\[${tty_c7}\]"
                        ;;

                        *ksh)
                        ;;
                esac

#		export PS1="$(hostname)(\$LOGNAME)[\$ENVMNG_ID]\$PWD> "
#		export PS1="${tty_c1}> ${tty_c3}"
		export PS1="${tty_bold}${tty_c3}$(hostname)${tty_c1}(${tty_c4}\$LOGNAME${tty_c1})${tty_c3}[${tty_c6}\$ENVMNG_ID${tty_c3}]${tty_c2}\$PWD${tty_c3}>${tty_off} "

		alias env-migtt2='envmng -S migtt2-gnu'
		alias env-dtarget='envmng -S dtarget-gnu'
		alias env-d2target='envmng -S d2target-gnu'
		alias env-ksh='envmng --ksh'
		alias env-bash='envmng --bash'

		set -o emacs
#		set -o vi
	;;

	*)
		echo "$0: Invalid command: [$1] !"
	;;
esac

if [ -f ~/.envmng_user ]
then
	case "$1" in
		*profile)
			echo "envmng: profiling [user:$LOGNAME]..."
		;;

		*rc)
			echo "envmng: rcing [user:$LOGNAME]..."
		;;
	esac

	. ~/.envmng_user $1
fi

echo
