aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/errors.h5
-rw-r--r--lib/errors/cerrx.c14
-rw-r--r--lib/errors/errx.c14
-rw-r--r--lib/errors/vwarn.c4
-rw-r--r--lib/errors/vwarnx.c12
-rw-r--r--lib/errors/warnx.c12
6 files changed, 3 insertions, 58 deletions
diff --git a/include/errors.h b/include/errors.h
index 1a803b5..1e5d41f 100644
--- a/include/errors.h
+++ b/include/errors.h
@@ -4,16 +4,11 @@
#include <stdarg.h>
[[gnu::__format__(printf, 1, 2)]] void warn(const char *, ...);
-[[gnu::__format__(printf, 1, 2)]] void warnx(const char *, ...);
void vwarn(const char *, va_list);
-void vwarnx(const char *, va_list);
[[__noreturn__, gnu::__format__(printf, 1, 2)]] void err(const char *, ...);
-[[__noreturn__, gnu::__format__(printf, 1, 2)]] void errx(const char *, ...);
[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerr(int, const char *,
...);
-[[__noreturn__, gnu::__format__(printf, 2, 3)]] void cerrx(int, const char *,
- ...);
extern const char *__mlib_errors_progname;
diff --git a/lib/errors/cerrx.c b/lib/errors/cerrx.c
deleted file mode 100644
index b614f47..0000000
--- a/lib/errors/cerrx.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include "errors.h"
-
-void
-cerrx(int code, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
- exit(code);
-}
diff --git a/lib/errors/errx.c b/lib/errors/errx.c
deleted file mode 100644
index 1fd55af..0000000
--- a/lib/errors/errx.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include "errors.h"
-
-void
-errx(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
- exit(EXIT_FAILURE);
-}
diff --git a/lib/errors/vwarn.c b/lib/errors/vwarn.c
index 99b2c9b..342c391 100644
--- a/lib/errors/vwarn.c
+++ b/lib/errors/vwarn.c
@@ -11,5 +11,7 @@ vwarn(const char *fmt, va_list ap)
int save = errno;
fprintf(stderr, "%s: ", mlib_progname());
vfprintf(stderr, fmt, ap);
- fprintf(stderr, ": %s\n", strerror(save));
+ if (fmt[strlen(fmt) - 1] == ':')
+ fprintf(stderr, " %s", strerror(save));
+ fputc('\n', stderr);
}
diff --git a/lib/errors/vwarnx.c b/lib/errors/vwarnx.c
deleted file mode 100644
index 58a7bc6..0000000
--- a/lib/errors/vwarnx.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "errors.h"
-
-void
-vwarnx(const char *fmt, va_list ap)
-{
- fprintf(stderr, "%s: ", mlib_progname());
- vfprintf(stderr, fmt, ap);
- fputc('\n', stderr);
-}
diff --git a/lib/errors/warnx.c b/lib/errors/warnx.c
deleted file mode 100644
index ea50299..0000000
--- a/lib/errors/warnx.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdarg.h>
-
-#include "errors.h"
-
-void
-warnx(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
-}