-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqerror.c
73 lines (65 loc) · 1.45 KB
/
sqerror.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* SQUID - A C function library for biological sequence analysis
* Copyright (C) 1992-1995 Sean R. Eddy
*
* This source code is distributed under terms of the
* GNU General Public License. See the files COPYING
* and GNULICENSE for further details.
*
*/
/* sqerror.c
*
* error handling for the squid library
*/
/* a global errno equivalent */
int squid_errno;
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef MEMDEBUG
#include "dbmalloc.h"
#endif
/* Function: Die()
*
* Purpose: Print an error message and die. The arguments
* are formatted exactly like arguments to printf().
*
* Return: None. Exits the program.
*/
/* VARARGS0 */
int
Die(char *format, ...)
{
va_list argp;
/* format the error mesg */
fprintf(stderr, "FATAL: ");
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
fflush(stderr);
/* exit */
exit(1);
/*NOTREACHED*/
return 1; /* fool lint */
}
/* Function: Warn()
*
* Purpose: Print an error message and return. The arguments
* are formatted exactly like arguments to printf().
*
* Return: (void)
*/
/* VARARGS0 */
int
Warn(char *format, ...)
{
va_list argp;
/* format the error mesg */
fprintf(stderr, "WARNING: ");
va_start(argp, format);
vfprintf(stderr, format, argp);
va_end(argp);
fprintf(stderr, "\n");
fflush(stderr);
return 1;
}