From fa0c87c34471286b6c261c781a45ed090135295c Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 13 Jun 2007 20:54:32 +0200 Subject: Add a local implementation of hstrerror for the system which do not have it The function converts the value of h_errno (last error of name resolver library, see netdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- compat/hstrerror.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 compat/hstrerror.c (limited to 'compat') diff --git a/compat/hstrerror.c b/compat/hstrerror.c new file mode 100644 index 0000000000..069c555da4 --- /dev/null +++ b/compat/hstrerror.c @@ -0,0 +1,21 @@ +#include +#include +#include + +const char *githstrerror(int err) +{ + static char buffer[48]; + switch (err) + { + case HOST_NOT_FOUND: + return "Authoritative answer: host not found"; + case NO_DATA: + return "Valid name, no data record of requested type"; + case NO_RECOVERY: + return "Non recoverable errors, FORMERR, REFUSED, NOTIMP"; + case TRY_AGAIN: + return "Non-authoritative \"host not found\", or SERVERFAIL"; + } + sprintf(buffer, "Name resolution error %d", err); + return buffer; +} -- cgit v1.2.3