2 * This simple classical example of recursion is useful for
3 * testing stack backtraces and such.
9 #include "../lib/unbuffer_output.c"
14 main (int argc, char **argv, char **envp)
16 gdb_unbuffer_output ();
19 printf ("%d\n", factorial (1)); /* commands.exp: hw local_var out of scope */
22 printf ("usage: factorial <number>\n");
25 printf ("%d\n", factorial (atoi (argv[1])));
31 int factorial (int value)
36 value *= factorial (value - 1);
40 } /* commands.exp: local_var out of scope */