aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manpath.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
commitf9e640f1c0dc5d4fbffde207f2a4b0350d1a0019 (patch)
treeab150c9d46fcd3c701e8245e2f3d5ccbab0db7be /manpath.c
parentede48977046b65029014a425213d622d938c74c4 (diff)
downloadmandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.gz
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.zst
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.zip
Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, let's provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. The compat module has an UCB Copyright (c) 1993...
Diffstat (limited to 'manpath.c')
-rw-r--r--manpath.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/manpath.c b/manpath.c
index 532bdb30..f912e766 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.26 2015/06/10 19:26:13 schwarze Exp $ */
+/* $Id: manpath.c,v 1.27 2015/10/11 21:12:55 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -21,6 +21,7 @@
#include <sys/stat.h>
#include <ctype.h>
+#include <err.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -165,10 +166,8 @@ manpath_add(struct manpaths *dirs, const char *dir, int complain)
size_t i;
if (NULL == (cp = realpath(dir, buf))) {
- if (complain) {
- fputs("manpath: ", stderr);
- perror(dir);
- }
+ if (complain)
+ warn("manpath: %s", dir);
return;
}
@@ -177,10 +176,8 @@ manpath_add(struct manpaths *dirs, const char *dir, int complain)
return;
if (stat(cp, &sb) == -1) {
- if (complain) {
- fputs("manpath: ", stderr);
- perror(dir);
- }
+ if (complain)
+ warn("manpath: %s", dir);
return;
}