home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / atomart.tar.gz / atomart.tar / message.c < prev    next >
C/C++ Source or Header  |  1990-06-14  |  652b  |  58 lines

  1. #include <stdio.h>
  2.  
  3. extern int    linecount;
  4. extern FILE    *logfile;
  5.  
  6. /*
  7.  * yyerror
  8.  *
  9.  *    error routine for yacc, assumed fatal
  10.  */
  11. yyerror(s)
  12.     char    *s;
  13. {
  14.     fprintf(stderr, "atomart: line %d - %s\n", linecount, s);
  15.     fprintf(logfile, "atomart: line %d - %s\n", linecount, s);
  16.     exit(1);
  17. }
  18.  
  19. /*
  20.  * message
  21.  *
  22.  *    log a message.
  23.  */
  24. message(s)
  25.     char    *s;
  26. {
  27.     fprintf(logfile, s);
  28. }
  29.  
  30. /*
  31.  * warning
  32.  *
  33.  *    print and log a warning.
  34.  */
  35. warning(s)
  36.     char    *s;
  37. {
  38.     fprintf(stderr, s);
  39.     fprintf(logfile, s);
  40. }
  41.  
  42. /*
  43.  * fatal
  44.  *
  45.  *    print and log a fatal message and exit
  46.  */
  47. fatal(s)
  48.     char    *s;
  49. {
  50.     fprintf(stderr, s);
  51.  
  52.     if (logfile != stdout)
  53.         fprintf(logfile, s);
  54.  
  55.     exit(1);
  56. }
  57.  
  58.