VSF Documented
err.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_ERR_H__
2#define __VSF_LINUX_ERR_H__
3
4#include <stdio.h>
5#include <stdarg.h>
6#include <stdlib.h>
7
8static inline void vwarnx(const char *fmt, va_list args)
9{
10 if (fmt != NULL) {
11 vfprintf(stderr, fmt, args);
12 }
13}
14
15static inline void warnx(const char *fmt, ...)
16{
17 va_list args;
18 va_start(args, fmt);
19 vwarnx(fmt, args);
20 va_end(args);
21}
22
23static inline void vwarn(const char *fmt, va_list args)
24{
25 vwarnx(fmt, args);
26}
27
28static inline void warn(const char *fmt, ...)
29{
30 va_list args;
31 va_start(args, fmt);
32 vwarn(fmt, args);
33 va_end(args);
34}
35
36static inline void verr(int eval, const char *fmt, va_list args)
37{
38 vwarn(fmt, args);
39 exit(eval);
40}
41
42static inline void verrx(int eval, const char *fmt, va_list args)
43{
44 vwarnx(fmt, args);
45 exit(eval);
46}
47
48static inline void err(int eval, const char *fmt, ...)
49{
50 va_list args;
51 va_start(args, fmt);
52 verr(eval, fmt, args);
53 va_end(args);
54}
55
56static inline void errx(int eval, const char *fmt, ...)
57{
58 va_list args;
59 va_start(args, fmt);
60 verrx(eval, fmt, args);
61 va_end(args);
62}
63
64#endif // __VSF_LINUX_ERR_H__
#define NULL
Definition stddef.h:52
#define stderr
Definition stdio.h:145
#define vfprintf
Definition stdio.h:77
#define exit
Definition stdlib.h:33