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:
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005, Axel Dörfler, [email protected].
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user