-static enum { IN_LIST, NOT_IN_LIST } which;
-
-int
-selected(type)
- int type;
-{
- int *av;
-
- /* If no type specified, it's always selected. */
- if (typelist == NULL)
- return (1);
- for (av = typelist; *av != NULL; ++av)
- if (type == *typelist)
- return (which == IN_LIST ? 1 : 0);
- return (which == IN_LIST ? 0 : 1);
-}
-
-void
-maketypelist(fslist)
- char *fslist;
-{
- int *av, i;
- char *nextcp;
-
- if ((fslist == NULL) || (fslist[0] == '\0'))
- errx(1, "empty type list");
-
- /*
- * XXX
- * Note: the syntax is "noxxx,yyy" for no xxx's and
- * no yyy's, not the more intuitive "noyyy,noyyy".
- */
- if (fslist[0] == 'n' && fslist[1] == 'o') {
- fslist += 2;
- which = NOT_IN_LIST;
- } else
- which = IN_LIST;
-
- /* Count the number of types. */
- for (i = 0, nextcp = fslist; *nextcp != NULL; ++nextcp)
- if (*nextcp == ',')
- i++;
-
- /* Build an array of that many types. */
- if ((av = typelist = malloc((i + 2) * sizeof(int))) == NULL)
- err(1, NULL);
- for (i = 0; fslist != NULL; fslist = nextcp, ++i) {
- if ((nextcp = strchr(fslist, ',')) != NULL)
- *nextcp++ = '\0';
- av[i] = fsnametotype(fslist);
- if (av[i] == MOUNT_NONE)
- errx(1, "%s: unknown mount type", fslist);
- }
- /* Terminate the array. */
- av[i++] = MOUNT_NONE;
-}
-
-int
-fsnametotype(name)
- char *name;
-{
- static char const *namelist[] = INITMOUNTNAMES;
- char const **cp;
-
- for (cp = namelist; *cp; ++cp)
- if (strcmp(name, *cp) == 0)
- return (cp - namelist);
- return (MOUNT_NONE);
-}
-