1178825Sdfr/* $FreeBSD$ */ 2178825Sdfr/* $NetBSD: citrus_lookup.h,v 1.2 2004/07/21 14:16:34 tshiozak Exp $ */ 3178825Sdfr 4178825Sdfr/*- 5178825Sdfr * Copyright (c)2003 Citrus Project, 6178825Sdfr * All rights reserved. 7178825Sdfr * 8178825Sdfr * Redistribution and use in source and binary forms, with or without 9178825Sdfr * modification, are permitted provided that the following conditions 10178825Sdfr * are met: 11178825Sdfr * 1. Redistributions of source code must retain the above copyright 12178825Sdfr * notice, this list of conditions and the following disclaimer. 13178825Sdfr * 2. Redistributions in binary form must reproduce the above copyright 14178825Sdfr * notice, this list of conditions and the following disclaimer in the 15178825Sdfr * documentation and/or other materials provided with the distribution. 16178825Sdfr * 17178825Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18178825Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19178825Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20178825Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21178825Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22178825Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23178825Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24178825Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25178825Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26178825Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27178825Sdfr * SUCH DAMAGE. 28178825Sdfr */ 29178825Sdfr 30178825Sdfr#ifndef _CITRUS_LOOKUP_H_ 31178825Sdfr#define _CITRUS_LOOKUP_H_ 32178825Sdfr 33178825Sdfr#define _CITRUS_LOOKUP_CASE_SENSITIVE 0 34178825Sdfr#define _CITRUS_LOOKUP_CASE_IGNORE 1 35178825Sdfr 36178825Sdfrstruct _citrus_lookup; 37178825Sdfr__BEGIN_DECLS 38178825Sdfrchar *_citrus_lookup_simple(const char *, const char *, char *, 39178825Sdfr size_t, int); 40178825Sdfrint _citrus_lookup_seq_open(struct _citrus_lookup **, 41178825Sdfr const char *, int); 42178825Sdfrvoid _citrus_lookup_seq_rewind(struct _citrus_lookup *); 43178825Sdfrint _citrus_lookup_seq_next(struct _citrus_lookup *, 44178825Sdfr struct _region *, struct _region *); 45178825Sdfrint _citrus_lookup_seq_lookup(struct _citrus_lookup *, 46178825Sdfr const char *, struct _region *); 47178825Sdfrint _citrus_lookup_get_number_of_entries(struct _citrus_lookup *); 48178825Sdfrvoid _citrus_lookup_seq_close(struct _citrus_lookup *); 49178825Sdfr__END_DECLS 50178825Sdfr 51178825Sdfrstatic __inline const char * 52178825Sdfr_citrus_lookup_alias(const char *path, const char *key, char *buf, size_t n, 53178825Sdfr int ignore_case) 54178825Sdfr{ 55178825Sdfr const char *ret; 56178825Sdfr 57178825Sdfr ret = _citrus_lookup_simple(path, key, buf, n, ignore_case); 58178825Sdfr if (ret == NULL) 59178825Sdfr ret = key; 60178825Sdfr 61178825Sdfr return (ret); 62178825Sdfr} 63178825Sdfr 64178825Sdfr#endif 65178825Sdfr