diff options
author | 2015-10-11 21:06:59 +0000 | |
---|---|---|
committer | 2015-10-11 21:06:59 +0000 | |
commit | eba1598bbc7f18d6171356c7024e7b6bb98fefbd (patch) | |
tree | 3fb4a9dbceedf25618f9199e9a115a8fb1e19fd7 /usr.bin/mandoc/manpath.c | |
parent | Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept (diff) | |
download | wireguard-openbsd-eba1598bbc7f18d6171356c7024e7b6bb98fefbd.tar.xz wireguard-openbsd-eba1598bbc7f18d6171356c7024e7b6bb98fefbd.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 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.
Diffstat (limited to 'usr.bin/mandoc/manpath.c')
-rw-r--r-- | usr.bin/mandoc/manpath.c | 15 |
1 files changed, 6 insertions, 9 deletions
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 <schwarze@openbsd.org> * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -19,6 +19,7 @@ #include <sys/stat.h> #include <ctype.h> +#include <err.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -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; } |