-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.h
32 lines (28 loc) · 1.1 KB
/
error.h
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
28
29
30
31
32
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#pragma once
#define enprintf(ret, ...) \
do { \
if (!(ret < 0)) \
break; \
fprintf(stderr, __VA_ARGS__); \
exit(ret); \
} while (0)
#define esprintf(ret, ...) \
do { \
if (!(ret < 0)) \
break; \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, ": %s\n", strerror(errno)); \
exit(ret); \
} while (0)
#define etcprintf(ret, tc, ...) \
do { \
if (!(ret < 0)) \
break; \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, ": %s\n", tls_config_error(tc)); \
exit(ret); \
} while (0)