# ******************************
# *                            *
# * Custom KSH Initializations *
# *                            *
# ******************************

# Handy title bar and icon decoration for XTERM.  Put the user
# name, host name and current working directory in the title bar.
# This is especially useful because it correctly follows 'rlogin'
# and 'telnet' to other hosts.
#
KSH_USER="`whoami`" ; KSH_HOSTNAME="`hostname`"

if [ "${KSH_USER}" = "root" ] ; then KSH_PROMPT="# "
                                else KSH_PROMPT="${KSH_PROMPT:-$ }"
fi

case ${TERM} in
  xterm*)
    PS1="$(echo '\033]1;${KSH_HOSTNAME%%.*}\007\c')$(echo '\033]2;${KSH_USER} on ${KSH_HOSTNAME%%.*} : ${PWD}\007\r\c')${KSH_PROMPT}"
    ;;

  iris-ansi*)
    PS1="$(echo '\033P3.y${KSH_HOSTNAME%%.*}\033\\\\\c')$(echo '\033P1.y${KSH_USER} on ${KSH_HOSTNAME%%.*} : ${PWD}\033\\\\\r\c')${KSH_PROMPT}"
    ;;

  *)
    unset KSH_HOSTNAME ; unset KSH_USER ; unset KSH_PROMPT
    ;;
esac
