(getugroups): Take new parameter, gid.
[gnulib.git] / lib / canon-host.c
index 161fdb3..1f6b575 100644 (file)
@@ -1,6 +1,6 @@
 /* Host name canonicalization
 
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1999 Free Software Foundation, Inc.
 
    Written by Miles Bader <miles@gnu.ai.mit.edu>
 
@@ -22,6 +22,7 @@
 # include <config.h>
 #endif
 
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -45,8 +46,7 @@
 /* Returns the canonical hostname associated with HOST (allocated in a static
    buffer), or 0 if it can't be determined.  */
 char *
-canon_host (host)
-     char *host;
+canon_host (const char *host)
 {
 #ifdef HAVE_GETHOSTBYNAME
   struct hostent *he = gethostbyname (host);
@@ -78,3 +78,17 @@ canon_host (host)
 #endif /* HAVE_GETHOSTBYNAME */
   return 0;
 }
+
+#ifdef TEST_CANON_HOST
+int
+main (int argc, char **argv)
+{
+  int i;
+  for (i = 1; i < argc; i++)
+    {
+      char *s = canon_host (argv[i]);
+      printf ("%s: %s\n", argv[i], (s ? s : "<undef>"));
+    }
+  exit (0);
+}
+#endif /* TEST_CANON_HOST */