diff rc/bashrc @ 506:84ad2517ac90

Refactor terminal-relatd detection in sunos.
author edogawaconan <me@myconan.net>
date Sun, 16 Mar 2014 00:38:30 +0900
parents 072662ced8b8
children cd97af121309
line wrap: on
line diff
--- a/rc/bashrc	Sun Mar 16 00:01:21 2014 +0900
+++ b/rc/bashrc	Sun Mar 16 00:38:30 2014 +0900
@@ -87,6 +87,19 @@
 _grep="grep"
 _has_posix_grep=y
 
+if [ SunOS = "${_os}" ]; then
+  if [ -f /usr/share/lib/terminfo/s/screen ]; then
+    export TERMINFO=/usr/share/lib/terminfo
+  elif [ -f /opt/csw/share/terminfo/s/screen ]; then
+    export TERMINFO=/opt/csw/share/terminfo
+  else
+    unset TERMINFO
+    export TERM=dtterm
+  fi
+
+  [ xterm = "${TERM}" ] && export TERM=xterm-256color
+fi
+
 case "${_os}" in
   Linux)
     _has_gnu_ls=y
@@ -108,25 +121,6 @@
     [ -d /opt/local/share/lib/terminfo ] && export TERMINFO=/opt/local/share/lib/terminfo
     alias ping="ping -s"
     alias ping6="ping -A inet6"
-    # Check if we have sane(?) terminfo, assume broken terminfo otherwise.
-    if [ -z "${TERMINFO}" ]; then
-      # Hello tmux. Perhaps one day we'll have title with dtterm.
-      # But for now we work this around by prepending tmux call with xterm-256color
-      # which hopefully exists. Otherwise we have to live with no title.
-      case "${TERM}" in
-        xterm*)
-          if [ -f "/usr/share/lib/terminfo/x/xterm-256color" ]; then
-            export TERM="xterm-256color"
-          else
-            echo "No xterm-256color terminal, using dtterm. Tmux title won't work."
-            export TERM="dtterm"
-          fi
-        ;;
-        screen)
-          [ -f "/usr/share/lib/terminfo/s/screen" ] || export TERM="dtterm"
-        ;;
-      esac
-    fi
     if command -v ggrep > /dev/null 2>&1; then
       _has_gnu_grep=y
       _grep="ggrep"