home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / WINWAIS / IR / PANIC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-07  |  1.1 KB  |  52 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE:
  2.    No guarantees or restrictions.  See the readme file for the full standard
  3.    disclaimer.
  4.  
  5.    Morris@think.com
  6. */
  7.  
  8. /* panic is an error system interface.  On the Mac, it will pop
  9.  * up a little window to explain the problem.
  10.  * On a unix box, it will print out the error and call perror()
  11.  */
  12.  
  13. #include "cdialect.h"
  14. #include "panic.h"
  15. //#include "futil.h"
  16. #include <ctype.h>
  17. #include <varargs.h>
  18.  
  19. #ifndef EXIT_FAILURE  /* should be in stdlib */
  20. #define EXIT_FAILURE (-1)
  21. #endif /* ndef EXIT_FAILURE */
  22.  
  23. static void exitAction _AP((long error));
  24.  
  25. static void
  26. exitAction(error)
  27. long error;
  28. {
  29.   abort();
  30. }
  31.  
  32. #define PANIC_HEADER "Fatal Error:  "
  33.  
  34. void
  35. panic(va_alist)
  36. va_dcl
  37. {
  38.   va_list ap;                   /* the variable arguments */
  39.   char* format;
  40.  
  41.   fprintf(stderr,PANIC_HEADER);
  42.   va_start(ap);                 /* init ap */
  43.   format = va_arg(ap,char*);    /* get the format */
  44.   vfprintf(stderr,format,ap);   /* print the contents */
  45.   va_end(ap);                   /* free ap */
  46.  
  47.   fprintf(stderr,"\n");
  48.   fflush(stderr);
  49.  
  50.   exitAction(0);
  51. }
  52.