| 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 | #include <my_global.h> /* This includes dbug.h */ |
| 7 | #include <my_sys.h> |
| 8 | #include <my_pthread.h> |
| 9 | |
| 10 | int main (argc, argv) |
| 11 | int argc; |
| 12 | char *argv[]; |
| 13 | { |
| 14 | register int result, ix; |
| 15 | extern int factorial(int); |
| 16 | MY_INIT(argv[0]); |
| 17 | |
| 18 | { |
| 19 | DBUG_ENTER ("main"); |
| 20 | DBUG_PROCESS (argv[0]); |
| 21 | for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) { |
| 22 | switch (argv[ix][1]) { |
| 23 | case '#': |
| 24 | DBUG_PUSH (&(argv[ix][2])); |
| 25 | break; |
| 26 | } |
| 27 | } |
| 28 | for (; ix < argc; ix++) { |
| 29 | DBUG_PRINT ("args", ( "argv[%d] = %s", ix, argv[ix])); |
| 30 | result = factorial (atoi(argv[ix])); |
| 31 | printf ("%d\n", result); |
| 32 | } |
| 33 | DBUG_LEAVE; |
| 34 | } |
| 35 | my_end(0); |
| 36 | exit(0); |
| 37 | } |
| 38 |