xref: /haiku/src/tests/system/libroot/posix/setjmp_test.c (revision 5ac9b506412b11afb993bb52d161efe7666958a5)
1 /*
2  * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <setjmp.h>
8 #include <stdio.h>
9 
10 
11 int
12 main(int argc, char **argv)
13 {
14 	jmp_buf state;
15 	int value;
16 
17 	if ((value = setjmp(state)) != 0) {
18 		printf("failed with: %d!\n", value);
19 	} else {
20 		printf("here I am: %d\n", value);
21 		longjmp(state, 42);
22 		printf("you won't see me!\n");
23 	}
24 
25 	puts("done.");
26 	return 0;
27 }
28