home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume4 / fxref / error.c next >
Encoding:
C/C++ Source or Header  |  1989-02-03  |  620 b   |  34 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. extern char *progname;
  4. #define PROG    if(progname)fprintf(stderr,"%s: ",progname)
  5. /* This is the original version:
  6. extern int errno, sys_nerr;
  7. extern char *sys_errlist[];
  8. #define DIE    if(errno>0&&errno<sys_nerr)fprintf(stderr," (%s)",sys_errlist[errno]);fprintf(stderr,"\n");exit(1)
  9. */
  10. #define DIE    fprintf(stderr,"\007\n");exit(1)
  11.  
  12. error_(s) /* print error message and die -- from K&P p. 207 */
  13. char *s;
  14. {
  15.     PROG;
  16.     fprintf(stderr, s);
  17.     DIE;
  18. }
  19. errord(s, d)
  20. char *s;
  21. int d;
  22. {
  23.     PROG;
  24.     fprintf(stderr, s, d);
  25.     DIE;
  26. }
  27. errors(s1, s2)
  28. char *s1, *s2;
  29. {
  30.     PROG;
  31.     fprintf(stderr, s1, s2);
  32.     DIE;
  33. }
  34.