mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
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
This commit is contained in:
@@ -22,7 +22,7 @@ noinst_HEADERS = dbug_long.h
|
|||||||
libdbug_a_SOURCES = dbug.c sanity.c
|
libdbug_a_SOURCES = dbug.c sanity.c
|
||||||
EXTRA_DIST = example1.c example2.c example3.c \
|
EXTRA_DIST = example1.c example2.c example3.c \
|
||||||
user.r monty.doc readme.prof dbug_add_tags.pl \
|
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 \
|
NROFF_INC = example1.r example2.r example3.r main.r \
|
||||||
factorial.r output1.r output2.r output3.r \
|
factorial.r output1.r output2.r output3.r \
|
||||||
output4.r output5.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
|
# Must be linked with libs that are not compiled yet
|
||||||
noinst_PROGRAMS = factorial dbug_analyze
|
noinst_PROGRAMS = factorial dbug_analyze
|
||||||
factorial_SOURCES = main.c factorial.c
|
factorial_SOURCES = my_main.c factorial.c
|
||||||
dbug_analyze_SOURCES = dbug_analyze.c
|
dbug_analyze_SOURCES = dbug_analyze.c
|
||||||
|
|
||||||
all: user.t user.ps
|
all: user.t user.ps
|
||||||
|
40
dbug/main.c
40
dbug/main.c
@@ -1,34 +1,24 @@
|
|||||||
#ifdef DBUG_OFF /* We are testing dbug */
|
#include <dbug_long.h>
|
||||||
#undef DBUG_OFF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <my_global.h> /* This includes dbug.h */
|
|
||||||
|
|
||||||
int main (argc, argv)
|
int main (argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
register int result, ix;
|
int result, ix;
|
||||||
extern int factorial(int);
|
extern int factorial(int);
|
||||||
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
|
DBUG_ENTER ("main");
|
||||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
DBUG_PROCESS (argv[0]);
|
||||||
#endif
|
for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
|
||||||
my_thread_global_init();
|
switch (argv[ix][1]) {
|
||||||
{
|
case '#':
|
||||||
DBUG_ENTER ("main");
|
DBUG_PUSH (&(argv[ix][2]));
|
||||||
DBUG_PROCESS (argv[0]);
|
break;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
39
dbug/my_main.c
Normal file
39
dbug/my_main.c
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user