1*0c3983b2SBen Gras /* $NetBSD: manconf.h,v 1.3 2006/04/10 14:39:06 chuck Exp $ */ 2*0c3983b2SBen Gras 3*0c3983b2SBen Gras /*- 4*0c3983b2SBen Gras * Copyright (c) 1993 5*0c3983b2SBen Gras * The Regents of the University of California. 6*0c3983b2SBen Gras * All rights reserved. 7*0c3983b2SBen Gras * 8*0c3983b2SBen Gras * Redistribution and use in source and binary forms, with or without 9*0c3983b2SBen Gras * modification, are permitted provided that the following conditions 10*0c3983b2SBen Gras * are met: 11*0c3983b2SBen Gras * 1. Redistributions of source code must retain the above copyright 12*0c3983b2SBen Gras * notice, this list of conditions and the following disclaimer. 13*0c3983b2SBen Gras * 2. Redistributions in binary form must reproduce the above copyright 14*0c3983b2SBen Gras * notice, this list of conditions and the following disclaimer in the 15*0c3983b2SBen Gras * documentation and/or other materials provided with the distribution. 16*0c3983b2SBen Gras * 3. Neither the name of the University nor the names of its contributors 17*0c3983b2SBen Gras * may be used to endorse or promote products derived from this software 18*0c3983b2SBen Gras * without specific prior written permission. 19*0c3983b2SBen Gras * 20*0c3983b2SBen Gras * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21*0c3983b2SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*0c3983b2SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*0c3983b2SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24*0c3983b2SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25*0c3983b2SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26*0c3983b2SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27*0c3983b2SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28*0c3983b2SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29*0c3983b2SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30*0c3983b2SBen Gras * SUCH DAMAGE. 31*0c3983b2SBen Gras * 32*0c3983b2SBen Gras * @(#)config.h 8.4 (Berkeley) 12/18/93 33*0c3983b2SBen Gras */ 34*0c3983b2SBen Gras 35*0c3983b2SBen Gras /* 36*0c3983b2SBen Gras * manconf.h: common data structures and APIs shared across all programs 37*0c3983b2SBen Gras * that access man.conf (currently: apropos, catman, makewhatis, man, and 38*0c3983b2SBen Gras * whatis). 39*0c3983b2SBen Gras */ 40*0c3983b2SBen Gras 41*0c3983b2SBen Gras /* TAG: top-level structure (one per section/reserved word) */ 42*0c3983b2SBen Gras typedef struct _tag { 43*0c3983b2SBen Gras TAILQ_ENTRY(_tag) q; /* Queue of tags */ 44*0c3983b2SBen Gras 45*0c3983b2SBen Gras TAILQ_HEAD(tqh, _entry) entrylist; /* Queue of entries */ 46*0c3983b2SBen Gras char *s; /* Associated string */ 47*0c3983b2SBen Gras size_t len; /* Length of 's' */ 48*0c3983b2SBen Gras } TAG; 49*0c3983b2SBen Gras 50*0c3983b2SBen Gras /* ENTRY: each TAG has one or more ENTRY strings linked off of it */ 51*0c3983b2SBen Gras typedef struct _entry { 52*0c3983b2SBen Gras TAILQ_ENTRY(_entry) q; /* Queue of entries */ 53*0c3983b2SBen Gras 54*0c3983b2SBen Gras char *s; /* Associated string */ 55*0c3983b2SBen Gras size_t len; /* Length of 's' */ 56*0c3983b2SBen Gras } ENTRY; 57*0c3983b2SBen Gras 58*0c3983b2SBen Gras int addentry(TAG *, const char *, int); 59*0c3983b2SBen Gras void config(const char *); 60*0c3983b2SBen Gras TAG *gettag(const char *, int); 61