home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / lbl / src / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  801 b   |  42 lines

  1. /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
  2.  *
  3.  *    Permission is hereby given to reproduce or modify this
  4.  *    software freely, provided that this notice be retained,
  5.  *    and that no use be made of the software for commercial
  6.  *    purposes without the express written permission of the
  7.  *    author.
  8.  */
  9.  
  10. /* error.c:
  11.  *    report and handle errors
  12.  */
  13.  
  14. #include    <lbl.h>
  15.  
  16. extern char    *progname;
  17. extern char    *filename;
  18. extern char    tempname[];
  19. extern long    fileline;
  20.  
  21. /*VARARGS1*/
  22. error(msg, arg1)
  23.     char    *msg;
  24.     char    *arg1;
  25. {
  26.     fprintf(stderr, "%s: ", progname);
  27.     if (filename != NULL)
  28.         fprintf(stderr, "%s, line %D - ", filename, fileline);
  29.     fprintf(stderr, msg, arg1);
  30.     fprintf(stderr, "\n");
  31. }
  32.  
  33. /*VARARGS1*/
  34. fatal(msg, arg1)
  35.     char    *msg;
  36.     char    *arg1;
  37. {
  38.     error(msg, arg1);
  39.     unlink(tempname);
  40.     exit(1);
  41. }
  42.