• 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
|
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# 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
|
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R50 2014/07/13
|
@(#)MIRBSD KSH R50 2014/07/28
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -36,7 +36,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R50 2014/07/13
|
@(#)LEGACY KSH R50 2014/07/28
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
33
dot.mkshrc
33
dot.mkshrc
@ -1,5 +1,5 @@
|
|||||||
# $Id$
|
# $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,
|
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014
|
# 2011, 2012, 2013, 2014
|
||||||
@ -242,20 +242,23 @@ function pushd {
|
|||||||
|
|
||||||
# pager (not control character safe)
|
# pager (not control character safe)
|
||||||
function smores {
|
function smores {
|
||||||
local dummy line llen curlin=0
|
(
|
||||||
|
set +m
|
||||||
cat "$@" | while IFS= read -r line; do
|
cat "$@" |&
|
||||||
llen=${%line}
|
trap "rv=\$?; kill $! >/dev/null 2>&1; exit \$rv" EXIT
|
||||||
(( llen == -1 )) && llen=${#line}
|
while IFS= read -pr line; do
|
||||||
(( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
|
llen=${%line}
|
||||||
if (( (curlin += llen) >= LINES )); then
|
(( llen == -1 )) && llen=${#line}
|
||||||
print -n -- '\033[7m--more--\033[0m'
|
(( llen = llen ? (llen + COLUMNS - 1) / COLUMNS : 1 ))
|
||||||
read -u1 dummy
|
if (( (curlin += llen) >= LINES )); then
|
||||||
[[ $dummy = [Qq]* ]] && return 0
|
print -n -- '\033[7m--more--\033[0m'
|
||||||
curlin=$llen
|
read -u1 || exit $?
|
||||||
fi
|
[[ $REPLY = [Qq]* ]] && exit 0
|
||||||
print -r -- "$line"
|
curlin=$llen
|
||||||
done
|
fi
|
||||||
|
print -r -- "$line"
|
||||||
|
done
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# base64 encoder and decoder, RFC compliant, NUL safe
|
# base64 encoder and decoder, RFC compliant, NUL safe
|
||||||
|
8
funcs.c
8
funcs.c
@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#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
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -3643,12 +3643,14 @@ c_cat(const char **wp)
|
|||||||
break;
|
break;
|
||||||
while (n) {
|
while (n) {
|
||||||
w = write(STDOUT_FILENO, cp, n);
|
w = write(STDOUT_FILENO, cp, n);
|
||||||
|
eno = errno;
|
||||||
|
/* give the user a chance to ^C out */
|
||||||
|
intrcheck();
|
||||||
if (w == -1) {
|
if (w == -1) {
|
||||||
if (errno == EINTR)
|
if (eno == EINTR)
|
||||||
/* interrupted, try again */
|
/* interrupted, try again */
|
||||||
continue;
|
continue;
|
||||||
/* an error occured during writing */
|
/* an error occured during writing */
|
||||||
eno = errno;
|
|
||||||
bi_errorf("%s: %s", "<stdout>",
|
bi_errorf("%s: %s", "<stdout>",
|
||||||
cstrerror(eno));
|
cstrerror(eno));
|
||||||
rv = 1;
|
rv = 1;
|
||||||
|
4
sh.h
4
sh.h
@ -169,9 +169,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#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
|
#endif
|
||||||
#define MKSH_VERSION "R50 2014/07/13"
|
#define MKSH_VERSION "R50 2014/07/28"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user