static char sccsid
[] = "@(#)gnsys.c 5.2 (Berkeley) %G%";
* The "retry" code below prevents uucico from calling
* a site which it has called earlier.
* Also, uucico does callok() only once for each system.
#define LSIZE 100 /* number of systems to store */
#define WSUFSIZE 6 /* work file name suffix size */
* char *sname, *dir, pre;
* gnsys - this routine will return the next
* system name which has work to be done.
* "pre" is the prefix for work files.
* "dir" is the directory to search.
* "sname" is a string of size DIRSIZ - WSUFSIZE.
* 1 - name returned in sname
register char *s
, *p1
, *p2
;
static char *list
[LSIZE
];
static int nitem
=0, n
=0, base
=0;
char systname
[NAMESIZE
], filename
[NAMESIZE
];
/* get list of systems with work */
dirp
= opendir(subdir(dir
,pre
), "r");
ASSERT(dirp
!= NULL
, "BAD DIRECTORY", dir
, 0);
for (i
= base
; i
< LSIZE
; i
++)
while (gnamef(dirp
, filename
) != 0) {
if (!prefix(px
, filename
))
p2
= filename
+ strlen(filename
)
p1
= filename
+ strlen(px
);
for(s
= systname
; p1
<= p2
; p1
++)
nitem
= srchst(systname
, list
, nitem
);
if (LSIZE
<= nitem
) break;
for (n
= 0; n
< nitem
; n
++)
strcpy(sname
, list
[n
++]);
* srchst - this routine will do a linear search
* of list (list) to find name (name).
* If the name is not found, it is added to the
* The number of items in the list (n) is
* returned (incremented if a name is added).
* n - the number of items in the list
if (strcmp(name
, list
[i
]) == 0)
if ((p
= calloc((unsigned)strlen(name
) + 1, sizeof (char)))