[TUHS] GOTO etc
Steve
srb at unixsh.com
Mon Mar 13 04:23:51 AEST 2023
Dennis added setjmp() and longjmp() so the shell could handle errors in a reasonable way.
There are two places where setjmp was used in the original shell (7th edition) code as I recall.
Both at the top level
in main.c.
The idea came from Algol68 but I do not know where it was originally invented. longjmp() was used
in the "exitsh"
function that got called on the exit command, default trap routine and a fault with no trap set.
It was also used when executing a subshell to avoid a fork and exec. In this case the setjmp() was
at top level
in the initial sh setup.
Hope this makes sense. But these were two different uses. One for error recovery and one to reset
the execution environment
back to initial state.
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20230312/1c08ee12/attachment.htm>
More information about the TUHS
mailing list