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
This commit is contained in:
Jérôme Duval 2006-05-12 10:13:15 +00:00
parent 1c9d6e5902
commit 6885553546

View File

@ -0,0 +1,33 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include <stdio.h>
#include <setjmp.h>
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;
}