xref: /netbsd-src/sys/lib/libkern/strlist.h (revision fa320c3f7eecff64b80a0ae212c77160a42a2914)
1*fa320c3fSthorpej /*	$NetBSD: strlist.h,v 1.1 2021/01/21 15:43:37 thorpej Exp $	*/
2*fa320c3fSthorpej 
3*fa320c3fSthorpej /*-
4*fa320c3fSthorpej  * Copyright (c) 2021 The NetBSD Foundation, Inc.
5*fa320c3fSthorpej  * All rights reserved.
6*fa320c3fSthorpej  *
7*fa320c3fSthorpej  * This code is derived from software contributed to The NetBSD Foundation
8*fa320c3fSthorpej  * by Jason R. Thorpe.
9*fa320c3fSthorpej  *
10*fa320c3fSthorpej  * Redistribution and use in source and binary forms, with or without
11*fa320c3fSthorpej  * modification, are permitted provided that the following conditions
12*fa320c3fSthorpej  * are met:
13*fa320c3fSthorpej  * 1. Redistributions of source code must retain the above copyright
14*fa320c3fSthorpej  *    notice, this list of conditions and the following disclaimer.
15*fa320c3fSthorpej  * 2. Redistributions in binary form must reproduce the above copyright
16*fa320c3fSthorpej  *    notice, this list of conditions and the following disclaimer in the
17*fa320c3fSthorpej  *    documentation and/or other materials provided with the distribution.
18*fa320c3fSthorpej  *
19*fa320c3fSthorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*fa320c3fSthorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*fa320c3fSthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*fa320c3fSthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*fa320c3fSthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*fa320c3fSthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*fa320c3fSthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*fa320c3fSthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*fa320c3fSthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*fa320c3fSthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*fa320c3fSthorpej  * POSSIBILITY OF SUCH DAMAGE.
30*fa320c3fSthorpej  */
31*fa320c3fSthorpej 
32*fa320c3fSthorpej #ifndef _LIB_LIBKERN_STRLIST_H_
33*fa320c3fSthorpej #define	_LIB_LIBKERN_STRLIST_H_
34*fa320c3fSthorpej 
35*fa320c3fSthorpej #include <sys/types.h>
36*fa320c3fSthorpej #if !defined(_KERNEL) && !defined(_STANDALONE)
37*fa320c3fSthorpej #include <stdbool.h>
38*fa320c3fSthorpej #endif /* ! _KERNEL && !_STANDALONE */
39*fa320c3fSthorpej 
40*fa320c3fSthorpej const char *	strlist_next(const char *, size_t, size_t *);
41*fa320c3fSthorpej unsigned int	strlist_count(const char *, size_t);
42*fa320c3fSthorpej const char *	strlist_string(const char *, size_t, unsigned int);
43*fa320c3fSthorpej 
44*fa320c3fSthorpej int		strlist_match(const char *, size_t, const char *);
45*fa320c3fSthorpej int		strlist_pmatch(const char *, size_t, const char *);
46*fa320c3fSthorpej int		strlist_index(const char *, size_t, const char *);
47*fa320c3fSthorpej 
48*fa320c3fSthorpej bool		strlist_append(char **, size_t *, const char *);
49*fa320c3fSthorpej 
50*fa320c3fSthorpej #endif /* _LIB_LIBKERN_STRLIST_H_ */
51