/* log formatted error messages */

    #include < stdio.h>
    #include < stdarg.h>

    int eprint (const char *format, ...)
    {
      extern FILE *logfile;
      int n;
      va_list ap;

      va_start(ap, format);
      fprintf(stderr, "\aERROR: ");
      vfprintf(stderr, format, ap);
      va_start(ap, format);
      n = vfprintf(logfile, format, ap);
      va_end(ap);
      return (n);
    }

    

next slide