xref: /freebsd/crypto/openssh/regress/misc/sk-dummy/fatal.c (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 /* public domain */
2 
3 #include "includes.h"
4 
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <stdarg.h>
8 #include <unistd.h>
9 
10 #include "log.h"
11 
12 void
13 sshfatal(const char *file, const char *func, int line, int showfunc,
14     LogLevel level, const char *suffix, const char *fmt, ...)
15 {
16 	va_list ap;
17 
18 	if (showfunc)
19 		fprintf(stderr, "%s: ", func);
20 	va_start(ap, fmt);
21 	vfprintf(stderr, fmt, ap);
22 	va_end(ap);
23 	if (suffix != NULL)
24 		fprintf(stderr, ": %s", suffix);
25 	fputc('\n', stderr);
26 	_exit(1);
27 }
28