128671Ssteve/*- 223412Sbde * Copyright (c) 1995 323412Sbde * The Regents of the University of California. All rights reserved. 423412Sbde * 523412Sbde * Redistribution and use in source and binary forms, with or without 623412Sbde * modification, are permitted provided that the following conditions 723412Sbde * are met: 823412Sbde * 1. Redistributions of source code must retain the above copyright 923412Sbde * notice, this list of conditions and the following disclaimer. 1023412Sbde * 2. Redistributions in binary form must reproduce the above copyright 1123412Sbde * notice, this list of conditions and the following disclaimer in the 1223412Sbde * documentation and/or other materials provided with the distribution. 1323412Sbde * 4. Neither the name of the University nor the names of its contributors 1423412Sbde * may be used to endorse or promote products derived from this software 1523412Sbde * without specific prior written permission. 1623412Sbde * 1723412Sbde * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1823412Sbde * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1923412Sbde * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2023412Sbde * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2123412Sbde * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2223412Sbde * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2323412Sbde * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2423412Sbde * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2523412Sbde * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2623412Sbde * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2723412Sbde * SUCH DAMAGE. 2823412Sbde */ 2923412Sbde 3023412Sbde#ifndef lint 3128671Ssteve#if 0 3223412Sbdestatic char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95"; 3337425Scharnier#endif 3423412Sbde#endif /* not lint */ 35114589Sobrien#include <sys/cdefs.h> 36114589Sobrien__FBSDID("$FreeBSD$"); 3723412Sbde 3828671Ssteve#include <err.h> 3923412Sbde#include <stdlib.h> 4023412Sbde#include <string.h> 4123412Sbde 4228671Ssteve#include "extern.h" 4328671Ssteve 4423412Sbdestatic int skipvfs; 4523412Sbde 4623412Sbdeint 47201227Sedcheckvfsname(const char *vfsname, const char **vfslist) 4823412Sbde{ 4923412Sbde 5023412Sbde if (vfslist == NULL) 5123412Sbde return (0); 5223412Sbde while (*vfslist != NULL) { 5323412Sbde if (strcmp(vfsname, *vfslist) == 0) 5423412Sbde return (skipvfs); 5523412Sbde ++vfslist; 5623412Sbde } 5723412Sbde return (!skipvfs); 5823412Sbde} 5923412Sbde 6023412Sbdeconst char ** 61201227Sedmakevfslist(char *fslist) 6223412Sbde{ 6323412Sbde const char **av; 6423412Sbde int i; 6523412Sbde char *nextcp; 6623412Sbde 6723412Sbde if (fslist == NULL) 6823412Sbde return (NULL); 6923412Sbde if (fslist[0] == 'n' && fslist[1] == 'o') { 7023412Sbde fslist += 2; 7123412Sbde skipvfs = 1; 7223412Sbde } 7323412Sbde for (i = 0, nextcp = fslist; *nextcp; nextcp++) 7423412Sbde if (*nextcp == ',') 7523412Sbde i++; 7623412Sbde if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) { 7737425Scharnier warnx("malloc failed"); 7823412Sbde return (NULL); 7923412Sbde } 8023412Sbde nextcp = fslist; 8123412Sbde i = 0; 8223412Sbde av[i++] = nextcp; 8323412Sbde while ((nextcp = strchr(nextcp, ',')) != NULL) { 8423412Sbde *nextcp++ = '\0'; 8523412Sbde av[i++] = nextcp; 8623412Sbde } 8723412Sbde av[i++] = NULL; 8823412Sbde return (av); 8923412Sbde} 90