summaryrefslogtreecommitdiff
path: root/dbug/main.c
blob: 00e80c8ba317211cfe12d7d18acd9ab0f080060e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <dbug.h>

int main (argc, argv)
int argc;
char *argv[];
{
  int result, ix;
  extern int factorial(int);
  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);
}