diff --git a/src/tests/system/libroot/posix/sigsetjmp_test.c b/src/tests/system/libroot/posix/sigsetjmp_test.c new file mode 100644 index 0000000000..eee1b9c165 --- /dev/null +++ b/src/tests/system/libroot/posix/sigsetjmp_test.c @@ -0,0 +1,33 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + +void +jump_to_top_level(jmp_buf *state, int value) +{ + siglongjmp(*state, value); +} + + +int +main(int argc, char **argv) +{ + jmp_buf state; + int value; + + if (value = sigsetjmp(state, 1)) { + printf("failed with: %d!\n", value); + } else { + printf("here I am: %d\n", value); + jump_to_top_level(&state, 42); + printf("you won't see me!\n"); + } + + puts("done."); + return 0; +}