xref: /netbsd-src/usr.bin/man/manconf.h (revision 464029217b73aa4a84ae3563e7ddea430c137c96)
1*46402921Srillig /*	$NetBSD: manconf.h,v 1.4 2022/03/08 23:09:36 rillig Exp $	*/
27c96dd15Sthorpej 
37c96dd15Sthorpej /*-
47c96dd15Sthorpej  * Copyright (c) 1993
57c96dd15Sthorpej  *	The Regents of the University of California.
67c96dd15Sthorpej  * All rights reserved.
77c96dd15Sthorpej  *
87c96dd15Sthorpej  * Redistribution and use in source and binary forms, with or without
97c96dd15Sthorpej  * modification, are permitted provided that the following conditions
107c96dd15Sthorpej  * are met:
117c96dd15Sthorpej  * 1. Redistributions of source code must retain the above copyright
127c96dd15Sthorpej  *    notice, this list of conditions and the following disclaimer.
137c96dd15Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
147c96dd15Sthorpej  *    notice, this list of conditions and the following disclaimer in the
157c96dd15Sthorpej  *    documentation and/or other materials provided with the distribution.
1689aaa1bbSagc  * 3. Neither the name of the University nor the names of its contributors
177c96dd15Sthorpej  *    may be used to endorse or promote products derived from this software
187c96dd15Sthorpej  *    without specific prior written permission.
197c96dd15Sthorpej  *
207c96dd15Sthorpej  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
217c96dd15Sthorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
227c96dd15Sthorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
237c96dd15Sthorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
247c96dd15Sthorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
257c96dd15Sthorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
267c96dd15Sthorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
277c96dd15Sthorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
287c96dd15Sthorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
297c96dd15Sthorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
307c96dd15Sthorpej  * SUCH DAMAGE.
317c96dd15Sthorpej  *
327c96dd15Sthorpej  *	@(#)config.h	8.4 (Berkeley) 12/18/93
337c96dd15Sthorpej  */
347c96dd15Sthorpej 
35d09fe2c4Schuck /*
36d09fe2c4Schuck  * manconf.h: common data structures and APIs shared across all programs
37d09fe2c4Schuck  * that access man.conf (currently: apropos, catman, makewhatis, man, and
38d09fe2c4Schuck  * whatis).
39d09fe2c4Schuck  */
40d09fe2c4Schuck 
41d09fe2c4Schuck /* TAG: top-level structure (one per section/reserved word) */
427c96dd15Sthorpej typedef struct _tag {
43d09fe2c4Schuck 	TAILQ_ENTRY(_tag) q;			/* Queue of tags */
447c96dd15Sthorpej 
45d09fe2c4Schuck 	TAILQ_HEAD(tqh, _entry) entrylist;	/* Queue of entries */
46d09fe2c4Schuck 	char *s;				/* Associated string */
47d09fe2c4Schuck 	size_t len;				/* Length of 's' */
487c96dd15Sthorpej } TAG;
497c96dd15Sthorpej 
50d09fe2c4Schuck /* ENTRY: each TAG has one or more ENTRY strings linked off of it */
51d09fe2c4Schuck typedef struct _entry {
52d09fe2c4Schuck 	TAILQ_ENTRY(_entry) q;			/* Queue of entries */
53d09fe2c4Schuck 
54d09fe2c4Schuck 	char *s;				/* Associated string */
55d09fe2c4Schuck 	size_t len;				/* Length of 's' */
567c96dd15Sthorpej } ENTRY;
577c96dd15Sthorpej 
58d09fe2c4Schuck int	 addentry(TAG *, const char *, int);
59d09fe2c4Schuck void	 config(const char *);
60d09fe2c4Schuck TAG	*gettag(const char *, int);
61