changeset 527:cb4e2a6595ea

Add ksh support.
author edogawaconan <me@myconan.net>
date Mon, 15 Sep 2014 14:46:50 +0900
parents f579b5310a1b
children 92eb89781346
files rc/kshrc rc/shellinit-posix setup
diffstat 3 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/kshrc	Mon Sep 15 14:46:50 2014 +0900
@@ -0,0 +1,5 @@
+#!/bin/ksh
+
+# This is mainly for OpenBSD
+
+. "${HOME}/.ec.shellinit-posix"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/shellinit-posix	Mon Sep 15 14:46:50 2014 +0900
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+_os="$(uname)"
+
+export LANG="en_US.UTF-8"
+export LC_CTYPE="en_US.UTF-8"
+# The en_US.UTF-8 causes weird sorting.
+# (not really, but I prefer C based sort.)
+export LC_COLLATE=C
+export LC_MESSAGES=C
+
+if command -v tmux > /dev/null 2>&1; then
+  case "${_os}" in
+  OpenBSD)
+    # FIXME: OpenBSD version check
+    _tmux_conf_ver=1.9
+  ;;
+  *)
+    case "$(tmux -V 2> /dev/null)" in
+    "tmux 1."[1-9][0-9]*|"tmux 1.9"*) _tmux_conf_ver=1.9;;
+    "tmux 1."[4-8]*) _tmux_conf_ver=1.4;;
+    *) _tmux_conf_ver=1.3;;
+    esac
+  ;;
+  esac
+  alias tmux="tmux -f '""${HOME}""/.tmux-""${_tmux_conf_ver}"".conf'"
+  unset _tmux_conf_ver
+fi
+
+if command -v vim > /dev/null 2>&1; then
+  alias vi=vim
+  export EDITOR=vim
+fi
+
+if command -v less > /dev/null 2>&1; then
+  export PAGER=less
+  export LESS=-FMRXginsz-2
+fi
+
+unset _os
--- a/setup	Sat Aug 09 00:24:45 2014 +0900
+++ b/setup	Mon Sep 15 14:46:50 2014 +0900
@@ -57,6 +57,15 @@
   esac
 }
 
+_ksh() {
+  case "${1}" in
+    uninstall|install)
+      _rc "${1}" "kshrc" ".ec.ksh"
+      _init "${1}" '[ -r "${HOME}/.ec.ksh" ] && . "${HOME}/.ec.ksh" #ECCORE_KSH' ".profile"
+    ;;
+  esac
+}
+
 _zsh() {
   case "${1}" in
     uninstall|install)
@@ -150,7 +159,9 @@
   install|uninstall)
     _tcsh "${1}"
     _bash "${1}"
+    _ksh "${1}"
     _zsh "${1}"
+    _rc "${1}" "shellinit-posix" ".ec.shellinit-posix"
     _rc "${1}" "../bin" ".ecos_bin"
     _rc "${1}" "gemrc" ".gemrc"
     _rc "${1}" "gitconfig" ".gitconfig"