예제 #1
0
int main(int argc, char *argv[])
{
  char *filename;
  EventProc proc;
  Res res;

  filename = parseArgs(argc,argv);

  if (strcmp(filename, "-") == 0)
    input = stdin;
  else {
    input = fopen(filename, "rb");
    if (input == NULL)
      error("unable to open \"%s\"\n", filename);
  }

  res = EventProcCreate(&proc, partialLog, logReader, (void *)input);
  if (res != ResOK)
    error("Can't init EventProc module: error %d.", res);

  res = EventRepInit(partialLog);
  if (res != ResOK)
    error("Can't init EventRep module: error %d.", res);

  readLog(proc);

  EventRepFinish();
  EventProcDestroy(proc);
  return EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
  char *filename;
  EventProc proc;
  Res res;

#if !defined(MPS_OS_FR)
  /* GCC -ansi -pedantic -Werror on FreeBSD will fail here
   * with the warning "statement with no effect". */

  assert(CHECKCONV(ulong, Word));
  assert(CHECKCONV(ulong, Addr));
  assert(CHECKCONV(ulong, void *));
  assert(CHECKCONV(unsigned, EventCode));
  assert(CHECKCONV(Addr, void *)); /* for labelled pointers */
#endif

  filename = parseArgs(argc, argv);

  if (strcmp(filename, "-") == 0)
    input = stdin;
  else {
    input = fopen(filename, "rb");
    if (input == NULL)
      error("unable to open \"%s\"\n", filename);
  }

  res = EventProcCreate(&proc, partialLog, logReader, (void *)input);
  if (res != ResOK)
    error("Can't init EventProc module: error %d.", res);

  readLog(proc);

  EventProcDestroy(proc);
  return EXIT_SUCCESS;
}