f92ad96b |
1 | /************************* Start of ERRHAND.C ************************ |
2 | * |
3 | * This is a general purpose error handler used with every program in |
4 | * the book. |
5 | */ |
6 | |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
9 | #include <stdarg.h> |
10 | #include "errhand.h" |
11 | /* |
12 | #ifdef __STDC__ |
13 | |
14 | |
15 | #else |
16 | #ifdef __UNIX__ |
17 | void fatal_error( fmt, va_alist ) |
18 | char *fmt; |
19 | va_dcl |
20 | #else |
21 | void fatal_error( fmt ) |
22 | char *fmt; |
23 | #endif |
24 | #endif |
25 | */ |
26 | void fatal_error( char *fmt, ... ) |
27 | { |
28 | va_list argptr; |
29 | |
30 | va_start( argptr, fmt ); |
31 | printf( "Fatal error: " ); |
32 | vprintf( fmt, argptr ); |
33 | va_end( argptr ); |
34 | exit( -1 ); |
35 | } |
36 | |
37 | /************************** End of ERRHAND.C *************************/ |
38 | |