Commit 57a8063f authored by unknown's avatar unknown

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
parent 91fd9838
......@@ -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
......
#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);
}
/*
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);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment