1 /*
2   this is modified version of the original example main.c
3   fixed so that it could compile and run in MySQL source tree
4 */
5 
6 #ifdef NDEBUG				/* We are testing dbug */
7 #undef NDEBUG
8 #endif
9 
10 #include <my_global.h>	/* This includes dbug.h */
11 #include <my_thread.h>
12 
main(argc,argv)13 int main (argc, argv)
14 int argc;
15 char *argv[];
16 {
17   int result, ix;
18   extern int factorial(int);
19   my_thread_global_init();
20 
21   {
22     DBUG_ENTER ("main");
23     DBUG_PROCESS (argv[0]);
24     for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
25       switch (argv[ix][1]) {
26       case '#':
27 	DBUG_PUSH (&(argv[ix][2]));
28 	break;
29       }
30     }
31     for (; ix < argc; ix++) {
32       DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix]));
33       result = factorial (atoi(argv[ix]));
34       printf ("%d\n", result);
35     }
36     DBUG_RETURN (0);
37   }
38 }
39