/*\r
* Copyright (c) 1987, 1993\r
- * The Regents of the University of California. All rights reserved.\r
+ * The Regents of the University of California. All rights reserved.\r
*\r
* Portions copyright (c) 1999, 2000\r
* Intel Corporation.\r
* All rights reserved.\r
- * \r
+ *\r
* Redistribution and use in source and binary forms, with or without\r
* modification, are permitted provided that the following conditions\r
* are met:\r
- * \r
+ *\r
* 1. Redistributions of source code must retain the above copyright\r
* notice, this list of conditions and the following disclaimer.\r
- * \r
+ *\r
* 2. Redistributions in binary form must reproduce the above copyright\r
* notice, this list of conditions and the following disclaimer in the\r
* documentation and/or other materials provided with the distribution.\r
- * \r
+ *\r
* 3. All advertising materials mentioning features or use of this software\r
* must display the following acknowledgement:\r
- * \r
+ *\r
* This product includes software developed by the University of\r
* California, Berkeley, Intel Corporation, and its contributors.\r
- * \r
+ *\r
* 4. Neither the name of University, Intel Corporation, or their respective\r
* contributors may be used to endorse or promote products derived from\r
* this software without specific prior written permission.\r
- * \r
+ *\r
* THIS SOFTWARE IS PROVIDED BY THE REGENTS, INTEL CORPORATION AND\r
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\r
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
* SOFTWARE.\r
- */\r
\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";\r
-static char rcsid[] = "$Id: herror.c,v 1.1.1.1 2003/11/19 01:51:28 kyu3 Exp $";\r
-#endif /* LIBC_SCCS and not lint */\r
+ herror.c 8.1 (Berkeley) 6/4/93\r
+ herror.c,v 1.1.1.1 2003/11/19 01:51:28 kyu3 Exp\r
+ */\r
\r
#include <sys/types.h>\r
#include <sys/uio.h>\r
#include <unistd.h>\r
\r
const char *h_errlist[] = {\r
- "Resolver Error 0 (no error)",\r
- "Unknown host", /* 1 HOST_NOT_FOUND */\r
- "Host name lookup failure", /* 2 TRY_AGAIN */\r
- "Unknown server error", /* 3 NO_RECOVERY */\r
- "No address associated with name", /* 4 NO_ADDRESS */\r
+ "Resolver Error 0 (no error)",\r
+ "Unknown host", /* 1 HOST_NOT_FOUND */\r
+ "Host name lookup failure", /* 2 TRY_AGAIN */\r
+ "Unknown server error", /* 3 NO_RECOVERY */\r
+ "No address associated with name", /* 4 NO_ADDRESS */\r
};\r
-int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };\r
+int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };\r
\r
-int h_errno;\r
+int h_errno;\r
\r
const char *\r
hstrerror(\r
\r
/*\r
* herror --\r
- * print the error indicated by the h_errno value.\r
+ * print the error indicated by the h_errno value.\r
*/\r
void\r
herror(\r
- const char *s\r
- )\r
+ const char *s\r
+ )\r
{\r
- struct iovec iov[4];\r
- register struct iovec *v = iov;\r
- int i;\r
+ struct iovec iov[4];\r
+ register struct iovec *v = iov;\r
\r
- if (s && *s) {\r
- v->iov_base = (char *)s;\r
- v->iov_len = strlen(s);\r
- v++;\r
- v->iov_base = ": ";\r
- v->iov_len = 2;\r
- v++;\r
- }\r
- v->iov_base = (char *)hstrerror(h_errno);\r
- v->iov_len = strlen(v->iov_base);\r
- v++;\r
- v->iov_base = "\n";\r
- v->iov_len = 1;\r
-#ifdef _ORG_FREEBSD_\r
- writev(STDERR_FILENO, iov, (v - iov) + 1);\r
+ if (s && *s) {\r
+ v->iov_base = (char *)s;\r
+ v->iov_len = strlen(s);\r
+ v++;\r
+ v->iov_base = ": ";\r
+ v->iov_len = 2;\r
+ v++;\r
+ }\r
+ v->iov_base = (char *)hstrerror(h_errno);\r
+ v->iov_len = strlen(v->iov_base);\r
+ v++;\r
+ v->iov_base = "\n";\r
+ v->iov_len = 1;\r
+#if defined(_ORG_FREEBSD_) || defined(__GNUC__)\r
+ writev(STDERR_FILENO, iov, (v - iov) + 1);\r
#else\r
- for (i = 0; i < (v - iov) + 1; i++)\r
- fprintf( stderr, iov[i].iov_base);\r
+ {\r
+ int i;\r
+ for (i = 0; i < (v - iov) + 1; i++)\r
+ fprintf( stderr, iov[i].iov_base);\r
+ }\r
#endif\r
\r
}\r
\r
const char *\r
hstrerror(\r
- int err\r
- )\r
+ int err\r
+ )\r
{\r
- if (err < 0)\r
- return ("Resolver internal error");\r
- else if (err < h_nerr)\r
- return (h_errlist[err]);\r
- return ("Unknown resolver error");\r
+ if (err < 0)\r
+ return ("Resolver internal error");\r
+ else if (err < h_nerr)\r
+ return (h_errlist[err]);\r
+ return ("Unknown resolver error");\r
}\r