xref: /freebsd-src/contrib/mandoc/compat_stringlist.h (revision 6d38604fc532a3fc060788e3ce40464b46047eaf)
1*6d38604fSBaptiste Daroussin /*	$Id: compat_stringlist.h,v 1.5 2020/06/15 21:48:09 schwarze Exp $ */
2*6d38604fSBaptiste Daroussin /*	$NetBSD: stringlist.h,v 1.7 2008/04/28 20:22:54 martin Exp $	*/
361d06d6bSBaptiste Daroussin 
4*6d38604fSBaptiste Daroussin /*-
5*6d38604fSBaptiste Daroussin  * Copyright (c) 1994 The NetBSD Foundation, Inc.
661d06d6bSBaptiste Daroussin  * All rights reserved.
761d06d6bSBaptiste Daroussin  *
8*6d38604fSBaptiste Daroussin  * This code is derived from software contributed to The NetBSD Foundation
9*6d38604fSBaptiste Daroussin  * by Christos Zoulas.
10*6d38604fSBaptiste Daroussin  *
1161d06d6bSBaptiste Daroussin  * Redistribution and use in source and binary forms, with or without
1261d06d6bSBaptiste Daroussin  * modification, are permitted provided that the following conditions
1361d06d6bSBaptiste Daroussin  * are met:
1461d06d6bSBaptiste Daroussin  * 1. Redistributions of source code must retain the above copyright
1561d06d6bSBaptiste Daroussin  *    notice, this list of conditions and the following disclaimer.
1661d06d6bSBaptiste Daroussin  * 2. Redistributions in binary form must reproduce the above copyright
1761d06d6bSBaptiste Daroussin  *    notice, this list of conditions and the following disclaimer in the
1861d06d6bSBaptiste Daroussin  *    documentation and/or other materials provided with the distribution.
1961d06d6bSBaptiste Daroussin  *
20*6d38604fSBaptiste Daroussin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21*6d38604fSBaptiste Daroussin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22*6d38604fSBaptiste Daroussin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23*6d38604fSBaptiste Daroussin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24*6d38604fSBaptiste Daroussin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25*6d38604fSBaptiste Daroussin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26*6d38604fSBaptiste Daroussin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27*6d38604fSBaptiste Daroussin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28*6d38604fSBaptiste Daroussin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29*6d38604fSBaptiste Daroussin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30*6d38604fSBaptiste Daroussin  * POSSIBILITY OF SUCH DAMAGE.
3161d06d6bSBaptiste Daroussin  */
3261d06d6bSBaptiste Daroussin 
3361d06d6bSBaptiste Daroussin #include <sys/types.h>
3461d06d6bSBaptiste Daroussin 
3561d06d6bSBaptiste Daroussin /*
3661d06d6bSBaptiste Daroussin  * Simple string list
3761d06d6bSBaptiste Daroussin  */
3861d06d6bSBaptiste Daroussin typedef struct _stringlist {
3961d06d6bSBaptiste Daroussin 	char	**sl_str;
4061d06d6bSBaptiste Daroussin 	size_t	  sl_max;
4161d06d6bSBaptiste Daroussin 	size_t	  sl_cur;
4261d06d6bSBaptiste Daroussin } StringList;
4361d06d6bSBaptiste Daroussin 
4461d06d6bSBaptiste Daroussin StringList	*sl_init(void);
4561d06d6bSBaptiste Daroussin int		 sl_add(StringList *, char *);
4661d06d6bSBaptiste Daroussin void		 sl_free(StringList *, int);
4761d06d6bSBaptiste Daroussin char		*sl_find(StringList *, const char *);
48*6d38604fSBaptiste Daroussin int		 sl_delete(StringList *, const char *, int);
49