1 /*****************************************************************
2 * HMMER - Biological sequence analysis with profile HMMs
3 * Copyright (C) 1992-1999 Washington University School of Medicine
6 * This source code is distributed under the terms of the
7 * GNU General Public License. See the files COPYING and LICENSE
9 *****************************************************************/
13 * error handling for the squid library
14 * RCS $Id: sqerror.c,v 1.1.1.1 2005/03/22 08:34:26 cmzmasek Exp $
17 /* a global errno equivalent */
30 * Purpose: Print an error message and die. The arguments
31 * are formatted exactly like arguments to printf().
33 * Return: None. Exits the program.
37 Die(char *format, ...)
40 /* format the error mesg */
41 fprintf(stderr, "\nFATAL: ");
42 va_start(argp, format);
43 vfprintf(stderr, format, argp);
45 fprintf(stderr, "\n");
55 * Purpose: Print an error message and return. The arguments
56 * are formatted exactly like arguments to printf().
62 Warn(char *format, ...)
65 /* format the error mesg */
66 fprintf(stderr, "WARNING: ");
67 va_start(argp, format);
68 vfprintf(stderr, format, argp);
70 fprintf(stderr, "\n");
76 * Purpose: Die from a lethal error that's not my problem,
77 * but instead a failure of a StdC/POSIX call that
78 * shouldn't fail. Call perror() to get the
79 * errno flag, then die.
81 * Usually called by the PANIC macro which adds
82 * the __FILE__ and __LINE__ information; see
85 * Inspired by code in Donald Lewine's book, _POSIX
86 * Programmer's Guide_.
89 Panic(char *file, int line)
91 (void) fprintf(stderr, "\nPANIC [%s line %d] ", file, line);
92 (void) perror("Unusual error");