summaryrefslogtreecommitdiff
path: root/dbug
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
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')
-rw-r--r--dbug/Makefile.am4
-rw-r--r--dbug/main.c40
-rw-r--r--dbug/my_main.c39
3 files changed, 56 insertions, 27 deletions
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
index b54e0011a77..5cec9491a84 100644
--- a/dbug/Makefile.am
+++ b/dbug/Makefile.am
@@ -22,7 +22,7 @@ noinst_HEADERS = dbug_long.h
libdbug_a_SOURCES = dbug.c sanity.c
EXTRA_DIST = example1.c example2.c example3.c \
user.r monty.doc readme.prof dbug_add_tags.pl \
- main.c factorial.c dbug_analyze.c
+ my_main.c main.c factorial.c dbug_analyze.c
NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \
output4.r output5.r
@@ -30,7 +30,7 @@ NROFF_INC = example1.r example2.r example3.r main.r \
# Must be linked with libs that are not compiled yet
noinst_PROGRAMS = factorial dbug_analyze
-factorial_SOURCES = main.c factorial.c
+factorial_SOURCES = my_main.c factorial.c
dbug_analyze_SOURCES = dbug_analyze.c
all: user.t user.ps
diff --git a/dbug/main.c b/dbug/main.c
index 4f37dd7a96d..6d1a307095e 100644
--- a/dbug/main.c
+++ b/dbug/main.c
@@ -1,34 +1,24 @@
-#ifdef DBUG_OFF /* We are testing dbug */
-#undef DBUG_OFF
-#endif
-
-#include <my_global.h> /* This includes dbug.h */
+#include <dbug_long.h>
int main (argc, argv)
int argc;
char *argv[];
{
- register int result, ix;
+ 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_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;
}
- DBUG_RETURN (0);
}
+ 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);
}
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);
+ }
+}