From f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 11 Oct 2015 21:12:54 +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'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... --- manpath.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'manpath.c') 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 * Copyright (c) 2011 Kristaps Dzonsons @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -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; } -- cgit v1.2.3