1 # $MirOS: src/bin/mksh/dot.mkshrc,v 1.68 2011/11/25 23:58:04 tg Exp $
3 # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011
4 # Thorsten Glaser <tg@mirbsd.org>
6 # Provided that these terms and disclaimer and all copyright notices
7 # are retained or reproduced in an accompanying document, permission
8 # is granted to deal in this work without restriction, including un-
9 # limited rights to use, publicly perform, distribute, sell, modify,
10 # merge, give away, or sublicence.
12 # This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
13 # the utmost extent permitted by applicable law, neither express nor
14 # implied; without malicious intent or gross negligence. In no event
15 # may a licensor, author or contributor be held liable for indirect,
16 # direct, other damage, loss, or other issues arising in any way out
17 # of dealing in the work, even if advised of the possibility of such
18 # damage or existence of a defect, except proven that it results out
19 # of said person's immediate fault when using the work as intended.
21 # pager (not control character safe)
23 local dummy line llen curlin=0
25 cat "$@" | while IFS= read -r line; do
27 (( llen == -1 )) && llen=${#line}
28 (( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
29 if (( (curlin += llen) >= LINES )); then
30 print -n -- '\033[7m--more--\033[0m'
32 [[ $dummy = [Qq]* ]] && return 0