#define _GNU_SOURCE #include #include void herror(const char *msg) { fprintf(stderr, "%s%s%s", msg?msg:"", msg?": ":"", hstrerror(h_errno)); }