This commit is contained in:
tg 2016-04-09 16:33:23 +00:00
parent 4c4131dddf
commit da085fd7d2

View File

@ -1,8 +1,8 @@
# $Id$ # $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, # 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> # mirabilos <m@mirbsd.org>
# #
# Provided that these terms and disclaimer and all copyright notices # Provided that these terms and disclaimer and all copyright notices
@ -250,25 +250,23 @@ function pushd {
} }
# pager (not control character safe) # pager (not control character safe)
function smores { smores() (
( \set +m
\set +m \cat "$@" |&
\cat "$@" |& \trap "rv=\$?; 'kill' $! >/dev/null 2>&1; 'exit' \$rv" EXIT
\trap "rv=\$?; 'kill' $! >/dev/null 2>&1; 'exit' \$rv" EXIT while IFS= \read -pr line; do
while IFS= \read -pr line; do llen=${%line}
llen=${%line} (( llen == -1 )) && llen=${#line}
(( llen == -1 )) && llen=${#line} (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
(( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 )) if (( (curlin += llen) >= LINES )); then
if (( (curlin += llen) >= LINES )); then \builtin print -n -- '\e[7m--more--\e[0m'
\builtin print -n -- '\e[7m--more--\e[0m' \read -u1 || \exit $?
\read -u1 || \exit $? [[ $REPLY = [Qq]* ]] && \exit 0
[[ $REPLY = [Qq]* ]] && \exit 0 curlin=$llen
curlin=$llen fi
fi \builtin print -r -- "$line"
\builtin print -r -- "$line" done
done )
)
}
# base64 encoder and decoder, RFC compliant, NUL safe, not EBCDIC safe # base64 encoder and decoder, RFC compliant, NUL safe, not EBCDIC safe
function Lb64decode { function Lb64decode {