diff options
Diffstat (limited to 'src/user/lib/err.c')
-rw-r--r-- | src/user/lib/err.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/user/lib/err.c b/src/user/lib/err.c deleted file mode 100644 index 7a220fe..0000000 --- a/src/user/lib/err.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -_Noreturn void err(int ret, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vwarn(fmt, args); - va_end(args); - exit(ret); -} - -_Noreturn void errx(int ret, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vwarnx(fmt, args); - va_end(args); - exit(ret); -} - -void warn(const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vwarn(fmt, args); - va_end(args); -} - -void warnx(const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vwarnx(fmt, args); - va_end(args); -} - -void vwarn(const char *fmt, va_list args) { - fprintf(stderr, "%s: ", getprogname()); - if (fmt) { - vfprintf(stderr, fmt, args); - fprintf(stderr, ": "); - } - fprintf(stderr, "%s\n", strerror(errno)); -} - -void vwarnx(const char *fmt, va_list args) { - fprintf(stderr, "%s: ", getprogname()); - if (fmt) vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); -} |