This commit is contained in:
tg 2016-04-09 16:33:23 +00:00
parent 4c4131dddf
commit da085fd7d2
1 changed files with 19 additions and 21 deletions

View File

@ -1,8 +1,8 @@
# $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.105 2016/04/09 16:33:23 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
@ -250,25 +250,23 @@ function pushd {
}
# 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 {