提交 18144af2 编写于 作者: R Rich Felker

implement legacy function herror

based on patch by Timo Teräs; greatly simplified to use fprintf.
上级 e36d8a1d
......@@ -134,6 +134,7 @@ int *__h_errno_location(void);
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
void herror(const char *);
const char *hstrerror(int);
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
......
#define _GNU_SOURCE
#include <stdio.h>
#include <netdb.h>
void herror(const char *msg)
{
fprintf(stderr, "%s%s%s", msg?msg:"", msg?": ":"", hstrerror(h_errno));
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册