-/*
- * $Source$
- * $Author$
- * $Header$
+/* $Id $
+ *
+ * Canonicalize a hostname
*
- * Copyright (C) 1987 by the Massachusetts Institute of Technology
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
+ * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
-#ifndef lint
-static char *rcsid_fixhost_c = "$Header$";
-#endif
-
#include <mit-copyright.h>
+#include <moira.h>
+
#include <sys/types.h>
#include <sys/socket.h>
-#include <netinet/in.h>
+#include <sys/utsname.h>
+
#include <netdb.h>
+#include <netinet/in.h>
+
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/utsname.h>
#include <string.h>
-#include <ctype.h>
-#include <moira.h>
+
+RCSID("$Header$");
/*
* Canonicalize hostname:
strcpy(tbuf, host + 1);
free(host);
tbuf[strlen(tbuf) - 1] = '\0';
- return strsave(tbuf);
+ return strdup(tbuf);
}
if (strchr(host, '*') || strchr(host, '?') || strchr(host, '['))
hp = gethostbyname(name.nodename);
cp = strchr(hp->h_name, '.');
if (cp)
- domain = strsave(++cp);
+ domain = strdup(++cp);
else
domain = "";
}
sprintf(tbuf, "%s.%s", host, domain);
free(host);
- host = strsave(tbuf);
+ host = strdup(tbuf);
}
return host;
}