xref: /netbsd-src/include/stringlist.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: stringlist.h,v 1.7 2008/04/28 20:22:54 martin Exp $	*/
2c98b9231Slukem 
3dfbaa22bSchristos /*-
4dfbaa22bSchristos  * Copyright (c) 1994 The NetBSD Foundation, Inc.
5c98b9231Slukem  * All rights reserved.
6c98b9231Slukem  *
7dfbaa22bSchristos  * This code is derived from software contributed to The NetBSD Foundation
8dfbaa22bSchristos  * by Christos Zoulas.
9dfbaa22bSchristos  *
10c98b9231Slukem  * Redistribution and use in source and binary forms, with or without
11c98b9231Slukem  * modification, are permitted provided that the following conditions
12c98b9231Slukem  * are met:
13c98b9231Slukem  * 1. Redistributions of source code must retain the above copyright
14c98b9231Slukem  *    notice, this list of conditions and the following disclaimer.
15c98b9231Slukem  * 2. Redistributions in binary form must reproduce the above copyright
16c98b9231Slukem  *    notice, this list of conditions and the following disclaimer in the
17c98b9231Slukem  *    documentation and/or other materials provided with the distribution.
18c98b9231Slukem  *
19dfbaa22bSchristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20dfbaa22bSchristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21dfbaa22bSchristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22dfbaa22bSchristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23dfbaa22bSchristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24dfbaa22bSchristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25dfbaa22bSchristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26dfbaa22bSchristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27dfbaa22bSchristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28dfbaa22bSchristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29dfbaa22bSchristos  * POSSIBILITY OF SUCH DAMAGE.
30c98b9231Slukem  */
31c98b9231Slukem 
32c98b9231Slukem #ifndef _STRINGLIST_H
33c98b9231Slukem #define _STRINGLIST_H
34c98b9231Slukem #include <sys/cdefs.h>
35c98b9231Slukem #include <sys/types.h>
36c98b9231Slukem 
37c98b9231Slukem /*
38c98b9231Slukem  * Simple string list
39c98b9231Slukem  */
40c98b9231Slukem typedef struct _stringlist {
41c98b9231Slukem 	char	**sl_str;
42c98b9231Slukem 	size_t	  sl_max;
43c98b9231Slukem 	size_t	  sl_cur;
44c98b9231Slukem } StringList;
45c98b9231Slukem 
46c98b9231Slukem __BEGIN_DECLS
4719b7469aSperry StringList 	*sl_init(void);
4819b7469aSperry int		 sl_add(StringList *, char *);
4919b7469aSperry void		 sl_free(StringList *, int);
5011d84394Schristos char 		*sl_find(StringList *, const char *);
5111d84394Schristos int		 sl_delete(StringList *, const char *, int);
52c98b9231Slukem __END_DECLS
53c98b9231Slukem 
54c98b9231Slukem #endif /* _STRINGLIST_H */
55