2004-11-09 17:10:08 +01:00
|
|
|
/*
|
|
|
|
this is modified version of the original example main.c
|
|
|
|
fixed so that it could compile and run in MySQL source tree
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <my_global.h> /* This includes dbug.h */
|
2011-12-12 22:58:24 +01:00
|
|
|
#include <my_sys.h>
|
2005-09-23 15:47:08 +02:00
|
|
|
#include <my_pthread.h>
|
2004-11-09 17:10:08 +01:00
|
|
|
|
2022-07-01 08:34:31 +02:00
|
|
|
int main (int argc, char **argv)
|
2004-11-09 17:10:08 +01:00
|
|
|
{
|
|
|
|
register int result, ix;
|
|
|
|
extern int factorial(int);
|
2011-12-12 22:58:24 +01:00
|
|
|
MY_INIT(argv[0]);
|
2011-01-11 10:07:37 +01:00
|
|
|
|
2004-11-09 17:10:08 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2011-12-12 22:58:24 +01:00
|
|
|
DBUG_LEAVE;
|
2004-11-09 17:10:08 +01:00
|
|
|
}
|
2011-12-12 22:58:24 +01:00
|
|
|
my_end(0);
|
|
|
|
exit(0);
|
2004-11-09 17:10:08 +01:00
|
|
|
}
|