1235537Sgber/* 2235537Sgber * Copyright (c) 1999, Boris Popov 3235537Sgber * All rights reserved. 4235537Sgber * 5235537Sgber * Redistribution and use in source and binary forms, with or without 6235537Sgber * modification, are permitted provided that the following conditions 7235537Sgber * are met: 8235537Sgber * 1. Redistributions of source code must retain the above copyright 9235537Sgber * notice, this list of conditions and the following disclaimer. 10235537Sgber * 2. Redistributions in binary form must reproduce the above copyright 11235537Sgber * notice, this list of conditions and the following disclaimer in the 12235537Sgber * documentation and/or other materials provided with the distribution. 13235537Sgber * 3. Neither the name of the author nor the names of any co-contributors 14235537Sgber * may be used to endorse or promote products derived from this software 15235537Sgber * without specific prior written permission. 16235537Sgber * 17235537Sgber * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18235537Sgber * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19235537Sgber * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20235537Sgber * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21235537Sgber * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22235537Sgber * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23235537Sgber * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24235537Sgber * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25235537Sgber * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26235537Sgber * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27235537Sgber * SUCH DAMAGE. 28235537Sgber * 29235537Sgber * $FreeBSD$ 30235537Sgber * 31235537Sgber * from: FreeBSD: src/lib/libncp/ncpl_rcfile.c,v 1.5 2007/01/09 23:27:39 imp Exp 32235537Sgber */ 33235537Sgber 34235537Sgber#ifndef _SIMRC_H_ 35235537Sgber#define _SIMRC_H_ 36235537Sgber 37235537Sgber#include <sys/queue.h> 38235537Sgber 39235537Sgberstruct rckey { 40235537Sgber SLIST_ENTRY(rckey) rk_next; 41235537Sgber char *rk_name; /* key name */ 42235537Sgber char *rk_value; /* key value */ 43235537Sgber}; 44235537Sgber 45235537Sgberstruct rcsection { 46235537Sgber SLIST_ENTRY(rcsection) rs_next; 47235537Sgber SLIST_HEAD(rckey_head,rckey) rs_keys; /* key list */ 48235537Sgber char *rs_name; /* section name */ 49235537Sgber int rs_id; /* allow few same named */ 50235537Sgber}; 51235537Sgber 52235537Sgberstruct rcfile { 53235537Sgber SLIST_ENTRY(rcfile) rf_next; 54235537Sgber SLIST_HEAD(rcsec_head, rcsection) rf_sect; /* sections list */ 55235537Sgber char *rf_name; /* file name */ 56235537Sgber FILE *rf_f; /* file desc */ 57235537Sgber}; 58235537Sgber 59235537Sgberint rc_open(const char *, const char *,struct rcfile **); 60235537Sgberint rc_close(struct rcfile *); 61235537Sgberint rc_getstringptr(struct rcfile *, const char *, int, const char *, 62235537Sgber char **); 63235537Sgberint rc_getstring(struct rcfile *, const char *, int, const char *, 64235537Sgber unsigned int, char *); 65235537Sgberint rc_getint(struct rcfile *, const char *, int, const char *, int *); 66235537Sgberint rc_getbool(struct rcfile *, const char *, int, const char *, int *); 67235537Sgberint rc_getsectionscount(struct rcfile *, const char *); 68235537Sgberchar **rc_getkeys(struct rcfile *, const char *, int); 69235537Sgber 70235537Sgber#endif /* _SIMRC_H_ */ 71