setjmp, longjmp, _setjmp, _longjmp - non-local goto

#include <setjmp.h>

jmp_buf env;

longjmp(env, val)
jmp_buf env;

jmp_buf env;

_longjmp(env, val)
jmp_buf env;

These routines are useful for dealing with errors and interrupts
encountered in a low-level subroutine of a program.

The setjmpand_setjmp functions save their calling environment in
env. Each of these functions returns 0.

Longjmp(_longjmp) restores the environment saved by the last call
of setjmp(_setjmp). It then returns in such a way that execution
continues as if the call of setjmp(_setjmp) had just returned the
value val to the function that invoked setjmp(_setjmp), which must
not itself have returned in the interim. All accessible data have
values as of the time longjmp(_longjmp) was called.

The setjmp()/longjmp() pairs save and restore the signal mask while
_setjmp()/_longjmp() pairs save and restore only the register set
and the stack.

If the contents of the jmp_buf are corrupted, or correspond to an
environment that has already returned, longjmp calls the routine
longjmperror. If longjmperror returns the program is aborted. The
default version of longjmperror prints the message "longjmp
botch" to standard error and returns. User programs wishing to
exit more gracefully can write their own versions of longjmperror.

sigvec(2), sigstack(2), signal(3)