diff --git a/check.t b/check.t index a7c971b..96026e8 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.655 2014/07/13 11:34:26 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.656 2014/07/28 21:45:42 tg Exp $ # OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44 #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -27,7 +27,7 @@ # http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD expected-stdout: - @(#)MIRBSD KSH R50 2014/07/13 + @(#)MIRBSD KSH R50 2014/07/28 description: Check version of shell. stdin: @@ -36,7 +36,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R50 2014/07/13 + @(#)LEGACY KSH R50 2014/07/28 description: Check version of legacy shell. stdin: diff --git a/dot.mkshrc b/dot.mkshrc index 99cc9a1..233a10c 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,5 +1,5 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.88 2014/01/11 18:09:39 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.89 2014/07/28 21:45:44 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014 @@ -242,20 +242,23 @@ function pushd { # pager (not control character safe) function smores { - local dummy line llen curlin=0 - - cat "$@" | while IFS= read -r 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 dummy - [[ $dummy = [Qq]* ]] && return 0 - curlin=$llen - fi - print -r -- "$line" - done + ( + 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 + curlin=$llen + fi + print -r -- "$line" + done + ) } # base64 encoder and decoder, RFC compliant, NUL safe diff --git a/funcs.c b/funcs.c index 77d9494..a51ec50 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.256 2014/06/09 13:25:52 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.257 2014/07/28 21:45:44 tg Exp $"); #if HAVE_KILLPG /* @@ -3643,12 +3643,14 @@ c_cat(const char **wp) break; while (n) { w = write(STDOUT_FILENO, cp, n); + eno = errno; + /* give the user a chance to ^C out */ + intrcheck(); if (w == -1) { - if (errno == EINTR) + if (eno == EINTR) /* interrupted, try again */ continue; /* an error occured during writing */ - eno = errno; bi_errorf("%s: %s", "", cstrerror(eno)); rv = 1; diff --git a/sh.h b/sh.h index b17dc4a..4723d56 100644 --- a/sh.h +++ b/sh.h @@ -169,9 +169,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.692 2014/07/13 11:34:29 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.693 2014/07/28 21:45:45 tg Exp $"); #endif -#define MKSH_VERSION "R50 2014/07/13" +#define MKSH_VERSION "R50 2014/07/28" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES