]> andersk Git - moira.git/commitdiff
putting hostname in ""'s suppresses canonicalization
authormar <mar>
Mon, 27 Mar 1989 15:38:37 +0000 (15:38 +0000)
committermar <mar>
Mon, 27 Mar 1989 15:38:37 +0000 (15:38 +0000)
lib/fixhost.c

index a7072b02493dcdeaec23168508c0f0a86c035533..73639625b6fd9c08ccaec086669656964115e797 100644 (file)
@@ -28,10 +28,11 @@ extern char *realloc();
 extern char *strsave();
 
 /*
- * Canonicalize hostname; if it is in the namespace, call the
- * nameserver to expand it; otherwise uppercase it and append the
- * default domain (using an, er, undocumented global of the
- * nameserver).
+ * Canonicalize hostname:
+ *  if it is in double-quotes, then strip the quotes and return the name.
+ *  if it is in the namespace, call the nameserver to expand it
+ *  otherwise uppercase it and append the default domain (using an, er,
+ *    undocumented global of the nameserver).
  *
  * Assumes that host was allocated using malloc(); it may be freed or
  * realloc'ed, so the old pointer should not be considered valid.
@@ -47,6 +48,13 @@ canonicalize_hostname(host)
     char tbuf[BUFSIZ];
     register char *cp;
     
+    if (strlen(host) > 2 && host[0] == '"' && host[strlen(host)-1] == '"') {
+       strcpy(host+1, tbuf);
+       free(host);
+       tbuf[strlen(tbuf)-1] = 0;
+       return(strsave(tbuf));
+    }
+
     if (index(host, '*') || index(host, '?'))
       return(host);
 
This page took 0.102766 seconds and 5 git commands to generate.