chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[PATCH] move TOPOLOGY rule to it's own function.
[elogind.git]
/
klibc
/
klibc
/
tests
/
setjmptest.c
1
/*
2
* setjmptest.c
3
*/
4
5
#include <stdio.h>
6
#include <setjmp.h>
7
8
static jmp_buf buf;
9
10
void do_stuff(int v)
11
{
12
printf("setjmp returned %d\n", v);
13
longjmp(buf, v+1);
14
}
15
16
void recurse(int ctr, int v)
17
{
18
if ( ctr-- ) {
19
recurse(ctr, v);
20
} else {
21
do_stuff(v);
22
}
23
_fwrite(".", 1, stdout);
24
}
25
26
int main(void)
27
{
28
int v;
29
30
v = setjmp(buf);
31
32
if ( v < 256 )
33
recurse(v,v);
34
35
return 0;
36
}