summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/resolv/herror.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind/lib/resolv/herror.c')
-rw-r--r--contrib/bind/lib/resolv/herror.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/contrib/bind/lib/resolv/herror.c b/contrib/bind/lib/resolv/herror.c
index 38217db..bf4cce6 100644
--- a/contrib/bind/lib/resolv/herror.c
+++ b/contrib/bind/lib/resolv/herror.c
@@ -32,7 +32,7 @@
*/
/*
- * Portions Copyright (c) 1996 by Internet Software Consortium.
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -49,18 +49,27 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id: herror.c,v 8.7 1996/11/18 09:10:00 vixie Exp $";
+static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
+static const char rcsid[] = "$Id: herror.c,v 8.11 1999/10/13 16:39:39 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
+
#include <sys/types.h>
#include <sys/param.h>
#include <sys/uio.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
#include <netdb.h>
+#include <resolv.h>
#include <string.h>
#include <unistd.h>
+#include <irs.h>
+
#include "port_after.h"
+#undef h_errno
const char *h_errlist[] = {
"Resolver Error 0 (no error)",
@@ -78,21 +87,19 @@ int h_errno;
* print the error indicated by the h_errno value.
*/
void
-herror(s)
- const char *s;
-{
- struct iovec iov[4];
- register struct iovec *v = iov;
+herror(const char *s) {
+ struct iovec iov[4], *v = iov;
+ extern int * __h_errno();
- if (s && *s) {
- v->iov_base = (char *)s;
+ if (s != NULL && *s != '\0') {
+ v->iov_base = (/*noconst*/ char *)s;
v->iov_len = strlen(s);
v++;
v->iov_base = ": ";
v->iov_len = 2;
v++;
}
- v->iov_base = (char *)hstrerror(h_errno);
+ v->iov_base = (char *)hstrerror(*__h_errno());
v->iov_len = strlen(v->iov_base);
v++;
v->iov_base = "\n";
@@ -100,10 +107,12 @@ herror(s)
writev(STDERR_FILENO, iov, (v - iov) + 1);
}
+/*
+ * hstrerror --
+ * return the string associated with a given "host" errno value.
+ */
const char *
-hstrerror(err)
- int err;
-{
+hstrerror(int err) {
if (err < 0)
return ("Resolver internal error");
else if (err < h_nerr)
OpenPOWER on IntegriCloud