1#define _GNU_SOURCE 2#include <netdb.h> 3#include <stdio.h> 4 5void herror(const char* msg) { 6 fprintf(stderr, "%s%s%s", msg ? msg : "", msg ? ": " : "", hstrerror(h_errno)); 7} 8