#define LSIZE 30 /* 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
static char *list
[LSIZE
];
char sysname
[NAMESIZE
], filename
[NAMESIZE
];
/* get list of systems with work */
ASSERT(fp
!= NULL
, "BAD DIRECTRY %s\n", dir
);
for (i
= 0; i
< LSIZE
; i
++)
while (gnamef(fp
, filename
) != 0) {
if (!prefix(px
, filename
))
p2
= filename
+ strlen(filename
)
p1
= filename
+ strlen(px
);
for(s
= sysname
; p1
<= p2
; p1
++)
if (callok(sysname
) == 0)
nitem
= srchst(sysname
, 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(strlen(name
) + 1, sizeof (char)))