Make ping obey the -n flag in places.

This commit is contained in:
augustss 1997-04-02 09:22:01 +00:00
parent 3deb2910ff
commit 525bca97ff

View File

@ -1,4 +1,4 @@
/* $NetBSD: ping.c,v 1.28 1997/03/24 03:34:26 christos Exp $ */ /* $NetBSD: ping.c,v 1.29 1997/04/02 09:22:01 augustss Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -60,7 +60,7 @@
*/ */
#ifndef lint #ifndef lint
static char rcsid[] = "$NetBSD: ping.c,v 1.28 1997/03/24 03:34:26 christos Exp $"; static char rcsid[] = "$NetBSD: ping.c,v 1.29 1997/04/02 09:22:01 augustss Exp $";
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -1603,9 +1603,9 @@ gethost(const char *name, struct sockaddr_in *sa, char *realname)
if (inet_aton(name, &sa->sin_addr) != 0) { if (inet_aton(name, &sa->sin_addr) != 0) {
if (realname == NULL) if (realname == NULL)
return; return;
hp = gethostbyaddr((char *) &sa->sin_addr, sizeof(sa->sin_addr), if ((pingflags & F_NUMERIC)
AF_INET); || !(hp = gethostbyaddr((char *) &sa->sin_addr,
if (hp == NULL) sizeof(sa->sin_addr), AF_INET)))
(void) strncpy(realname, name, MAXHOSTNAMELEN); (void) strncpy(realname, name, MAXHOSTNAMELEN);
else else
(void) strncpy(realname, hp->h_name, MAXHOSTNAMELEN); (void) strncpy(realname, hp->h_name, MAXHOSTNAMELEN);