2004-11-11 14:42:35 +01:00
|
|
|
#include <dbug.h>
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
int main (argc, argv)
|
|
|
|
int argc;
|
|
|
|
char *argv[];
|
|
|
|
{
|
2004-11-09 17:10:08 +01:00
|
|
|
int result, ix;
|
2000-07-31 21:29:14 +02:00
|
|
|
extern int factorial(int);
|
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;
|
2000-07-31 21:29:14 +02:00
|
|
|
}
|
|
|
|
}
|
2004-11-09 17:10:08 +01:00
|
|
|
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);
|
2000-07-31 21:29:14 +02:00
|
|
|
}
|