OSDN Git Service

Merge "Remove auto addition of ~/bin subdirectories to the path."
[android-x86/external-mksh.git] / mkshrc
diff --git a/mkshrc b/mkshrc
index 6d135a3..731ee9a 100644 (file)
--- a/mkshrc
+++ b/mkshrc
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2012, 2013
+# Copyright (c) 2010, 2012, 2013, 2014
 #      Thorsten Glaser <tg@mirbsd.org>
 # This file is provided under the same terms as mksh.
 #-
@@ -6,8 +6,16 @@
 #
 # Support: https://launchpad.net/mksh
 
-: ${TERM:=vt100} ${HOME:=/data} ${MKSH:=/system/bin/sh} ${HOSTNAME:=$(getprop ro.product.device)}
-: ${SHELL:=$MKSH} ${USER:=$(typeset x=$(id); x=${x#*\(}; print -r -- ${x%%\)*})} ${HOSTNAME:=android}
+: ${HOME:=/data}
+: ${HOSTNAME:=$(getprop ro.product.device)}
+: ${HOSTNAME:=android}
+: ${MKSH:=/system/bin/sh}
+: ${SHELL:=$MKSH}
+: ${TERM:=xterm}
+: ${TMPDIR:=/data/local/tmp}
+: ${USER:=$(id -un)}
+export HOME HOSTNAME MKSH SHELL TERM TMPDIR USER
+
 if (( USER_ID )); then PS1='$'; else PS1='#'; fi
 PS4='[$EPOCHREALTIME] '; PS1='${|
        local e=$?
@@ -16,11 +24,6 @@ PS4='[$EPOCHREALTIME] '; PS1='${|
 
        return $e
 }$USER@$HOSTNAME:${PWD:-?} '"$PS1 "
-export HOME HOSTNAME MKSH SHELL TERM USER
-alias l='ls'
-alias la='l -a'
-alias ll='l -l'
-alias lo='l -a -l'
 
 function hd {
        local -Uui16 -Z11 pos=0
@@ -28,7 +31,7 @@ function hd {
        local dasc line i
 
        cat "$@" | { set +U; if read -arN -1 line; then
-               typeset -i1 line
+               typeset -i1 'line[*]'
                i=0
                while (( i < ${#line[*]} )); do
                        hv=${line[i++]}
@@ -53,32 +56,6 @@ function hd {
        fi; }
 }
 
-function more {
-       local dummy line llen curlin=0
-
-       cat "$@" | while IFS= read -r line; do
-               llen=${%line}
-               (( llen == -1 )) && llen=${#line}
-               (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
-               if (( (curlin += llen) >= LINES )); then
-                       print -n -- '\033[7m--more--\033[0m'
-                       read -u1 dummy
-                       [[ $dummy = [Qq]* ]] && return 0
-                       curlin=$llen
-               fi
-               print -r -- "$line"
-       done
-}
-
 function setenv {
        eval export "\"$1\""'="$2"'
 }
-
-for p in ~/.bin; do
-       [[ -d $p/. ]] || continue
-       [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH
-done
-
-unset p
-
-: place customisations above this line