- if ! toe $TOEOPT|grep -q "^$TERM "; then
- # if it doesn't, try to switch
- case $TERM in
- rxvt*)
- TERM="rxvt"
- ;;
- xterm*)
- TERM="xterm"
- ;;
- *)
- ;;
- esac
- export TERM;
+ if [[ "$TERM" =~ "stterm-" ]] && which tput >/dev/null 2>&1; then
+ if [[ -z "$(tput longname 2>/dev/null)" ]]; then
+ TERM="xterm-${TERM##stterm-}"
+ export TERM
+ fi;