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