my_main.c 761 Bytes
Newer Older
1 2 3 4 5 6
/*
  this is modified version of the original example main.c
  fixed so that it could compile and run in MySQL source tree
*/

#include <my_global.h>	/* This includes dbug.h */
7
#include <my_sys.h>
8
#include <my_pthread.h>
9

10
int main (int argc, char **argv)
11 12 13
{
  register int result, ix;
  extern int factorial(int);
14
  MY_INIT(argv[0]);
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
  {
    DBUG_ENTER ("main");
    DBUG_PROCESS (argv[0]);
    for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
      switch (argv[ix][1]) {
      case '#':
	DBUG_PUSH (&(argv[ix][2]));
	break;
      }
    }
    for (; ix < argc; ix++) {
      DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix]));
      result = factorial (atoi(argv[ix]));
      printf ("%d\n", result);
    }
31
    DBUG_LEAVE;
32
  }
33 34
  my_end(0);
  exit(0);
35
}