aboutsummaryrefslogtreecommitdiff
path: root/common/err.h
blob: b9faf117dc1b81fc799c93fb7277069b96ee3c8b (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
#ifndef _COMMON_ERR_H_
#define _COMMON_ERR_H_

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

static inline void error(const char *format, ...)
{
	va_list args;
	va_start(args, format);
	vfprintf(stderr, format, args);
	va_end(args);
	exit(1);
}

static inline void syserror(const char *call, FILE *file)
{
	perror(call);

	if (file)
		fclose(file);

	exit(1);
}

#endif