home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 0 / 0987 / panic.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  1.5 KB  |  67 lines

  1. /* 
  2.  * panic.c --
  3.  *
  4.  *    Source code for the "panic" library procedure.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/lib/c/etc/RCS/panic.c,v 1.7 89/04/12 12:43:02 ouster Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <varargs.h>
  23.  
  24. /*
  25.  *----------------------------------------------------------------------
  26.  *
  27.  * panic --
  28.  *
  29.  *    Print an error message and kill the process.
  30.  *
  31.  * Results:
  32.  *    None.
  33.  *
  34.  * Side effects:
  35.  *    The process dies, entering the debugger if possible.
  36.  *
  37.  *----------------------------------------------------------------------
  38.  */
  39.  
  40. #ifndef lint
  41. void
  42. panic(va_alist)
  43.     va_dcl            /* char *format, then any number of additional
  44.                  * values to be printed under the control of
  45.                  * format.  This is all just the same as you'd
  46.                  * pass to printf. */
  47. {
  48.     char *format;
  49.     va_list args;
  50.  
  51.     va_start(args);
  52.     format = va_arg(args, char *);
  53.     (void) vfprintf(stderr, format, args);
  54.     (void) fflush(stderr);
  55.     abort();
  56. }
  57. #else
  58. /* VARARGS1 */
  59. /* ARGSUSED */
  60. void
  61. panic(format)
  62.     char *format;
  63. {
  64.     return;
  65. }
  66. #endif /* lint */
  67.