aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/compat_err.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-11-06 16:30:33 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-11-06 16:30:33 +0000
commit3fffa6c6072826f70aebe72863968bffb9d714cc (patch)
tree3baa7131a7aebf9cc11c25b444093e25a01efbcc /compat_err.c
parent3e3c69e597d7b127284c4d3fc3acbffb42f51999 (diff)
downloadmandoc-3fffa6c6072826f70aebe72863968bffb9d714cc.tar.gz
mandoc-3fffa6c6072826f70aebe72863968bffb9d714cc.tar.zst
mandoc-3fffa6c6072826f70aebe72863968bffb9d714cc.zip
Use getprogname(3) rather than __progname.
Suggested by Joerg@ Sonnenberger (NetBSD). Last year, deraadt@ confirmed on tech@ that this "has the potential to be more portable", and micro-optimizing for speed is not relevant here. Also gets rid of one global variable.
Diffstat (limited to 'compat_err.c')
-rw-r--r--compat_err.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/compat_err.c b/compat_err.c
index 5107c460..3a5bac03 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.2 2015/11/06 16:30:33 schwarze Exp $ */
/*
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -43,15 +43,13 @@ int dummy;
#include <stdlib.h>
#include <string.h>
-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);
}