about summary refs log tree commit diff
path: root/nss/getent.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-16 19:42:33 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-16 19:42:33 +0000
commitfdcd8f9c7163b8a3120c3d3a7763728b1a61728d (patch)
tree0a857cffbdfe9353951e7bef36aab3132eb9f429 /nss/getent.c
parent0a37669aa5d98875e783df75681f035a905b7f31 (diff)
downloadglibc-fdcd8f9c7163b8a3120c3d3a7763728b1a61728d.tar.gz
glibc-fdcd8f9c7163b8a3120c3d3a7763728b1a61728d.tar.xz
glibc-fdcd8f9c7163b8a3120c3d3a7763728b1a61728d.zip
Update.
2003-02-14  Thorsten Kukuk  <kukuk@suse.de>

	* nss/getent.c (print_hosts): Print all IP addresses of one host.
Diffstat (limited to 'nss/getent.c')
-rw-r--r--nss/getent.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/nss/getent.c b/nss/getent.c
index 168d6853a1..a9cba96f0c 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -232,21 +232,24 @@ group_keys (int number, char *key[])
 static inline void
 print_hosts (struct hostent *host)
 {
-  unsigned int i;
-  char buf[INET6_ADDRSTRLEN];
-  const char *ip = inet_ntop (host->h_addrtype, host->h_addr_list[0],
-			      buf, sizeof (buf));
-
-  printf ("%-15s %s", ip, host->h_name);
+  unsigned int cnt;
 
-  i = 0;
-  while (host->h_aliases[i] != NULL)
+  for (cnt = 0; host->h_addr_list[cnt] != NULL; ++cnt)
     {
-      putchar_unlocked (' ');
-      fputs_unlocked (host->h_aliases[i], stdout);
-      ++i;
+      char buf[INET6_ADDRSTRLEN];
+      const char *ip = inet_ntop (host->h_addrtype, host->h_addr_list[cnt],
+				  buf, sizeof (buf));
+
+      printf ("%-15s %s", ip, host->h_name);
+
+      unsigned int i;
+      for (i = 0; host->h_aliases[i] != NULL; ++i)
+	{
+	  putchar_unlocked (' ');
+	  fputs_unlocked (host->h_aliases[i], stdout);
+	}
+      putchar_unlocked ('\n');
     }
-  putchar_unlocked ('\n');
 }
 
 static int