~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to dbug/my_main.c

Renamed more stuff to drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 DBUG_OFF                         /* We are testing dbug */
 
7
#undef DBUG_OFF
 
8
#endif
 
9
 
 
10
#include <my_global.h>  /* This includes dbug.h */
 
11
#include <my_pthread.h>
 
12
 
 
13
int main (argc, argv)
 
14
int argc;
 
15
char *argv[];
 
16
{
 
17
  register int result, ix;
 
18
  extern int factorial(int);
 
19
#if defined(HAVE_PTHREAD_INIT)
 
20
  pthread_init();                       /* Must be called before DBUG_ENTER */
 
21
#endif
 
22
  my_thread_global_init();
 
23
  {
 
24
    DBUG_ENTER ("main");
 
25
    DBUG_PROCESS (argv[0]);
 
26
    for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
 
27
      switch (argv[ix][1]) {
 
28
      case '#':
 
29
        DBUG_PUSH (&(argv[ix][2]));
 
30
        break;
 
31
      }
 
32
    }
 
33
    for (; ix < argc; ix++) {
 
34
      DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix]));
 
35
      result = factorial (atoi(argv[ix]));
 
36
      printf ("%d\n", result);
 
37
    }
 
38
    DBUG_RETURN (0);
 
39
  }
 
40
}