diff options
author | grant <grant@pkgsrc.org> | 2003-09-15 07:39:34 +0000 |
---|---|---|
committer | grant <grant@pkgsrc.org> | 2003-09-15 07:39:34 +0000 |
commit | 24f702fdcb8ea1ec5d299cb90b344b51d99df81a (patch) | |
tree | bbba076cef9525aebed9535d8a08838a14f46388 /pkgtools/libnbcompat | |
parent | 138beab501a61b61b692659ce57d495273e6fbb5 (diff) | |
download | pkgsrc-24f702fdcb8ea1ec5d299cb90b344b51d99df81a.tar.gz |
add v{err,warn}{,x}.
Diffstat (limited to 'pkgtools/libnbcompat')
-rw-r--r-- | pkgtools/libnbcompat/files/err.c | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/pkgtools/libnbcompat/files/err.c b/pkgtools/libnbcompat/files/err.c index d667d25ecee..f5abf9f49a3 100644 --- a/pkgtools/libnbcompat/files/err.c +++ b/pkgtools/libnbcompat/files/err.c @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.2 2003/09/06 23:03:01 grant Exp $ */ +/* $NetBSD: err.c,v 1.3 2003/09/15 07:39:34 grant Exp $ */ /* * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>. @@ -62,6 +62,37 @@ errx(int eval, const char *fmt, ...) } void +verr(eval, fmt, ap) + int eval; + const char *fmt; + va_list ap; +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", getprogname()); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + exit(eval); +} + +void +verrx(eval, fmt, ap) + int eval; + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", getprogname()); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + exit(eval); +} + +void warn(const char *fmt, ...) { va_list ap; @@ -90,3 +121,30 @@ warnx(const char *fmt, ...) va_end(ap); (void)fprintf(stderr, "\n"); } + +void +vwarn(fmt, ap) + const char *fmt; + va_list ap; +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", getprogname()); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); +} + +void +vwarnx(fmt, ap) + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", getprogname()); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); +} |