- Include string.h to avoid compile warning about using bzero without

defining it
- use herror() rather than perror() to give useful error messages
  (the *hostby*() functions set h_errno not errno)

PR:		docs/126031
Submitted by:	gavin
This commit is contained in:
Daniel Gerzo 2008-08-03 09:50:20 +00:00
parent 163aac8adc
commit c3a59abed8
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=32611

View file

@ -966,6 +966,7 @@ int connect(int s, const struct sockaddr *name, socklen_t namelen);
* Programmed by G. Adam Stanislav
*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@ -1181,6 +1182,7 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
* June 19, 2001
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
@ -1582,7 +1584,7 @@ int main(int argc, char *argv[]) {
host = (argc > 1) ? (char *)argv[1] : "time.nist.gov";
if ((he = gethostbyname(host)) == NULL) {
perror(host);
herror(host);
return 2;
}