From 8ac68ecab5734d5c5f3638397e5a9e6084fe7737 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 27 Dec 2022 22:42:06 +0100 Subject: sh: minor usability / aesthetic improvements --- src/user/lib/err.c | 14 ++++++++++++++ src/user/lib/include/err.h | 2 ++ 2 files changed, 16 insertions(+) (limited to 'src/user/lib') diff --git a/src/user/lib/err.c b/src/user/lib/err.c index 7684b6d..7a220fe 100644 --- a/src/user/lib/err.c +++ b/src/user/lib/err.c @@ -20,6 +20,20 @@ _Noreturn void errx(int ret, const char *fmt, ...) { 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) { diff --git a/src/user/lib/include/err.h b/src/user/lib/include/err.h index 9ce4253..6b63c6c 100644 --- a/src/user/lib/include/err.h +++ b/src/user/lib/include/err.h @@ -3,6 +3,8 @@ _Noreturn void err(int ret, const char *fmt, ...); _Noreturn void errx(int ret, const char *fmt, ...); +void warn(const char *fmt, ...); +void warnx(const char *fmt, ...); void vwarn(const char *fmt, va_list args); void vwarnx(const char *fmt, va_list args); -- cgit v1.2.3