]> andersk Git - moira.git/commitdiff
assume POSIX (uname vs gethostname)
authordanw <danw>
Mon, 5 Jan 1998 14:54:47 +0000 (14:54 +0000)
committerdanw <danw>
Mon, 5 Jan 1998 14:54:47 +0000 (14:54 +0000)
lib/fixhost.c

index d712d6eb7cb6043fd7fbff03b44f2a92875d7c1e..d794157f09b576dd8ec62ecbd7076f6ceee3ccfc 100644 (file)
@@ -19,9 +19,7 @@ static char *rcsid_fixhost_c = "$Header$";
 #include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef POSIX
 #include <sys/utsname.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 #include <moira.h>
@@ -45,9 +43,7 @@ canonicalize_hostname(host)
     int n_len;
     int has_dot = 0;
     char tbuf[BUFSIZ];
-#ifdef POSIX
     struct utsname name;
-#endif
     register char *cp;
     
     if (strlen(host) > 2 && host[0] == '"' && host[strlen(host)-1] == '"') {
@@ -79,13 +75,8 @@ canonicalize_hostname(host)
            static char *domain = NULL;
 
            if (domain == NULL) {
-#ifdef POSIX
                (void) uname(&name);
-               strncpy(tbuf, name.nodename, sizeof(tbuf));
-#else
-               gethostname(tbuf, sizeof(tbuf));
-#endif
-               hp = gethostbyname(tbuf);
+               hp = gethostbyname(name.nodename);
                cp = strchr(hp->h_name, '.');
                if (cp)
                  domain = strsave(++cp);
This page took 0.062047 seconds and 5 git commands to generate.