Defining a bunch of functions just to update the term title is
ridiculous.

--- src/etc/ksh.kshrc.orig      Fri Oct 29 21:40:51 2010
+++ src/etc/ksh.kshrc   Fri Oct 29 21:51:48 2010
@@ -45,16 +45,7 @@
        HOSTNAME=${HOSTNAME:-`uname -n`}
        HOST=${HOSTNAME%%.*}
 
-       PROMPT="$USER:!$PS1S"
-       #PROMPT="<$u...@$host:!>$PS1S"
-       PPROMPT='$USER:$PWD:!'"$PS1S"
-       #PPROMPT='<$u...@$host:$PWD:!>'"$PS1S"
-       PS1=$PPROMPT
-       # $TTY is the tty we logged in on,
-       # $tty is that which we are in now (might by pty)
-       tty=`tty`
-       tty=`basename $tty`
-       TTY=${TTY:-$tty}
+       PS1='\...@\h:\w \$ '
 
        set -o emacs
 
@@ -70,82 +61,29 @@
                ;;
        esac
        case "$TERM" in
-       sun*-s)
-               # sun console with status line
-               if [ "$tty" != "$console" ]; then
-                       # ilabel
-                       ILS='\033]L'; ILE='\033\\'
-                       # window title bar
-                       WLS='\033]l'; WLE='\033\\'
-               fi
+       dtterm*|screen*|rxvt*|xterm*)
+               ILS="\e]1;"
+               ILE="\a"
+               WLS="\e]2;"
+               WLE="\a"
                ;;
-       xterm*)
-               ILS='\033]1;'; ILE='\007'
-               WLS='\033]2;'; WLE='\007'
-               parent="`ps -ax 2>/dev/null | grep $PPID | grep -v grep`"
-               case "$parent" in
-               *telnet*)
-               export TERM=xterms;;
-               esac
+       ''|dumb|vt220)
+               true
                ;;
-       *)      ;;
+       *)
+               if tput hs >/dev/null 2>&1; then
+                       WLS=`tput ts`
+                       WLE=`tput fs`
+               fi
+               ;;
        esac
-       # do we want window decorations?
-       if [ "$ILS" ]; then
-               ilabel () { print -n "${ILS}$*${ILE}">/dev/tty; }
-               label () { print -n "${WLS}$*${WLE}">/dev/tty; }
-
-               alias stripe='label "$u...@$host ($tty) - $PWD"'
-               alias istripe='ilabel "$u...@$host ($tty)"'
-
-               wftp () { ilabel "ftp $*"; "ftp" "$@"; eval istripe; }
-               wcd () { \cd "$@" && eval stripe; }
-               wssh ()
-               {
-                       local rc
-                       "ssh" "$@"
-                       rc=$?
-                       eval istripe
-                       eval stripe
-                       return $rc
-               }
-               wtelnet ()
-               {
-                       local rc
-                       "telnet" "$@"
-                       rc=$?
-                       eval istripe
-                       eval stripe
-                       return $rc
-               }
-               wrlogin ()
-               {
-                       local rc
-                       "rlogin" "$@"
-                       rc=$?
-                       eval istripe
-                       eval stripe
-                       return $rc
-               }
-               wsu ()
-               {
-                       local rc
-                       "su" "$@"
-                       rc=$?
-                       eval istripe
-                       eval stripe
-                       return $rc
-               }
-               alias su=wsu
-               alias cd=wcd
-               alias ftp=wftp
-               alias ssh=wssh
-               alias telnet=wtelnet
-               alias rlogin=wrlogin
-               eval stripe
-               eval istripe
-               PS1=$PROMPT
+       if [ -n "$ILS" ]; then
+               PS1="$ps1\[$il...@\h$ile\]"
        fi
+       if [ -n "$WLS" ]; then
+               PS1="$ps1\[$wl...@\h \w$WLE\]"
+       fi
+       unset ILS ILE WLS WLE
        alias quit=exit
        alias cls=clear
        alias logout=exit

Reply via email to