xref: /freebsd/crypto/openssh/regress/misc/sk-dummy/fatal.c (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
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