incorporate more feedback from schily
This commit is contained in:
		| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| /*- | /*- | ||||||
|  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, |  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, | ||||||
|  *		 2011, 2012, 2014, 2015 |  *		 2011, 2012, 2014, 2015, 2016 | ||||||
|  *	mirabilos <m@mirbsd.org> |  *	mirabilos <m@mirbsd.org> | ||||||
|  * |  * | ||||||
|  * Provided that these terms and disclaimer and all copyright notices |  * Provided that these terms and disclaimer and all copyright notices | ||||||
| @@ -27,7 +27,7 @@ | |||||||
| #include <sys/file.h> | #include <sys/file.h> | ||||||
| #endif | #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]; | Trap sigtraps[ksh_NSIG + 1]; | ||||||
| static struct sigaction Sigact_ign; | static struct sigaction Sigact_ign; | ||||||
| @@ -1213,7 +1213,7 @@ fatal_trap_check(void) | |||||||
| 	do { | 	do { | ||||||
| 		if (p->set && (p->flags & (TF_DFL_INTR|TF_FATAL))) | 		if (p->set && (p->flags & (TF_DFL_INTR|TF_FATAL))) | ||||||
| 			/* return value is used as an exit code */ | 			/* return value is used as an exit code */ | ||||||
| 			return (128 + p->signal); | 			return (ksh_sigmask(p->signal)); | ||||||
| 		++p; | 		++p; | ||||||
| 	} while (--i); | 	} while (--i); | ||||||
| 	return (0); | 	return (0); | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								jobs.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								jobs.c
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| /*- | /*- | ||||||
|  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, |  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, | ||||||
|  *		 2012, 2013, 2014, 2015 |  *		 2012, 2013, 2014, 2015, 2016 | ||||||
|  *	mirabilos <m@mirbsd.org> |  *	mirabilos <m@mirbsd.org> | ||||||
|  * |  * | ||||||
|  * Provided that these terms and disclaimer and all copyright notices |  * Provided that these terms and disclaimer and all copyright notices | ||||||
| @@ -23,7 +23,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #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 | #if HAVE_KILLPG | ||||||
| #define mksh_killpg		killpg | #define mksh_killpg		killpg | ||||||
| @@ -215,14 +215,11 @@ j_init(void) | |||||||
| static int | static int | ||||||
| proc_errorlevel(Proc *p) | proc_errorlevel(Proc *p) | ||||||
| { | { | ||||||
| 	int termsig; |  | ||||||
|  |  | ||||||
| 	switch (p->state) { | 	switch (p->state) { | ||||||
| 	case PEXITED: | 	case PEXITED: | ||||||
| 		return ((WEXITSTATUS(p->status)) & 255); | 		return ((WEXITSTATUS(p->status)) & 255); | ||||||
| 	case PSIGNALLED: | 	case PSIGNALLED: | ||||||
| 		termsig = WTERMSIG(p->status); | 		return (ksh_sigmask(WTERMSIG(p->status))); | ||||||
| 		return ((termsig < 1 || termsig > 127) ? 255 : 128 + termsig); |  | ||||||
| 	default: | 	default: | ||||||
| 		return (0); | 		return (0); | ||||||
| 	} | 	} | ||||||
| @@ -756,7 +753,7 @@ waitfor(const char *cp, int *sigp) | |||||||
|  |  | ||||||
| 	if (rv < 0) | 	if (rv < 0) | ||||||
| 		/* we were interrupted */ | 		/* we were interrupted */ | ||||||
| 		*sigp = 128 + -rv; | 		*sigp = ksh_sigmask(-rv); | ||||||
|  |  | ||||||
| 	return (rv); | 	return (rv); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								mksh.1
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								mksh.1
									
									
									
									
									
								
							| @@ -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 $ | .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ | ||||||
| .\"- | .\"- | ||||||
| .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | ||||||
| @@ -74,7 +74,7 @@ | |||||||
| .\" with -mandoc, it might implement .Mx itself, but we want to | .\" with -mandoc, it might implement .Mx itself, but we want to | ||||||
| .\" use our own definition. And .Dd must come *first*, always. | .\" 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. | .\" 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 | Its command language is a superset of the | ||||||
| .Xr sh C | .Xr sh C | ||||||
| shell language and largely compatible to the original Korn shell. | 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? | .Ss I'm an Android user, so what's mksh? | ||||||
| .Nm mksh | .Nm mksh | ||||||
| is a | is a | ||||||
| @@ -1744,7 +1749,7 @@ command below for a list of options). | |||||||
| The exit status of the last non-asynchronous command executed. | The exit status of the last non-asynchronous command executed. | ||||||
| If the last command was killed by a signal, | If the last command was killed by a signal, | ||||||
| .Ic $?\& | .Ic $?\& | ||||||
| is set to 128 plus the signal number. | is set to 128 plus the signal number, but at most 255. | ||||||
| .It Ev 0 | .It Ev 0 | ||||||
| The name of the shell, determined as follows: | The name of the shell, determined as follows: | ||||||
| the first argument to | the first argument to | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								sh.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								sh.h
									
									
									
									
									
								
							| @@ -175,9 +175,9 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef EXTERN | #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 | #endif | ||||||
| #define MKSH_VERSION "R52 2016/01/13" | #define MKSH_VERSION "R52 2016/01/14" | ||||||
|  |  | ||||||
| /* arithmetic types: C implementation */ | /* arithmetic types: C implementation */ | ||||||
| #if !HAVE_CAN_INTTYPES | #if !HAVE_CAN_INTTYPES | ||||||
| @@ -379,6 +379,8 @@ struct rusage { | |||||||
| #define ksh_NSIG 64 | #define ksh_NSIG 64 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #define ksh_sigmask(sig) (((sig) < 1 || (sig) > 127) ? 255 : 128 + (sig)) | ||||||
|  |  | ||||||
|  |  | ||||||
| /* OS-dependent additions (functions, variables, by OS) */ | /* OS-dependent additions (functions, variables, by OS) */ | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user