rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 8731b3ebc39715005c402d746e282fe2edfa7118
parent 6dedd11104490fe8ac43bd35c39c0aed12047322
Author: tjg <tjg>
Date:   Thu,  4 Oct 2001 12:32:43 +0000

  Bug: semantic errors in `fn prompt' no longer throw rc into a tailspin.

Diffstat:
Minput.c | 17++++++++++++++---
Mrc.1 | 11-----------
2 files changed, 14 insertions(+), 14 deletions(-)

diff --git 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 @@ -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 "<tjg@star.le.ac.uk>" . .SH INCOMPATIBILITIES