Build fix.
[AROS.git] / test / clib / setjmp.c
blob248022fd6b117d29106ec549e45029fe085c9adf
1 /*
2 Copyright © 2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Test program for the arosc's setjmp() function.
6 */
7 #include <setjmp.h>
8 #include <stdio.h>
10 jmp_buf env;
11 int i = 0;
13 int main(void)
15 int a = 1234;
17 printf("a:%d, &a: %p\n", a, &a);
18 switch(setjmp(env))
20 case 0:
21 printf("setjmp 0, i = %d, a: %d, &a: %p\n", i, a, &a);
22 i++;
23 longjmp(env, i);
25 case 1:
26 printf("setjmp 1, i = %d, a: %d, &a: %p\n", i, a, &a);
27 i++;
28 longjmp(env, i);
30 case 2:
31 printf("setjmp 2, i = %d, a: %d, &a: %p\n", i, a, &a);
32 break;
34 default:
35 printf("Something's very wrong !!!\n");
36 return 20;
37 break;
40 return 0;