summaryrefslogtreecommitdiffstats
path: root/compat/hstrerror.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compat/hstrerror.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
new file mode 100644
index 0000000..b85a2fa
--- /dev/null
+++ b/compat/hstrerror.c
@@ -0,0 +1,21 @@
+#include <string.h>
+#include <stdio.h>
+#include <netdb.h>
+
+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";
+ }
+ snprintf(buffer, sizeof(buffer), "Name resolution error %d", err);
+ return buffer;
+}