hstrerror.c 632 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Return a string containing some additional information after a
  3. * host name or address lookup error - gethostbyname() or gethostbyaddr().
  4. *
  5. * This is only compiled if the local host does not provide it--recent
  6. * versions of BIND supply this function.
  7. */
  8. #include "unp.h"
  9. const char *
  10. hstrerror(int err)
  11. {
  12. if (err == 0)
  13. return("no error");
  14. if (err == HOST_NOT_FOUND)
  15. return("Unknown host");
  16. if (err == TRY_AGAIN)
  17. return("Hostname lookup failure");
  18. if (err == NO_RECOVERY)
  19. return("Unknown server error");
  20. if (err == NO_DATA)
  21. return("No address associated with name");
  22. return("unknown error");
  23. }