xref: /freebsd/crypto/openssh/regress/misc/sk-dummy/fatal.c (revision 19261079b74319502c6ffa1249920079f0f69a72)
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
sshfatal(const char * file,const char * func,int line,int showfunc,LogLevel level,const char * suffix,const char * fmt,...)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