xref: /haiku/headers/compatibility/bsd/stringlist.h (revision f759ab27338499b0b3bf805866b0331f6d0d91a5)
11d9d47fcSAxel Dörfler /*	$NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $	*/
21d9d47fcSAxel Dörfler 
3*f759ab27SAugustin Cavalier /*-
4*f759ab27SAugustin Cavalier  * SPDX-License-Identifier: BSD-2-Clause
5*f759ab27SAugustin Cavalier  *
61d9d47fcSAxel Dörfler  * Copyright (c) 1994 Christos Zoulas
71d9d47fcSAxel Dörfler  * All rights reserved.
81d9d47fcSAxel Dörfler  *
91d9d47fcSAxel Dörfler  * Redistribution and use in source and binary forms, with or without
101d9d47fcSAxel Dörfler  * modification, are permitted provided that the following conditions
111d9d47fcSAxel Dörfler  * are met:
121d9d47fcSAxel Dörfler  * 1. Redistributions of source code must retain the above copyright
131d9d47fcSAxel Dörfler  *    notice, this list of conditions and the following disclaimer.
141d9d47fcSAxel Dörfler  * 2. Redistributions in binary form must reproduce the above copyright
151d9d47fcSAxel Dörfler  *    notice, this list of conditions and the following disclaimer in the
161d9d47fcSAxel Dörfler  *    documentation and/or other materials provided with the distribution.
171d9d47fcSAxel Dörfler  *
181d9d47fcSAxel Dörfler  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
191d9d47fcSAxel Dörfler  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
201d9d47fcSAxel Dörfler  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211d9d47fcSAxel Dörfler  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
221d9d47fcSAxel Dörfler  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231d9d47fcSAxel Dörfler  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241d9d47fcSAxel Dörfler  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251d9d47fcSAxel Dörfler  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261d9d47fcSAxel Dörfler  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271d9d47fcSAxel Dörfler  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281d9d47fcSAxel Dörfler  * SUCH DAMAGE.
291d9d47fcSAxel Dörfler  */
301d9d47fcSAxel Dörfler 
311d9d47fcSAxel Dörfler #ifndef _STRINGLIST_H
321d9d47fcSAxel Dörfler #define _STRINGLIST_H
33091a80aeSAdrien Destugues 
3449506076SAdrien Destugues #include <features.h>
35091a80aeSAdrien Destugues 
3649506076SAdrien Destugues #ifdef _DEFAULT_SOURCE
37091a80aeSAdrien Destugues 
38091a80aeSAdrien Destugues 
391d9d47fcSAxel Dörfler #include <sys/cdefs.h>
401d9d47fcSAxel Dörfler #include <sys/types.h>
411d9d47fcSAxel Dörfler 
421d9d47fcSAxel Dörfler /*
431d9d47fcSAxel Dörfler  * Simple string list
441d9d47fcSAxel Dörfler  */
451d9d47fcSAxel Dörfler typedef struct _stringlist {
461d9d47fcSAxel Dörfler 	char	**sl_str;
471d9d47fcSAxel Dörfler 	size_t	  sl_max;
481d9d47fcSAxel Dörfler 	size_t	  sl_cur;
491d9d47fcSAxel Dörfler } StringList;
501d9d47fcSAxel Dörfler 
511d9d47fcSAxel Dörfler __BEGIN_DECLS
521d9d47fcSAxel Dörfler StringList *sl_init(void);
531d9d47fcSAxel Dörfler int	 sl_add(StringList *, char *);
541d9d47fcSAxel Dörfler void	 sl_free(StringList *, int);
551d9d47fcSAxel Dörfler char	*sl_find(StringList *, char *);
561d9d47fcSAxel Dörfler __END_DECLS
571d9d47fcSAxel Dörfler 
58091a80aeSAdrien Destugues 
59091a80aeSAdrien Destugues #endif
60091a80aeSAdrien Destugues 
61091a80aeSAdrien Destugues 
621d9d47fcSAxel Dörfler #endif /* _STRINGLIST_H */
63