From 8731b3ebc39715005c402d746e282fe2edfa7118 Mon Sep 17 00:00:00 2001 From: tjg Date: Thu, 4 Oct 2001 12:32:43 +0000 Subject: Bug: semantic errors in `fn prompt' no longer throw rc into a tailspin. --- input.c | 17 ++++++++++++++--- rc.1 | 11 ----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/input.c b/input.c index 0f649e4..48c6a9c 100644 --- a/input.c +++ b/input.c @@ -242,9 +242,9 @@ extern void flushu() { extern Node *doit(bool clobberexecit) { bool eof; - bool execit ; + bool execit; Jbwrap j; - Estack e1, e2; + Estack e1; Edata jerror; if (dashen) @@ -255,6 +255,7 @@ extern Node *doit(bool clobberexecit) { except(eError, jerror, &e1); for (eof = FALSE; !eof;) { Edata block; + Estack e2; block.b = newblock(); except(eArena, block, &e2); sigchk(); @@ -270,7 +271,17 @@ extern Node *doit(bool clobberexecit) { List *s; if (!dashen && fnlookup("prompt") != NULL) { static char *arglist[] = { "prompt", NULL }; - funcall(arglist); + Estack e3; + Edata pjmp; + Jbwrap pj; + + if (sigsetjmp(pj.j, 1) == 0) { + pjmp.jb = &pj; + except(eError, pjmp, &e3); + + funcall(arglist); + unexcept(); + } } if ((s = varlookup("prompt")) != NULL) { #if EDITLINE || READLINE diff --git a/rc.1 b/rc.1 index 2567266..7687215 100644 --- a/rc.1 +++ b/rc.1 @@ -1959,17 +1959,6 @@ code is illegal. .TP The redundant inner parentheses must be omitted. .PP -Semantic errors (e.g. "bad concatenation") in -.B fn prompt -are not handled elegantly. For example, -.Ds -.Cr "fn prompt { echo (a b)^(c d e) }" -.De -.TP -throws -.I rc -into a tailspin. -.PP Bug reports should be mailed to .Cr "" . .SH INCOMPATIBILITIES -- cgit v1.2.3