note that some longjmp don’t handle 0 properly

cf. <500C1B2E.9030602@zytor.com>
This commit is contained in:
tg 2012-07-22 15:56:51 +00:00
parent 058e7f8ed4
commit aedb299057
2 changed files with 7 additions and 2 deletions

3
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.225 2012/07/01 15:38:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.226 2012/07/22 15:56:50 tg Exp $");
extern char **environ;
@ -844,6 +844,7 @@ shell(Source * volatile s, volatile bool toplevel)
}
/* return to closest error handler or shell(), exit if none found */
/* note: i MUST NOT be 0 */
void
unwind(int i)
{

6
sh.h
View File

@ -157,7 +157,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.573 2012/07/20 23:22:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.574 2012/07/22 15:56:51 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/07/21"
@ -631,6 +631,8 @@ enum sh_flag {
/*
* parsing & execution environment
*
* note that kshlongjmp MUST NOT be passed 0 as second argument!
*/
#ifdef MKSH_NO_SIGSETJMP
#define kshjmp_buf jmp_buf
@ -676,6 +678,7 @@ extern struct env {
#define STOP_RETURN(t) ((t) == E_FUNC || (t) == E_INCL)
/* values for kshlongjmp(e->jbuf, i) */
/* note that i MUST NOT be zero */
#define LRETURN 1 /* return statement */
#define LEXIT 2 /* exit statement */
#define LERROR 3 /* errorf() called */
@ -1776,6 +1779,7 @@ int promptlen(const char *);
int include(const char *, int, const char **, int);
int command(const char *, int);
int shell(Source * volatile, volatile bool);
/* argument MUST NOT be 0 */
void unwind(int) MKSH_A_NORETURN;
void newenv(int);
void quitenv(struct shf *);