BSD 3 development
[unix-history] / usr / src / cmd / uucp / gnsys.c
index 7167cfb..483fcac 100644 (file)
@@ -51,8 +51,7 @@ char *sname, *dir, pre;
                        *s = '\0';
                        if (sysname[0] == '\0')
                                continue;
                        *s = '\0';
                        if (sysname[0] == '\0')
                                continue;
-                       if (callok(sysname) == 0)
-                               nitem = srchst(sysname, list, nitem);
+                       nitem = srchst(sysname, list, nitem);
                        if (LSIZE <= nitem) break;
                }
 
                        if (LSIZE <= nitem) break;
                }
 
@@ -61,16 +60,16 @@ char *sname, *dir, pre;
 
        if (nitem == 0)
                return(0);
 
        if (nitem == 0)
                return(0);
-       if (nitem <= n ) {
-               for (n = 0; n < nitem; n++)
-                       if (list[n] != NULL)
-                               free(list[n]);
-               nitem = n = 0;
-               return(0);
+       while(nitem > n) {
+               strcpy(sname, list[n++]);
+               if (callok(sname) == 0)
+                       return(1);
        }
        }
-
-       strcpy(sname, list[n++]);
-       return(1);
+       for (n = 0; n < nitem; n++)
+               if (list[n] != NULL)
+                       free(list[n]);
+       nitem = n = 0;
+       return(0);
 }
 
 /***
 }
 
 /***