]> andersk Git - moira.git/commitdiff
don't print empty type fields & don't print entries with bad addresses
authormar <mar>
Wed, 1 Dec 1993 14:08:29 +0000 (14:08 +0000)
committermar <mar>
Wed, 1 Dec 1993 14:08:29 +0000 (14:08 +0000)
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.049617 seconds and 5 git commands to generate.