From eba1598bbc7f18d6171356c7024e7b6bb98fefbd Mon Sep 17 00:00:00 2001 From: schwarze Date: Sun, 11 Oct 2015 21:06:59 +0000 Subject: 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 also shortens the code by 50 lines. It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, it's the job of the portable distribution to provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. Actually, the compat code for the portable distribution already exists and will be committed right after this. --- usr.bin/mandoc/manpath.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'usr.bin/mandoc/manpath.c') diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c index 918f0064fcb..9788e60388a 100644 --- a/usr.bin/mandoc/manpath.c +++ b/usr.bin/mandoc/manpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: manpath.c,v 1.15 2015/05/07 12:07:29 schwarze Exp $ */ +/* $OpenBSD: manpath.c,v 1.16 2015/10/11 21:06:59 schwarze Exp $ */ /* * Copyright (c) 2011, 2014, 2015 Ingo Schwarze * Copyright (c) 2011 Kristaps Dzonsons @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -117,10 +118,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; } @@ -129,10 +128,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; } -- cgit v1.2.3-59-g8ed1b