incorporate more feedback from schily

This commit is contained in:
tg 2016-01-14 23:18:11 +00:00
parent 1b0e4f54cb
commit c51e067e62
4 changed files with 19 additions and 15 deletions

View File

@ -3,7 +3,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2014, 2015
* 2011, 2012, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -27,7 +27,7 @@
#include <sys/file.h>
#endif
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.151 2015/11/29 17:05:01 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.152 2016/01/14 23:18:08 tg Exp $");
Trap sigtraps[ksh_NSIG + 1];
static struct sigaction Sigact_ign;
@ -1213,7 +1213,7 @@ fatal_trap_check(void)
do {
if (p->set && (p->flags & (TF_DFL_INTR|TF_FATAL)))
/* return value is used as an exit code */
return (128 + p->signal);
return (ksh_sigmask(p->signal));
++p;
} while (--i);
return (0);

11
jobs.c
View File

@ -2,7 +2,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
* 2012, 2013, 2014, 2015
* 2012, 2013, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.116 2015/10/09 16:11:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.117 2016/01/14 23:18:09 tg Exp $");
#if HAVE_KILLPG
#define mksh_killpg killpg
@ -215,14 +215,11 @@ j_init(void)
static int
proc_errorlevel(Proc *p)
{
int termsig;
switch (p->state) {
case PEXITED:
return ((WEXITSTATUS(p->status)) & 255);
case PSIGNALLED:
termsig = WTERMSIG(p->status);
return ((termsig < 1 || termsig > 127) ? 255 : 128 + termsig);
return (ksh_sigmask(WTERMSIG(p->status)));
default:
return (0);
}
@ -756,7 +753,7 @@ waitfor(const char *cp, int *sigp)
if (rv < 0)
/* we were interrupted */
*sigp = 128 + -rv;
*sigp = ksh_sigmask(-rv);
return (rv);
}

11
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.386 2016/01/13 17:20:50 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.387 2016/01/14 23:18:09 tg Exp $
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -74,7 +74,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: January 13 2016 $
.Dd $Mdocdate: January 14 2016 $
.\"
.\" Check which macro package we use, and do other -mdoc setup.
.\"
@ -179,6 +179,11 @@ script use.
Its command language is a superset of the
.Xr sh C
shell language and largely compatible to the original Korn shell.
At times, this manual page may give scripting advice; while it
sometimes does take portable shell scripting or various standards
into account all information is first and foremost presented with
.Nm
in mind and should be taken as such.
.Ss I'm an Android user, so what's mksh?
.Nm mksh
is a
@ -1744,7 +1749,7 @@ command below for a list of options).
The exit status of the last non-asynchronous command executed.
If the last command was killed by a signal,
.Ic $?\&
is set to 128 plus the signal number.
is set to 128 plus the signal number, but at most 255.
.It Ev 0
The name of the shell, determined as follows:
the first argument to

6
sh.h
View File

@ -175,9 +175,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.754 2016/01/14 22:49:32 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.755 2016/01/14 23:18:11 tg Exp $");
#endif
#define MKSH_VERSION "R52 2016/01/13"
#define MKSH_VERSION "R52 2016/01/14"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -379,6 +379,8 @@ struct rusage {
#define ksh_NSIG 64
#endif
#define ksh_sigmask(sig) (((sig) < 1 || (sig) > 127) ? 255 : 128 + (sig))
/* OS-dependent additions (functions, variables, by OS) */