OSDN Git Service

Upgrade to mksh R52b.
[android-x86/external-mksh.git] / src / dot.mkshrc
index 4c64395..ab13f9d 100644 (file)
@@ -1,9 +1,9 @@
 # $Id$
-# $MirOS: src/bin/mksh/dot.mkshrc,v 1.100 2015/07/10 19:36:33 tg Exp $
+# $MirOS: src/bin/mksh/dot.mkshrc,v 1.104 2015/12/31 21:00:12 tg Exp $
 #-
 # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
 #              2011, 2012, 2013, 2014, 2015
-#      Thorsten Glaser <tg@mirbsd.org>
+#      mirabilos <m@mirbsd.org>
 #
 # Provided that these terms and disclaimer and all copyright notices
 # are retained or reproduced in an accompanying document, permission
@@ -40,7 +40,7 @@ PS4='[$EPOCHREALTIME] '; PS1=$'\001\r''${|
        (( e )) && REPLY+="$e|"
        REPLY+=${USER}@${HOSTNAME%%.*}:
 
-       \typeset d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~}
+       \typeset d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/\~}
        \typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
        (( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
        REPLY+=$p$d
@@ -109,7 +109,7 @@ function chpwd {
        DIRSTACK[0]=$(\builtin realpath . 2>/dev/null || \
            \builtin print -r -- "$PWD")
        [[ $DIRSTACKBASE = ?(*/) ]] || \
-           DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~}
+           DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/\~}
        \:
 }
 \chpwd .
@@ -118,7 +118,7 @@ cd() {
        \chpwd "$@"
 }
 function cd_csh {
-       \typeset d t=${1/#~/$DIRSTACKBASE}
+       \typeset d t=${1/#\~/$DIRSTACKBASE}
 
        if ! d=$(\builtin cd "$t" 2>&1); then
                \builtin print -u2 "${1}: ${d##*cd: $t: }."
@@ -148,7 +148,7 @@ function dirs {
                fv=0
                while (( fv < ${#DIRSTACK[*]} )); do
                        d=${DIRSTACK[fv]}
-                       (( fl )) && d=${d/#~/$DIRSTACKBASE}
+                       (( fl )) && d=${d/#\~/$DIRSTACKBASE}
                        \builtin print -r -- "$fv       $d"
                        \builtin let fv++
                done
@@ -156,7 +156,7 @@ function dirs {
                fv=0
                while (( fv < ${#DIRSTACK[*]} )); do
                        d=${DIRSTACK[fv]}
-                       (( fl )) && d=${d/#~/$DIRSTACKBASE}
+                       (( fl )) && d=${d/#\~/$DIRSTACKBASE}
                        (( dwidth = (${%d} > 0 ? ${%d} : ${#d}) ))
                        if (( fn && (cpos += dwidth + 1) >= 79 && \
                            dwidth < 80 )); then
@@ -384,7 +384,11 @@ function Lstripcom {
 
 # give MidnightBSD's laffer1 a bit of csh feeling
 function setenv {
-       \eval "'export' \"$1\""'="$2"'
+       if (( $# )); then
+               \eval '\export "$1"="${2:-}"'
+       else
+               \typeset -x
+       fi
 }
 
 # toggle built-in aliases and utilities, and aliases and functions from mkshrc
@@ -406,9 +410,6 @@ function enable {
        i_alias[nalias]=nameref; b_alias[nalias++]='\typeset -n'
        i_alias[nalias]=nohup; b_alias[nalias++]='nohup '
        i_alias[nalias]=r; b_alias[nalias++]='\builtin fc -e -'
-       #XXX OS/2
-       i_alias[nalias]=source; b_alias[nalias++]='PATH=$PATH:. \command .'
-       i_alias[nalias]=stop; b_alias[nalias++]='\kill -STOP'
        i_alias[nalias]=type; b_alias[nalias++]='\builtin whence -v'
 
        # accumulate mksh built-in utilities, in definition order, even ifndef
@@ -445,6 +446,7 @@ function enable {
        i_func[nfunc++]=return
        i_func[nfunc++]=set
        i_func[nfunc++]=shift
+       i_func[nfunc++]=source
        i_func[nfunc++]=suspend
        i_func[nfunc++]=test
        i_func[nfunc++]=times
@@ -464,6 +466,7 @@ function enable {
        i_func[nfunc++]=printf
        i_func[nfunc++]=sleep
        i_func[nfunc++]=domainname
+       i_func[nfunc++]=extproc
 
        # accumulate aliases from dot.mkshrc, in definition order
        i_alias[nalias]=l; b_alias[nalias++]='ls -F'
@@ -593,8 +596,8 @@ done
 #\unset LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_IDENTIFICATION LC_MONETARY \
 #    LC_NAME LC_NUMERIC LC_TELEPHONE LC_TIME
 #p=en_GB.UTF-8
-#\set -U
 #\export LANG=C LC_CTYPE=$p LC_MEASUREMENT=$p LC_MESSAGES=$p LC_PAPER=$p
+#\set -U
 
 \unset p