Deleted Added
full compact
herror.c (165903) herror.c (170244)
1/*
2 * Copyright (c) 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
42 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
43 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
44 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45 */
46
47#if defined(LIBC_SCCS) && !defined(lint)
48static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
1/*
2 * Copyright (c) 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 32 unchanged lines hidden (view full) ---

41 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
42 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
43 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
44 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45 */
46
47#if defined(LIBC_SCCS) && !defined(lint)
48static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
49static const char rcsid[] = "$Id: herror.c,v 1.2.206.1 2004/03/09 08:33:54 marka Exp $";
49static const char rcsid[] = "$Id: herror.c,v 1.3.18.1 2005/04/27 05:01:09 sra Exp $";
50#endif /* LIBC_SCCS and not lint */
51#include <sys/cdefs.h>
50#endif /* LIBC_SCCS and not lint */
51#include <sys/cdefs.h>
52__FBSDID("$FreeBSD: head/lib/libc/resolv/herror.c 165903 2007-01-09 00:28:16Z imp $");
52__FBSDID("$FreeBSD: head/lib/libc/resolv/herror.c 170244 2007-06-03 17:20:27Z ume $");
53
54#include "port_before.h"
55
56#include "namespace.h"
57#include <sys/types.h>
58#include <sys/param.h>
59#include <sys/uio.h>
60

--- 5 unchanged lines hidden (view full) ---

66#include <string.h>
67#include <unistd.h>
68#include "un-namespace.h"
69
70#include "port_after.h"
71
72const char *h_errlist[] = {
73 "Resolver Error 0 (no error)",
53
54#include "port_before.h"
55
56#include "namespace.h"
57#include <sys/types.h>
58#include <sys/param.h>
59#include <sys/uio.h>
60

--- 5 unchanged lines hidden (view full) ---

66#include <string.h>
67#include <unistd.h>
68#include "un-namespace.h"
69
70#include "port_after.h"
71
72const char *h_errlist[] = {
73 "Resolver Error 0 (no error)",
74 "Unknown host", /* 1 HOST_NOT_FOUND */
75 "Host name lookup failure", /* 2 TRY_AGAIN */
76 "Unknown server error", /* 3 NO_RECOVERY */
77 "No address associated with name", /* 4 NO_ADDRESS */
74 "Unknown host", /*%< 1 HOST_NOT_FOUND */
75 "Host name lookup failure", /*%< 2 TRY_AGAIN */
76 "Unknown server error", /*%< 3 NO_RECOVERY */
77 "No address associated with name", /*%< 4 NO_ADDRESS */
78};
79const int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
80
81#undef h_errno
82int h_errno;
83
78};
79const int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
80
81#undef h_errno
82int h_errno;
83
84/*
84/*%
85 * herror --
86 * print the error indicated by the h_errno value.
87 */
88void
89herror(const char *s) {
90 struct iovec iov[4], *v = iov;
91 char *t;
92

--- 12 unchanged lines hidden (view full) ---

105 v->iov_len = strlen(v->iov_base);
106 v++;
107 DE_CONST("\n", t);
108 v->iov_base = t;
109 v->iov_len = 1;
110 _writev(STDERR_FILENO, iov, (v - iov) + 1);
111}
112
85 * herror --
86 * print the error indicated by the h_errno value.
87 */
88void
89herror(const char *s) {
90 struct iovec iov[4], *v = iov;
91 char *t;
92

--- 12 unchanged lines hidden (view full) ---

105 v->iov_len = strlen(v->iov_base);
106 v++;
107 DE_CONST("\n", t);
108 v->iov_base = t;
109 v->iov_len = 1;
110 _writev(STDERR_FILENO, iov, (v - iov) + 1);
111}
112
113/*
113/*%
114 * hstrerror --
115 * return the string associated with a given "host" errno value.
116 */
117const char *
118hstrerror(int err) {
119 if (err < 0)
120 return ("Resolver internal error");
121 else if (err < h_nerr)
122 return (h_errlist[err]);
123 return ("Unknown resolver error");
124}
114 * hstrerror --
115 * return the string associated with a given "host" errno value.
116 */
117const char *
118hstrerror(int err) {
119 if (err < 0)
120 return ("Resolver internal error");
121 else if (err < h_nerr)
122 return (h_errlist[err]);
123 return ("Unknown resolver error");
124}
125
126/*! \file */