diff options
author | Dave Brolley <brolley@redhat.com> | 2009-12-17 16:59:26 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-12-17 16:59:26 -0500 |
commit | 6dd4e32114264ccda20395cb07bb877de3c062b2 (patch) | |
tree | 6ea4eb4e631df7832c07eafeda2ca4031870b335 /testsuite/systemtap.context/fib.c | |
parent | 089ed967ce3894c3569091db70db423a5316b04e (diff) | |
parent | 4180475982d87f720897baa6f988a48b4c654ee5 (diff) | |
download | systemtap-steved-6dd4e32114264ccda20395cb07bb877de3c062b2.tar.gz systemtap-steved-6dd4e32114264ccda20395cb07bb877de3c062b2.tar.xz systemtap-steved-6dd4e32114264ccda20395cb07bb877de3c062b2.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.context/fib.c')
-rw-r--r-- | testsuite/systemtap.context/fib.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/systemtap.context/fib.c b/testsuite/systemtap.context/fib.c new file mode 100644 index 00000000..61fee0a7 --- /dev/null +++ b/testsuite/systemtap.context/fib.c @@ -0,0 +1,31 @@ +#include <stdlib.h> +#include <stdio.h> + +long fib(int x) +{ + if (x == 0 || x == 1) + return 1; + else + return fib(x - 1) + fib(x - 2); +} + +int main(int argc, char **argv) +{ + int x = 0; + long result = 0; + + if (argc != 2) + { + printf("0\n"); + return 1; + } + x = atoi(argv[1]); + if (x < 0) + { + printf("0\n"); + return 1; + } + result = fib(x); + printf("%ld\n", result); + return 0; +} |