1 /*****************************************************************
2 * SQUID - a library of functions for biological sequence analysis
3 * Copyright (C) 1992-2002 Washington University School of Medicine
5 * This source code is freely distributed under the terms of the
6 * GNU General Public License. See the files COPYRIGHT and LICENSE
8 *****************************************************************/
12 * error handling for the squid library
13 * RCS $Id: sqerror.c 217 2011-03-19 10:27:10Z andreas $ (Original squid RCS Id: sqerror.c,v 1.4 1999/07/15 22:28:31 eddy Exp)
16 /* a global errno equivalent */
29 * Purpose: Print an error message and die. The arguments
30 * are formatted exactly like arguments to printf().
32 * Return: None. Exits the program.
36 Die(char *format, ...)
39 /* format the error mesg */
40 fprintf(stderr, "\nFATAL: ");
41 va_start(argp, format);
42 vfprintf(stderr, format, argp);
44 fprintf(stderr, "\n");
54 * Purpose: Print an error message and return. The arguments
55 * are formatted exactly like arguments to printf().
62 Warning(char *format, ...)
64 Warn(char *format, ...)
68 /* format the error mesg */
69 fprintf(stderr, "WARNING: ");
70 va_start(argp, format);
71 vfprintf(stderr, format, argp);
73 fprintf(stderr, "\n");
79 * Purpose: Die from a lethal error that's not my problem,
80 * but instead a failure of a StdC/POSIX call that
81 * shouldn't fail. Call perror() to get the
82 * errno flag, then die.
84 * Usually called by the PANIC macro which adds
85 * the __FILE__ and __LINE__ information; see
88 * Inspired by code in Donald Lewine's book, _POSIX
89 * Programmer's Guide_.
92 Panic(char *file, int line)
94 (void) fprintf(stderr, "\nPANIC [%s line %d] ", file, line);
95 (void) perror("Unusual error");