• permit interrupts during a write(2) loop in the cat builtin, too, not just in the read(2) loop – fixes inability to kill a clogged output cat • kill the cat when smores finish TODO: revisit this ⓐ in more depth, ⓑ for other functions, such as “hd”, and ⓒ test on AOSP as well
This commit is contained in:
parent
6c31e7e631
commit
097ed42c83
6
check.t
6
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:
|
||||
|
33
dot.mkshrc
33
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
|
||||
|
8
funcs.c
8
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", "<stdout>",
|
||||
cstrerror(eno));
|
||||
rv = 1;
|
||||
|
4
sh.h
4
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user