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
|
/*
* quit.c
*
* By Ross Ridge
* Public Domain
* 92/02/01 07:30:14
*
* quit with a diagnostic message printed on stderr
*
*/
#define NOTLIB
#include "defs.h"
#ifdef USE_SCCS_IDS
static const char SCCSid[] = "@(#) mytinfo quit.c 3.2 92/02/01 public domain, By Ross Ridge";
#endif
char *prg_name;
#if defined(USE_PROTOTYPES) && !defined(lint)
void (*cleanup)(int);
#else
void (*cleanup)();
#endif
/* PRINTFLIKE2 */
noreturn
#ifdef USE_STDARG
#ifdef USE_PROTOTYPES
void
quit(int e, char *fmt, ...)
#else
void quit(e, fmt)
int e;
char *fmt;
#endif
#else
void quit(va_alist)
va_dcl
#endif
{
#ifndef USE_STDARG
int e;
char *fmt;
#endif
va_list ap;
#ifdef USE_STDARG
va_start(ap, fmt);
#else
va_start(ap);
e = va_arg(ap, int);
fmt = va_arg(ap, char *);
#endif
(*cleanup)(e);
if (e != 0)
fprintf(stderr, "%s: ", prg_name);
#ifdef USE_DOPRNT
_doprnt(fmt, ap, stderr);
#else
vfprintf(stderr, fmt, ap);
#endif
putc('\n', stderr);
if (e > 0 && e < sys_nerr) {
fprintf(stderr, "%d - %s\n", e, sys_errlist[e]);
}
fflush(stderr);
exit(e);
}
|