summaryrefslogtreecommitdiffstats
path: root/regress/misc/sk-dummy/fatal.c
blob: c6e4b5d6fa710c19af1f0d3481992a8baca219b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* public domain */

#include "includes.h"

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>

#include "log.h"

void
sshfatal(const char *file, const char *func, int line, int showfunc,
    LogLevel level, const char *suffix, const char *fmt, ...)
{
	va_list ap;

	if (showfunc)
		fprintf(stderr, "%s: ", func);
	va_start(ap, fmt);
	vfprintf(stderr, fmt, ap);
	va_end(ap);
	if (suffix != NULL)
		fprintf(stderr, ": %s", suffix);
	fputc('\n', stderr);
	_exit(1);
}