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