]> andersk Git - moira.git/blobdiff - lib/fixhost.c
second code style cleanup: void/void * usage, proper #includes. try to
[moira.git] / lib / fixhost.c
index 11e087d5a0ee5d6c20a3ef557ceb4ffd3c610ee4..9a529736462adeee56c43f5941c156bf270d8cf8 100644 (file)
@@ -1,28 +1,28 @@
-/*
- *     $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:
@@ -49,7 +49,7 @@ char *canonicalize_hostname(char *host)
       strcpy(tbuf, host + 1);
       free(host);
       tbuf[strlen(tbuf) - 1] = '\0';
-      return strsave(tbuf);
+      return strdup(tbuf);
     }
 
   if (strchr(host, '*') || strchr(host, '?') || strchr(host, '['))
@@ -85,13 +85,13 @@ char *canonicalize_hostname(char *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;
     }
This page took 1.376599 seconds and 4 git commands to generate.