X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fdot.mkshrc;h=4c643955ea5352d21ff44b49ddf2f483af1f33be;hb=96b43632c2aa206ac1ec0eb70b34847d58d52633;hp=f65eaa71e733cd98cfb1b6e983c30e4e90ee0c2b;hpb=c87de5d0279a299eec916effc751961347ff5eeb;p=android-x86%2Fexternal-mksh.git diff --git a/src/dot.mkshrc b/src/dot.mkshrc index f65eaa7..4c64395 100644 --- a/src/dot.mkshrc +++ b/src/dot.mkshrc @@ -1,5 +1,5 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.89.2.3 2015/04/12 22:32:22 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.100 2015/07/10 19:36:33 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015 @@ -28,127 +28,129 @@ case ${KSH_VERSION:-} in *) return 0 ;; esac -PS1='#'; (( USER_ID )) && PS1='$'; : "${TERM:=vt100}${HOSTNAME:=$(ulimit -c \ - 0; hostname 2>/dev/null)}${EDITOR:=/bin/ed}${USER:=$(ulimit -c 0; id -un \ - 2>/dev/null || echo \?)}${MKSH:=$(whence -p mksh)}" +PS1='#'; (( USER_ID )) && PS1='$'; \: "${TERM:=vt100}${HOSTNAME:=$(\ulimit -c \ + 0; hostname 2>/dev/null)}${EDITOR:=/bin/ed}${USER:=$(\ulimit -c 0; id -un \ + 2>/dev/null || \echo \?)}${MKSH:=$(\builtin whence -p mksh)}" HOSTNAME=${HOSTNAME%%*([ ]).*}; HOSTNAME=${HOSTNAME##*([ ])} [[ $HOSTNAME = ?(ip6-)localhost?(6) ]] && HOSTNAME= -: "${HOSTNAME:=nil}${MKSH:=/bin/mksh}"; export EDITOR HOSTNAME MKSH TERM USER +\: "${HOSTNAME:=nil}${MKSH:=/bin/mksh}"; \export EDITOR HOSTNAME MKSH TERM USER PS4='[$EPOCHREALTIME] '; PS1=$'\001\r''${| - local e=$? + \typeset e=$? (( e )) && REPLY+="$e|" REPLY+=${USER}@${HOSTNAME%%.*}: - local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~} - local m=${%d} n p=...; (( m > 0 )) || m=${#d} + \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 - return $e + \return $e } '"$PS1 " -alias ls=ls -unalias ls -alias l='ls -F' -alias la='l -a' -alias ll='l -l' -alias lo='l -alo' -alias doch='sudo mksh -c "$(fc -ln -1)"' -command -v rot13 >/dev/null || alias rot13='tr \ +\alias ls=ls +\unalias ls +\alias l='ls -F' +\alias la='l -a' +\alias ll='l -l' +\alias lo='l -alo' +\alias doch='sudo mksh -c "$(\builtin fc -ln -1)"' +\command -v rot13 >/dev/null || \alias rot13='tr \ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \ nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' -if command -v hd >/dev/null; then :; elif command -v hexdump >/dev/null; then +if \command -v hd >/dev/null; then \:; elif \command -v hexdump >/dev/null; then function hd { hexdump -e '"%08.8_ax " 8/1 "%02X " " - " 8/1 "%02X "' \ -e '" |" "%_p"' -e '"|\n"' "$@" } else function hd { - local -Uui16 -Z11 pos=0 - local -Uui16 -Z5 hv=2147483647 - local dasc line i + \typeset -Uui16 -Z11 pos=0 + \typeset -Uui16 -Z5 hv=2147483647 + \typeset dasc line i + \set +U - cat "$@" | { set +U; if read -arN -1 line; then - typeset -i1 'line[*]' + \cat "$@" | if \read -arN -1 line; then + \typeset -i1 'line[*]' i=0 while (( i < ${#line[*]} )); do hv=${line[i++]} if (( (pos & 15) == 0 )); then (( pos )) && \ - print -r -- "$dasc|" - print -n "${pos#16#} " + \builtin print -r -- "$dasc|" + \builtin print -n "${pos#16#} " dasc=' |' fi - print -n "${hv#16#} " + \builtin print -n "${hv#16#} " + #XXX EBCDIC, but we need [[:print:]] to fix this if (( (hv < 32) || (hv > 126) )); then dasc+=. else dasc+=${line[i-1]#1#} fi (( (pos++ & 15) == 7 )) && \ - print -n -- '- ' + \builtin print -n -- '- ' done while (( pos & 15 )); do - print -n ' ' + \builtin print -n ' ' (( (pos++ & 15) == 7 )) && \ - print -n -- '- ' + \builtin print -n -- '- ' done - (( hv == 2147483647 )) || print -r -- "$dasc|" - fi; } + (( hv == 2147483647 )) || \builtin print -r -- "$dasc|" + fi } fi # Berkeley C shell compatible dirs, popd, and pushd functions # Z shell compatible chpwd() hook, used to update DIRSTACK[0] -DIRSTACKBASE=$(realpath ~/. 2>/dev/null || \ - print -nr -- "${HOME:-/}") +DIRSTACKBASE=$(\builtin realpath ~/. 2>/dev/null || \ + \builtin print -nr -- "${HOME:-/}") set -A DIRSTACK function chpwd { - DIRSTACK[0]=$(realpath . 2>/dev/null || \ - print -r -- "$PWD") + DIRSTACK[0]=$(\builtin realpath . 2>/dev/null || \ + \builtin print -r -- "$PWD") [[ $DIRSTACKBASE = ?(*/) ]] || \ DIRSTACK[0]=${DIRSTACK[0]/#$DIRSTACKBASE/~} - : + \: } -chpwd . -function cd { - builtin cd "$@" || return $? - chpwd "$@" +\chpwd . +cd() { + \builtin cd "$@" || \return $? + \chpwd "$@" } function cd_csh { - local d t=${1/#~/$DIRSTACKBASE} + \typeset d t=${1/#~/$DIRSTACKBASE} - if ! d=$(builtin cd "$t" 2>&1); then - print -u2 "${1}: ${d##*cd: $t: }." - return 1 + if ! d=$(\builtin cd "$t" 2>&1); then + \builtin print -u2 "${1}: ${d##*cd: $t: }." + \return 1 fi - cd "$t" + \cd "$t" } function dirs { - local d dwidth - local -i fl=0 fv=0 fn=0 cpos=0 + \typeset d dwidth + \typeset -i fl=0 fv=0 fn=0 cpos=0 - while getopts ":lvn" d; do + while \getopts ":lvn" d; do case $d { (l) fl=1 ;; (v) fv=1 ;; (n) fn=1 ;; - (*) print -u2 'Usage: dirs [-lvn].' - return 1 ;; + (*) \builtin print -u2 'Usage: dirs [-lvn].' + \return 1 ;; } done - shift $((OPTIND - 1)) + \shift $((OPTIND - 1)) if (( $# > 0 )); then - print -u2 'Usage: dirs [-lvn].' - return 1 + \builtin print -u2 'Usage: dirs [-lvn].' + \return 1 fi if (( fv )); then fv=0 while (( fv < ${#DIRSTACK[*]} )); do d=${DIRSTACK[fv]} (( fl )) && d=${d/#~/$DIRSTACKBASE} - print -r -- "$fv $d" - let fv++ + \builtin print -r -- "$fv $d" + \builtin let fv++ done else fv=0 @@ -158,138 +160,138 @@ function dirs { (( dwidth = (${%d} > 0 ? ${%d} : ${#d}) )) if (( fn && (cpos += dwidth + 1) >= 79 && \ dwidth < 80 )); then - print + \builtin print (( cpos = dwidth + 1 )) fi - print -nr -- "$d " - let fv++ + \builtin print -nr -- "$d " + \builtin let fv++ done - print + \builtin print fi - return 0 + \return 0 } function popd { - local d fa - local -i n=1 + \typeset d fa + \typeset -i n=1 - while getopts ":0123456789lvn" d; do + while \getopts ":0123456789lvn" d; do case $d { (l|v|n) fa+=" -$d" ;; (+*) n=2 - break ;; - (*) print -u2 'Usage: popd [-lvn] [+].' - return 1 ;; + \break ;; + (*) \builtin print -u2 'Usage: popd [-lvn] [+].' + \return 1 ;; } done - shift $((OPTIND - n)) + \shift $((OPTIND - n)) n=0 if (( $# > 1 )); then - print -u2 popd: Too many arguments. - return 1 + \builtin print -u2 popd: Too many arguments. + \return 1 elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then - print -u2 popd: Directory stack not that deep. - return 1 + \builtin print -u2 popd: Directory stack not that deep. + \return 1 fi elif [[ -n $1 ]]; then - print -u2 popd: Bad directory. - return 1 + \builtin print -u2 popd: Bad directory. + \return 1 fi if (( ${#DIRSTACK[*]} < 2 )); then - print -u2 popd: Directory stack empty. - return 1 + \builtin print -u2 popd: Directory stack empty. + \return 1 fi - unset DIRSTACK[n] - set -A DIRSTACK -- "${DIRSTACK[@]}" - cd_csh "${DIRSTACK[0]}" || return 1 - dirs $fa + \unset DIRSTACK[n] + \set -A DIRSTACK -- "${DIRSTACK[@]}" + \cd_csh "${DIRSTACK[0]}" || \return 1 + \dirs $fa } function pushd { - local d fa - local -i n=1 + \typeset d fa + \typeset -i n=1 - while getopts ":0123456789lvn" d; do + while \getopts ":0123456789lvn" d; do case $d { (l|v|n) fa+=" -$d" ;; (+*) n=2 - break ;; - (*) print -u2 'Usage: pushd [-lvn] [|+].' - return 1 ;; + \break ;; + (*) \builtin print -u2 'Usage: pushd [-lvn] [|+].' + \return 1 ;; } done - shift $((OPTIND - n)) + \shift $((OPTIND - n)) if (( $# == 0 )); then if (( ${#DIRSTACK[*]} < 2 )); then - print -u2 pushd: No other directory. - return 1 + \builtin print -u2 pushd: No other directory. + \return 1 fi d=${DIRSTACK[1]} DIRSTACK[1]=${DIRSTACK[0]} - cd_csh "$d" || return 1 + \cd_csh "$d" || \return 1 elif (( $# > 1 )); then - print -u2 pushd: Too many arguments. - return 1 + \builtin print -u2 pushd: Too many arguments. + \return 1 elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then - print -u2 pushd: Directory stack not that deep. - return 1 + \builtin print -u2 pushd: Directory stack not that deep. + \return 1 fi while (( n-- )); do d=${DIRSTACK[0]} - unset DIRSTACK[0] - set -A DIRSTACK -- "${DIRSTACK[@]}" "$d" + \unset DIRSTACK[0] + \set -A DIRSTACK -- "${DIRSTACK[@]}" "$d" done - cd_csh "${DIRSTACK[0]}" || return 1 + \cd_csh "${DIRSTACK[0]}" || \return 1 else - set -A DIRSTACK -- placeholder "${DIRSTACK[@]}" - cd_csh "$1" || return 1 + \set -A DIRSTACK -- placeholder "${DIRSTACK[@]}" + \cd_csh "$1" || \return 1 fi - dirs $fa + \dirs $fa } # pager (not control character safe) function smores { ( - set +m - cat "$@" |& - trap "rv=\$?; kill $! >/dev/null 2>&1; exit \$rv" EXIT - while IFS= read -pr line; do + \set +m + \cat "$@" |& + \trap "rv=\$?; 'kill' $! >/dev/null 2>&1; 'exit' \$rv" EXIT + while IFS= \read -pr 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 || exit $? - [[ $REPLY = [Qq]* ]] && exit 0 + \builtin print -n -- '\e[7m--more--\e[0m' + \read -u1 || \exit $? + [[ $REPLY = [Qq]* ]] && \exit 0 curlin=$llen fi - print -r -- "$line" + \builtin print -r -- "$line" done ) } -# base64 encoder and decoder, RFC compliant, NUL safe +# base64 encoder and decoder, RFC compliant, NUL safe, not EBCDIC safe function Lb64decode { - [[ -o utf8-mode ]]; local u=$? c s="$*" t - set +U - [[ -n $s ]] || { s=$(cat; print x); s=${s%x}; } - local -i i=0 j=0 n=${#s} p=0 v x - local -i16 o + \set +U + \typeset c s="$*" t + [[ -n $s ]] || { s=$(\cat; \builtin print x); s=${s%x}; } + \typeset -i i=0 j=0 n=${#s} p=0 v x + \typeset -i16 o while (( i < n )); do c=${s:(i++):1} case $c { - (=) break ;; + (=) \break ;; ([A-Z]) (( v = 1#$c - 65 )) ;; ([a-z]) (( v = 1#$c - 71 )) ;; ([0-9]) (( v = 1#$c + 4 )) ;; (+) v=62 ;; (/) v=63 ;; - (*) continue ;; + (*) \continue ;; } (( x = (x << 6) | v )) case $((p++)) { - (0) continue ;; + (0) \continue ;; (1) (( o = (x >> 4) & 255 )) ;; (2) (( o = (x >> 2) & 255 )) ;; (3) (( o = x & 255 )) @@ -297,26 +299,25 @@ function Lb64decode { ;; } t+=\\x${o#16#} - (( ++j & 4095 )) && continue - print -n $t + (( ++j & 4095 )) && \continue + \builtin print -n $t t= done - print -n $t - (( u )) || set -U + \builtin print -n $t } -set -A Lb64encode_code -- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ +\set -A Lb64encode_tbl -- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + / function Lb64encode { - [[ -o utf8-mode ]]; local u=$? c s t - set +U + \set +U + \typeset c s t if (( $# )); then - read -raN-1 s <<<"$*" - unset s[${#s[*]}-1] + \read -raN-1 s <<<"$*" + \unset s[${#s[*]}-1] else - read -raN-1 s + \read -raN-1 s fi - local -i i=0 n=${#s[*]} j v + \typeset -i i=0 n=${#s[*]} j v while (( i < n )); do (( v = s[i++] << 16 )) @@ -324,86 +325,277 @@ function Lb64encode { (( v |= j << 8 )) (( j = i < n ? s[i++] : 0 )) (( v |= j )) - t+=${Lb64encode_code[v >> 18]}${Lb64encode_code[v >> 12 & 63]} - c=${Lb64encode_code[v >> 6 & 63]} + t+=${Lb64encode_tbl[v >> 18]}${Lb64encode_tbl[v >> 12 & 63]} + c=${Lb64encode_tbl[v >> 6 & 63]} if (( i <= n )); then - t+=$c${Lb64encode_code[v & 63]} + t+=$c${Lb64encode_tbl[v & 63]} elif (( i == n + 1 )); then t+=$c= else t+=== fi if (( ${#t} == 76 || i >= n )); then - print $t + \builtin print $t t= fi done - (( u )) || set -U } # Better Avalanche for the Jenkins Hash -typeset -Z11 -Uui16 Lbafh_v +\typeset -Z11 -Uui16 Lbafh_v function Lbafh_init { Lbafh_v=0 } function Lbafh_add { - [[ -o utf8-mode ]]; local u=$? s - set +U + \set +U + \typeset s if (( $# )); then - read -raN-1 s <<<"$*" - unset s[${#s[*]}-1] + \read -raN-1 s <<<"$*" + \unset s[${#s[*]}-1] else - read -raN-1 s + \read -raN-1 s fi - local -i i=0 n=${#s[*]} + \typeset -i i=0 n=${#s[*]} while (( i < n )); do ((# Lbafh_v = (Lbafh_v + s[i++] + 1) * 1025 )) ((# Lbafh_v ^= Lbafh_v >> 6 )) done - - (( u )) || set -U } function Lbafh_finish { - local -Ui t + \typeset -Ui t ((# t = (((Lbafh_v >> 7) & 0x01010101) * 0x1B) ^ \ ((Lbafh_v << 1) & 0xFEFEFEFE) )) ((# Lbafh_v = t ^ (t >>> 8) ^ (Lbafh_v >>> 8) ^ \ (Lbafh_v >>> 16) ^ (Lbafh_v >>> 24) )) - : + \: } # strip comments (and leading/trailing whitespace if IFS is set) from # any file(s) given as argument, or stdin if none, and spew to stdout function Lstripcom { - cat "$@" | { set -o noglob; while read _line; do + \set -o noglob + \cat "$@" | while \read _line; do _line=${_line%%#*} - [[ -n $_line ]] && print -r -- $_line - done; } + [[ -n $_line ]] && \builtin print -r -- $_line + done } # give MidnightBSD's laffer1 a bit of csh feeling function setenv { - eval export "\"$1\""'="$2"' + \eval "'export' \"$1\""'="$2"' +} + +# toggle built-in aliases and utilities, and aliases and functions from mkshrc +function enable { + \typeset doprnt=0 mode=1 x y z rv=0 + \typeset b_alias i_alias i_func nalias=0 nfunc=0 i_all + \set -A b_alias + \set -A i_alias + \set -A i_func + + # accumulate mksh built-in aliases, in ASCIIbetical order + i_alias[nalias]=autoload; b_alias[nalias++]='\typeset -fu' + i_alias[nalias]=functions; b_alias[nalias++]='\typeset -f' + i_alias[nalias]=hash; b_alias[nalias++]='\builtin alias -t' + i_alias[nalias]=history; b_alias[nalias++]='\builtin fc -l' + i_alias[nalias]=integer; b_alias[nalias++]='\typeset -i' + i_alias[nalias]=local; b_alias[nalias++]='\typeset' + i_alias[nalias]=login; b_alias[nalias++]='\exec login' + 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 + i_func[nfunc++]=. + i_func[nfunc++]=: + i_func[nfunc++]='[' + i_func[nfunc++]=alias + i_func[nfunc++]=break + i_func[nfunc++]=builtin + i_func[nfunc++]=cat + i_func[nfunc++]=cd + i_func[nfunc++]=chdir + i_func[nfunc++]=command + i_func[nfunc++]=continue + i_func[nfunc++]=echo + i_func[nfunc++]=eval + i_func[nfunc++]=exec + i_func[nfunc++]=exit + i_func[nfunc++]=export + i_func[nfunc++]=false + i_func[nfunc++]=fc + i_func[nfunc++]=getopts + i_func[nfunc++]=global + i_func[nfunc++]=jobs + i_func[nfunc++]=kill + i_func[nfunc++]=let + i_func[nfunc++]='let]' + i_func[nfunc++]=print + i_func[nfunc++]=pwd + i_func[nfunc++]=read + i_func[nfunc++]=readonly + i_func[nfunc++]=realpath + i_func[nfunc++]=rename + i_func[nfunc++]=return + i_func[nfunc++]=set + i_func[nfunc++]=shift + i_func[nfunc++]=suspend + i_func[nfunc++]=test + i_func[nfunc++]=times + i_func[nfunc++]=trap + i_func[nfunc++]=true + i_func[nfunc++]=typeset + i_func[nfunc++]=ulimit + i_func[nfunc++]=umask + i_func[nfunc++]=unalias + i_func[nfunc++]=unset + i_func[nfunc++]=wait + i_func[nfunc++]=whence + i_func[nfunc++]=bg + i_func[nfunc++]=fg + i_func[nfunc++]=bind + i_func[nfunc++]=mknod + i_func[nfunc++]=printf + i_func[nfunc++]=sleep + i_func[nfunc++]=domainname + + # accumulate aliases from dot.mkshrc, in definition order + i_alias[nalias]=l; b_alias[nalias++]='ls -F' + i_alias[nalias]=la; b_alias[nalias++]='l -a' + i_alias[nalias]=ll; b_alias[nalias++]='l -l' + i_alias[nalias]=lo; b_alias[nalias++]='l -alo' + i_alias[nalias]=doch; b_alias[nalias++]='sudo mksh -c "$(\builtin fc -ln -1)"' + i_alias[nalias]=rot13; b_alias[nalias++]='tr abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' + i_alias[nalias]=cls; b_alias[nalias++]='\builtin print -n \\ec' + + # accumulate functions from dot.mkshrc, in definition order + i_func[nfunc++]=hd + i_func[nfunc++]=chpwd + i_func[nfunc++]=cd_csh + i_func[nfunc++]=dirs + i_func[nfunc++]=popd + i_func[nfunc++]=pushd + i_func[nfunc++]=smores + i_func[nfunc++]=Lb64decode + i_func[nfunc++]=Lb64encode + i_func[nfunc++]=Lbafh_init + i_func[nfunc++]=Lbafh_add + i_func[nfunc++]=Lbafh_finish + i_func[nfunc++]=Lstripcom + i_func[nfunc++]=setenv + i_func[nfunc++]=enable + + # collect all identifiers, sorted ASCIIbetically + \set -sA i_all -- "${i_alias[@]}" "${i_func[@]}" + + # handle options, we don't do dynamic loading + while \getopts "adf:nps" x; do + case $x { + (a) + mode=-1 + ;; + (d) + # deliberately causing an error, like bash-static + ;| + (f) + \builtin print -u2 enable: dynamic loading not available + \return 2 + ;; + (n) + mode=0 + ;; + (p) + doprnt=1 + ;; + (s) + \set -sA i_all -- . : break continue eval exec exit \ + export readonly return set shift times trap unset + ;; + (*) + \builtin print -u2 enable: usage: \ + "enable [-adnps] [-f filename] [name ...]" + return 2 + ;; + } + done + \shift $((OPTIND - 1)) + + # display builtins enabled/disabled/all/special? + if (( doprnt || ($# == 0) )); then + for x in "${i_all[@]}"; do + y=$(\alias "$x") || y= + [[ $y = "$x='\\builtin whence -p $x >/dev/null || (\\builtin print mksh: $x: not found; exit 127) && \$(\\builtin whence -p $x)'" ]]; z=$? + case $mode:$z { + (-1:0|0:0) + \print -r -- "enable -n $x" + ;; + (-1:1|1:1) + \print -r -- "enable $x" + ;; + } + done + \return 0 + fi + + for x in "$@"; do + z=0 + for y in "${i_alias[@]}" "${i_func[@]}"; do + [[ $x = "$y" ]] || \continue + z=1 + \break + done + if (( !z )); then + \builtin print -ru2 enable: "$x": not a shell builtin + rv=1 + \continue + fi + if (( !mode )); then + # disable this + \alias "$x=\\builtin whence -p $x >/dev/null || (\\builtin print mksh: $x: not found; exit 127) && \$(\\builtin whence -p $x)" + else + # find out if this is an alias or not, first + z=0 + y=-1 + while (( ++y < nalias )); do + [[ $x = "${i_alias[y]}" ]] || \continue + z=1 + \break + done + if (( z )); then + # re-enable the original alias body + \alias "$x=${b_alias[y]}" + else + # re-enable the original utility/function + \unalias "$x" + fi + fi + done + \return $rv } -: place customisations below this line +\: place customisations below this line for p in ~/.etc/bin ~/bin; do - [[ -d $p/. ]] || continue + [[ -d $p/. ]] || \continue + #XXX OS/2 [[ :$PATH: = *:$p:* ]] || PATH=$p:$PATH done -export SHELL=$MKSH MANWIDTH=80 LESSHISTFILE=- -alias cls='print -n \\033c' +\export SHELL=$MKSH MANWIDTH=80 LESSHISTFILE=- +\alias cls='\builtin print -n \\ec' -#unset LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_IDENTIFICATION LC_MONETARY \ +#\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 +#\export LANG=C LC_CTYPE=$p LC_MEASUREMENT=$p LC_MESSAGES=$p LC_PAPER=$p -unset p +\unset p -: place customisations above this line +\: place customisations above this line