From 7e0fe5d8f47a04c8c04317fb08872205fd84f859 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 27 Aug 2008 14:57:51 +0100 Subject: stubdom: add v?errx? and v?warnx? functions Signed-off-by: Samuel Thibault --- extras/mini-os/lib/sys.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'extras/mini-os/lib') diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c index 21e3b1fec9..47bbbda39e 100644 --- a/extras/mini-os/lib/sys.c +++ b/extras/mini-os/lib/sys.c @@ -1035,6 +1035,68 @@ void closelog(void) syslog_ident = NULL; } +void vwarn(const char *format, va_list ap) +{ + int the_errno = errno; + printk("stubdom: "); + if (format) { + print(0, format, ap); + printk(", "); + } + printk("%s", strerror(the_errno)); +} + +void warn(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + vwarn(format, ap); + va_end(ap); +} + +void verr(int eval, const char *format, va_list ap) +{ + vwarn(format, ap); + exit(eval); +} + +void err(int eval, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + verr(eval, format, ap); + va_end(ap); +} + +void vwarnx(const char *format, va_list ap) +{ + printk("stubdom: "); + if (format) + print(0, format, ap); +} + +void warnx(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + vwarnx(format, ap); + va_end(ap); +} + +void verrx(int eval, const char *format, va_list ap) +{ + vwarnx(format, ap); + exit(eval); +} + +void errx(int eval, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + verrx(eval, format, ap); + va_end(ap); +} + int nanosleep(const struct timespec *req, struct timespec *rem) { s_time_t start = NOW(); -- cgit v1.2.3