1
/* Test of setjmp()/longjmp() functions: frame pointer restoring.
2
$Id: setjmp-4.c,v 1.1.2.2 2008/03/24 11:29:55 dmix Exp $ */
10
/* foo_jmp() use stack. longjmp must restore frame pointer from env. */
11
void foo_jmp (const char *p)
16
longjmp (env, strtol (s, 0, 0));
19
/* foo() use stack. If frame pointer would be scratch, return value
20
(or all program) would be another. */
24
strcpy ((char *)s, p);
25
switch (setjmp (env)) {
27
case 2: return strtol ((const char *)s, 0, 0);
28
default: exit (__LINE__);
36
if (foo ("1234") != 1234)
38
if (foo ("4321") != 4321)