summaryrefslogtreecommitdiff
path: root/dbug/my_main.c
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mylan>2004-11-09 17:10:08 +0100
committerunknown <serg@sergbook.mylan>2004-11-09 17:10:08 +0100
commit57a8063f80bc840e8e996745871d89f704df3adb (patch)
tree273779e87bb3f66fed491749987eb30fb23d92c5 /dbug/my_main.c
parent91fd98383cfca36b747888872a24b5a05d1490c9 (diff)
downloadmariadb-git-57a8063f80bc840e8e996745871d89f704df3adb.tar.gz
more dbug fixups to get a nicer manual (w/o my_pthread specifics)
use my_main.c for the actual build, and main.c for the manual dbug/main.c: de-mysqlify main.c dbug/my_main.c: comment added
Diffstat (limited to 'dbug/my_main.c')
-rw-r--r--dbug/my_main.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/dbug/my_main.c b/dbug/my_main.c
new file mode 100644
index 00000000000..90af23b42b9
--- /dev/null
+++ b/dbug/my_main.c
@@ -0,0 +1,39 @@
+/*
+ this is modified version of the original example main.c
+ fixed so that it could compile and run in MySQL source tree
+*/
+
+#ifdef DBUG_OFF /* We are testing dbug */
+#undef DBUG_OFF
+#endif
+
+#include <my_global.h> /* This includes dbug.h */
+
+int main (argc, argv)
+int argc;
+char *argv[];
+{
+ register int result, ix;
+ extern int factorial(int);
+#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
+ pthread_init(); /* Must be called before DBUG_ENTER */
+#endif
+ my_thread_global_init();
+ {
+ 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);
+ }
+ DBUG_RETURN (0);
+ }
+}