aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/glibc/generic/err.cpp
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:52 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 18:24:51 -0500
commitf5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch)
tree93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/options/glibc/generic/err.cpp
parentbd5969fc876a10b18613302db7087ef3c40f18e1 (diff)
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/options/glibc/generic/err.cpp')
-rw-r--r--lib/mlibc/options/glibc/generic/err.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/lib/mlibc/options/glibc/generic/err.cpp b/lib/mlibc/options/glibc/generic/err.cpp
deleted file mode 100644
index 042c1d8..0000000
--- a/lib/mlibc/options/glibc/generic/err.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <err.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-// va_list
-
-void vwarn(const char *fmt, va_list params) {
- fprintf(stderr, "%s: ", program_invocation_short_name);
- if (fmt) {
- vfprintf(stderr, fmt, params);
- fwrite(": ", 1, 2, stderr);
- }
- perror(NULL);
-}
-
-void vwarnx(const char *fmt, va_list params) {
- fprintf(stderr, "%s: ", program_invocation_short_name);
- if (fmt) {
- vfprintf(stderr, fmt, params);
- }
- putc('\n', stderr);
-}
-
-__attribute__((__noreturn__)) void verr(int status, const char *fmt, va_list params) {
- vwarn(fmt, params);
- exit(status);
-}
-
-__attribute__((__noreturn__)) void verrx(int status, const char *fmt, va_list params) {
- vwarnx(fmt, params);
- exit(status);
-}
-
-// variadic
-
-void warn(const char *fmt, ...) {
- va_list params;
- va_start(params, fmt);
- vwarn(fmt, params);
- va_end(params);
-}
-
-void warnx(const char *fmt, ...) {
- va_list params;
- va_start(params, fmt);
- vwarnx(fmt, params);
- va_end(params);
-}
-
-__attribute__((__noreturn__)) void err(int status, const char *fmt, ...) {
- va_list params;
- va_start(params, fmt);
- verr(status, fmt, params);
- va_end(params);
-}
-
-__attribute__((__noreturn__)) void errx(int status, const char *fmt, ...) {
- va_list params;
- va_start(params, fmt);
- verrx(status, fmt, params);
- va_end(params);
-}