X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fcanon-host.c;h=1f6b575ee15d756272855d475c55cbd83dfe0879;hb=1ef07171f7e8abdb703651a0f6c81e17559b3720;hp=161fdb34f926535b734249aa96b6003baa8d2caf;hpb=783c1624bd8b027a65b3fba57d3213ccb1a6ddbd;p=gnulib.git diff --git a/lib/canon-host.c b/lib/canon-host.c index 161fdb34f..1f6b575ee 100644 --- a/lib/canon-host.c +++ b/lib/canon-host.c @@ -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 @@ -22,6 +22,7 @@ # include #endif +#include #ifdef HAVE_UNISTD_H # include #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 : "")); + } + exit (0); +} +#endif /* TEST_CANON_HOST */