diff options
| author | Brent Cook <busterb@gmail.com> | 2022-03-16 04:21:18 -0500 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2022-03-16 04:21:52 -0500 |
| commit | f6deadbec9bd455ef1851da07ab7ecd401a92d6d (patch) | |
| tree | 1e3af3cfc2db20e6c6205798add3c37f125db00c | |
| parent | 15d1f01e0f36228c501584c858697203b34e835d (diff) | |
| download | portable-f6deadbec9bd455ef1851da07ab7ecd401a92d6d.tar.gz portable-f6deadbec9bd455ef1851da07ab7ecd401a92d6d.tar.bz2 portable-f6deadbec9bd455ef1851da07ab7ecd401a92d6d.zip | |
add vwarnx
| -rw-r--r-- | include/compat/err.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/compat/err.h b/include/compat/err.h index 8b5b635..945a75d 100644 --- a/include/compat/err.h +++ b/include/compat/err.h | |||
| @@ -73,15 +73,21 @@ warn(const char *fmt, ...) | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static inline void | 75 | static inline void |
| 76 | vwarnx(const char *fmt, va_list args) | ||
| 77 | { | ||
| 78 | if (fmt != NULL) | ||
| 79 | vfprintf(stderr, fmt, args); | ||
| 80 | fprintf(stderr, "\n"); | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline void | ||
| 76 | warnx(const char *fmt, ...) | 84 | warnx(const char *fmt, ...) |
| 77 | { | 85 | { |
| 78 | va_list ap; | 86 | va_list ap; |
| 79 | 87 | ||
| 80 | va_start(ap, fmt); | 88 | va_start(ap, fmt); |
| 81 | if (fmt != NULL) | 89 | vwarnx(fmt, ap); |
| 82 | vfprintf(stderr, fmt, ap); | ||
| 83 | va_end(ap); | 90 | va_end(ap); |
| 84 | fprintf(stderr, "\n"); | ||
| 85 | } | 91 | } |
| 86 | 92 | ||
| 87 | #endif | 93 | #endif |
