~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to dbug/my_main.c

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

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) && defined(THREAD)
 
20
  pthread_init();                       /* Must be called before DBUG_ENTER */
 
21
#endif
 
22
#ifdef THREAD
 
23
  my_thread_global_init();
 
24
#endif
 
25
  {
 
26
    DBUG_ENTER ("main");
 
27
    DBUG_PROCESS (argv[0]);
 
28
    for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
 
29
      switch (argv[ix][1]) {
 
30
      case '#':
 
31
        DBUG_PUSH (&(argv[ix][2]));
 
32
        break;
 
33
      }
 
34
    }
 
35
    for (; ix < argc; ix++) {
 
36
      DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix]));
 
37
      result = factorial (atoi(argv[ix]));
 
38
      printf ("%d\n", result);
 
39
    }
 
40
    DBUG_RETURN (0);
 
41
  }
 
42
}