# $Id$
-# $MirOS: src/bin/mksh/dot.mkshrc,v 1.104 2015/12/31 21:00:12 tg Exp $
+# $MirOS: src/bin/mksh/dot.mkshrc,v 1.108 2016/07/26 22:03:41 tg Exp $
#-
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012, 2013, 2014, 2015
+# 2011, 2012, 2013, 2014, 2015, 2016
# mirabilos <m@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
(( e )) && REPLY+="$e|"
REPLY+=${USER}@${HOSTNAME%%.*}:
- \typeset d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || d=${d/#$p/\~}
- \typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
+ \typeset d=${PWD:-?}/ p=~; [[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
+ d=${d%/}; \typeset m=${%d} n p=...; (( m > 0 )) || m=${#d}
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
REPLY+=$p$d
}
# 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
- llen=${%line}
- (( llen == -1 )) && llen=${#line}
- (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
- if (( (curlin += llen) >= LINES )); then
- \builtin print -n -- '\e[7m--more--\e[0m'
- \read -u1 || \exit $?
- [[ $REPLY = [Qq]* ]] && \exit 0
- curlin=$llen
- fi
- \builtin print -r -- "$line"
- done
- )
-}
+smores() (
+ \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
+ \builtin print -n -- '\e[7m--more--\e[0m'
+ \read -u1 || \exit $?
+ [[ $REPLY = [Qq]* ]] && \exit 0
+ curlin=$llen
+ fi
+ \builtin print -r -- "$line"
+ done
+)
# base64 encoder and decoder, RFC compliant, NUL safe, not EBCDIC safe
function Lb64decode {
((# t = (((Lbafh_v >> 7) & 0x01010101) * 0x1B) ^ \
((Lbafh_v << 1) & 0xFEFEFEFE) ))
- ((# Lbafh_v = t ^ (t >>> 8) ^ (Lbafh_v >>> 8) ^ \
- (Lbafh_v >>> 16) ^ (Lbafh_v >>> 24) ))
+ ((# Lbafh_v = t ^ (t ^> 8) ^ (Lbafh_v ^> 8) ^ \
+ (Lbafh_v ^> 16) ^ (Lbafh_v ^> 24) ))
\:
}
# accumulate functions from dot.mkshrc, in definition order
i_func[nfunc++]=hd
i_func[nfunc++]=chpwd
+ i_func[nfunc++]=cd
i_func[nfunc++]=cd_csh
i_func[nfunc++]=dirs
i_func[nfunc++]=popd