OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 1987, 1993 | 2 * Copyright (c) 1987, 1993 |
3 * The Regents of the University of California. All rights reserved. | 3 * The Regents of the University of California. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 v++; | 77 v++; |
78 v->iov_base = ": "; | 78 v->iov_base = ": "; |
79 v->iov_len = 2; | 79 v->iov_len = 2; |
80 v++; | 80 v++; |
81 } | 81 } |
82 v->iov_base = (char *)hstrerror(h_errno); | 82 v->iov_base = (char *)hstrerror(h_errno); |
83 v->iov_len = strlen(v->iov_base); | 83 v->iov_len = strlen(v->iov_base); |
84 v++; | 84 v++; |
85 v->iov_base = "\n"; | 85 v->iov_base = "\n"; |
86 v->iov_len = 1; | 86 v->iov_len = 1; |
87 #ifndef writev | |
88 #define writev(fd, iov, iovcnt) \ | |
89 do { \ | |
90 int i; \ | |
91 for (i = 0; i < (iovcnt); ++i) { \ | |
92 write((fd), (iov)[i].iov_base, (iov)[i].iov_len); \ | |
93 } \ | |
94 } while (0) | |
95 #endif | |
96 writev(STDERR_FILENO, iov, (v - iov) + 1); | 87 writev(STDERR_FILENO, iov, (v - iov) + 1); |
97 } | 88 } |
98 | 89 |
99 /* | 90 /* |
100 * hstrerror -- | 91 * hstrerror -- |
101 * return the string associated with a given "host" errno value. | 92 * return the string associated with a given "host" errno value. |
102 */ | 93 */ |
103 const char * | 94 const char * |
104 hstrerror(int err) { | 95 hstrerror(int err) { |
105 if (err < 0) | 96 if (err < 0) |
106 return ("Resolver internal error"); | 97 return ("Resolver internal error"); |
107 else if (err < h_nerr) | 98 else if (err < h_nerr) |
108 return (h_errlist[err]); | 99 return (h_errlist[err]); |
109 return ("Unknown resolver error"); | 100 return ("Unknown resolver error"); |
110 } | 101 } |
OLD | NEW |