Add h_errno for systems that doesn't have one.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1542 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-04-01 09:21:55 +00:00
parent e1282e7dfc
commit eed3ff1dd8

View File

@@ -48,15 +48,17 @@ RCSID("$Id$");
#include <stdio.h> #include <stdio.h>
#include <netdb.h> #include <netdb.h>
#ifndef HAVE_H_ERRNO
int h_errno = -17; /* Some magic number */
#endif
#ifndef HAVE_H_ERRLIST #ifndef HAVE_H_ERRLIST
static static const char *const h_errlist[] = {
const "Resolver Error 0 (no error)",
char *const h_errlist[] = { "Unknown host", /* 1 HOST_NOT_FOUND */
"Resolver Error 0 (no error)", "Host name lookup failure", /* 2 TRY_AGAIN */
"Unknown host", /* 1 HOST_NOT_FOUND */ "Unknown server error", /* 3 NO_RECOVERY */
"Host name lookup failure", /* 2 TRY_AGAIN */ "No address associated with name", /* 4 NO_ADDRESS */
"Unknown server error", /* 3 NO_RECOVERY */
"No address associated with name", /* 4 NO_ADDRESS */
}; };
static static
@@ -74,10 +76,12 @@ extern int h_nerr;
char * char *
hstrerror(int herr) hstrerror(int herr)
{ {
if (0 <= herr && herr < h_nerr) if (0 <= herr && herr < h_nerr)
return (char *) h_errlist[herr]; return (char *) h_errlist[herr];
else else if(herr == -17)
return "Error number out of range (hstrerror)"; return "unknown error";
else
return "Error number out of range (hstrerror)";
} }
#endif #endif