1  /* TESTLOGMSG.C - Test harness for logsetup(), logmsg() and logdump() */
2  
3  #include <stdio.h>
4
dump
5  #ifdef OSK
6  #include <strings.h>
7  #else
8  #include <string.h>
9  #include <stdlib.h>
10  #endif
11  
12  #include "logmsg.h"
13  
14  main(argc, argv)
15  int     argc;
16  char    **argv;
17  {
18      char    line[80];
19      long    i, j;
20      long    waitfact;
21      int     mode;
22  
23      if (argc<2)
24          waitfact = 0;
25      else
26          waitfact = atol(argv[1]);
27      printf("Wait factor = %ld\n", waitfact);
28  
29      if (argc<3)
30          mode = INDIRECT_LOG;
31      else
32          mode = atoi(argv[2]);
33      printf("Mode = %d\n", mode);
34  
35      logsetup(mode,STDOUT_LOG);
36      
37      while (gets(line)) {
38          if (strcmp(line,"end")==0) break;
39          if (strcmp(line,"quit")==0) break;
40          if (strcmp(line,"dump")==0) {
41              printf("Dump requested\n");
42              logdump();
43          }
44          else
45              logmsg("Input was: %s\n", line);
46          /*
47              Waste some time
48          */
49          if (waitfact)
50              for (i=0; i<waitfact; i++)
51                  j = strlen(line);
52      }
53      printf("Final dump\n");
54      logdump();
55      return 0;
56  }
