From 6885553546490f72498f0ac17751b6b96968c3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 12 May 2006 10:13:15 +0000 Subject: [PATCH] added a sigsetjmp test this is what bash is currently using (we're supposed to be posix compatible after all) success on R5, R5 setjmp.h; fail on R5, Haiku setjmp.h (could be expected) to be tested: on Haiku, R5 & Haiku setjmp.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17430 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../system/libroot/posix/sigsetjmp_test.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/tests/system/libroot/posix/sigsetjmp_test.c 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; +}