<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Perhaps you’re talking about <i>non-local</i> GOTOs in Algol68, where you can jump from a nested procedure to a label in a <i>lexically</i> enclosing procedure. Pascal has this too. C has no nested procedures but its setjmp/longjmp is much more powerful (& dangerous). Though both can be used to the top level of a REPL or to jump to a known place after an error.</div><div dir="ltr"><br><blockquote type="cite">On Mar 12, 2023, at 11:24 AM, Steve <srb@unixsh.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<font face="Helvetica, Arial, sans-serif">Dennis added setjmp() and
longjmp() so the shell could handle errors in a reasonable way.<br>
There are two places where setjmp was used in the original shell
(7th edition) code as I recall. Both at the top level<br>
in main.c.<br>
<br>
The idea came from Algol68 but I do not know where it was
originally invented. longjmp() was used in the "exitsh"<br>
function that got called on the exit command, default trap routine
and a fault with no trap set.<br>
<br>
It was also used when executing a subshell to avoid a fork and
exec. In this case the setjmp() was at top level<br>
in the initial sh setup.<br>
<br>
Hope this makes sense. But these were two different uses. One
for error recovery and one to reset the execution environment<br>
back to initial state.<br>
<br>
Steve<br>
</font>
</div></blockquote></body></html>