X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019..a86259b51b74480e80c3daacead5b638d4cf0206:/compat_err.c diff --git a/compat_err.c b/compat_err.c index 5107c460..d8b09cb2 100644 --- a/compat_err.c +++ b/compat_err.c @@ -6,7 +6,7 @@ int dummy; #else -/* $Id: compat_err.c,v 1.1 2015/10/11 21:12:54 schwarze Exp $ */ +/* $Id: compat_err.c,v 1.4 2015/11/26 07:42:11 schwarze Exp $ */ /* * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -36,22 +36,19 @@ int dummy; * SUCH DAMAGE. */ -#include #include #include #include #include #include -extern char *__progname; - static void vwarni(const char *, va_list); static void vwarnxi(const char *, va_list); static void vwarnxi(const char *fmt, va_list ap) { - fprintf(stderr, "%s: ", __progname); + fprintf(stderr, "%s: ", getprogname()); if (fmt != NULL) vfprintf(stderr, fmt, ap); } @@ -79,6 +76,18 @@ err(int eval, const char *fmt, ...) exit(eval); } +void +errx(int eval, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vwarnxi(fmt, ap); + va_end(ap); + fputc('\n', stderr); + exit(eval); +} + void warn(const char *fmt, ...) {