summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2b2b175)
SCCS-vsn: sbin/ping/ping.c 4.10
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ping.c 4.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)ping.c 4.10 (Berkeley) %G%";
hostname = hnamebuf;
} else {
hp = gethostbyname(av[0]);
hostname = hnamebuf;
} else {
hp = gethostbyname(av[0]);
- if (hp) {
- to->sin_family = hp->h_addrtype;
- bcopy(hp->h_addr, (caddr_t)&to->sin_addr, hp->h_length);
- hostname = hp->h_name;
- toaddr = inet_ntoa(to->sin_addr.s_addr);
- } else {
- printf("%s: unknown host %s\n", argv[0], av[0]);
+ if (!hp) {
+ fprintf(stderr, "ping: %s: ", av[0]);
+ herror((char *)NULL);
+ to->sin_family = hp->h_addrtype;
+ bcopy(hp->h_addr, (caddr_t)&to->sin_addr, hp->h_length);
+ hostname = hp->h_name;
+ toaddr = inet_ntoa(to->sin_addr.s_addr);