]> andersk Git - moira.git/blobdiff - gen/hosts.dc
had to change the get alias validate thing to use the access hook
[moira.git] / gen / hosts.dc
index 207d35905b5a501cc2a1fe2f2777af7302ea42a9..9c4f4c59fedb1fd0d382184d3332734868125768 100644 (file)
@@ -113,17 +113,20 @@ char **argv;
        strtrim(model);
        strtrim(os);
        strtrim(addr);
-       if (*addr == 0)
+       if (*addr == 0 || inet_addr(addr) == -1)
          continue;
        if (p = hash_lookup(aliases, id))
          sprintf(buf, "%s,%s", name, p);
        else
          strcpy(buf, name);
        fprintf(out, "HOST : %s : %s : ", addr, buf);
-       if (*vendor && *model)
-         fprintf(out, "%s/%s : %s :\n", vendor, model, os);
-       else
-         fprintf(out, "%s%s : %s :\n", vendor, model, os);
+       if ((*vendor || *model) && *os) {
+           if (*vendor && *model)
+             fprintf(out, "%s/%s : %s :\n", vendor, model, os);
+           else
+             fprintf(out, "%s%s : %s :\n", vendor, model, os);
+       } else
+         fputs("\n", out);
     }
 
     EXEC SQL CLOSE x;
This page took 0.08301 seconds and 4 git commands to generate.