1*c7ef0cfcSnicm /* $OpenBSD: hashed_db.h,v 1.2 2023/10/17 09:52:08 nicm Exp $ */ 281d8c4e1Snicm 381d8c4e1Snicm /**************************************************************************** 4*c7ef0cfcSnicm * Copyright 2020 Thomas E. Dickey * 5*c7ef0cfcSnicm * Copyright 2006-2014,2017 Free Software Foundation, Inc. * 681d8c4e1Snicm * * 781d8c4e1Snicm * Permission is hereby granted, free of charge, to any person obtaining a * 881d8c4e1Snicm * copy of this software and associated documentation files (the * 981d8c4e1Snicm * "Software"), to deal in the Software without restriction, including * 1081d8c4e1Snicm * without limitation the rights to use, copy, modify, merge, publish, * 1181d8c4e1Snicm * distribute, distribute with modifications, sublicense, and/or sell * 1281d8c4e1Snicm * copies of the Software, and to permit persons to whom the Software is * 1381d8c4e1Snicm * furnished to do so, subject to the following conditions: * 1481d8c4e1Snicm * * 1581d8c4e1Snicm * The above copyright notice and this permission notice shall be included * 1681d8c4e1Snicm * in all copies or substantial portions of the Software. * 1781d8c4e1Snicm * * 1881d8c4e1Snicm * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1981d8c4e1Snicm * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 2081d8c4e1Snicm * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 2181d8c4e1Snicm * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 2281d8c4e1Snicm * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2381d8c4e1Snicm * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2481d8c4e1Snicm * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2581d8c4e1Snicm * * 2681d8c4e1Snicm * Except as contained in this notice, the name(s) of the above copyright * 2781d8c4e1Snicm * holders shall not be used in advertising or otherwise to promote the * 2881d8c4e1Snicm * sale, use or other dealings in this Software without prior written * 2981d8c4e1Snicm * authorization. * 3081d8c4e1Snicm ****************************************************************************/ 3181d8c4e1Snicm 3281d8c4e1Snicm /**************************************************************************** 3381d8c4e1Snicm * Author: Thomas E. Dickey 2006 * 3481d8c4e1Snicm ****************************************************************************/ 3581d8c4e1Snicm 3681d8c4e1Snicm /* 37*c7ef0cfcSnicm * $Id: hashed_db.h,v 1.2 2023/10/17 09:52:08 nicm Exp $ 3881d8c4e1Snicm */ 3981d8c4e1Snicm 4081d8c4e1Snicm #ifndef HASHED_DB_H 4181d8c4e1Snicm #define HASHED_DB_H 1 4281d8c4e1Snicm 43*c7ef0cfcSnicm #include <ncurses_cfg.h> 44*c7ef0cfcSnicm 4581d8c4e1Snicm #include <curses.h> 4681d8c4e1Snicm 4781d8c4e1Snicm #if USE_HASHED_DB 4881d8c4e1Snicm 49*c7ef0cfcSnicm #define DB_DBM_HSEARCH 0 /* quiet gcc -Wundef with db6 */ 50*c7ef0cfcSnicm 5181d8c4e1Snicm #include <db.h> 5281d8c4e1Snicm 53*c7ef0cfcSnicm #ifndef DBM_SUFFIX 5481d8c4e1Snicm #define DBM_SUFFIX ".db" 5581d8c4e1Snicm #endif 5681d8c4e1Snicm 5781d8c4e1Snicm #ifdef DB_VERSION_MAJOR 5881d8c4e1Snicm #define HASHED_DB_API DB_VERSION_MAJOR 5981d8c4e1Snicm #else 6081d8c4e1Snicm #define HASHED_DB_API 1 /* e.g., db 1.8.5 */ 6181d8c4e1Snicm #endif 6281d8c4e1Snicm 6381d8c4e1Snicm extern NCURSES_EXPORT(DB *) _nc_db_open(const char * /* path */, bool /* modify */); 6481d8c4e1Snicm extern NCURSES_EXPORT(bool) _nc_db_have_data(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */); 6581d8c4e1Snicm extern NCURSES_EXPORT(bool) _nc_db_have_index(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */); 6681d8c4e1Snicm extern NCURSES_EXPORT(int) _nc_db_close(DB * /* db */); 6781d8c4e1Snicm extern NCURSES_EXPORT(int) _nc_db_first(DB * /* db */, DBT * /* key */, DBT * /* data */); 6881d8c4e1Snicm extern NCURSES_EXPORT(int) _nc_db_next(DB * /* db */, DBT * /* key */, DBT * /* data */); 6981d8c4e1Snicm extern NCURSES_EXPORT(int) _nc_db_get(DB * /* db */, DBT * /* key */, DBT * /* data */); 7081d8c4e1Snicm extern NCURSES_EXPORT(int) _nc_db_put(DB * /* db */, DBT * /* key */, DBT * /* data */); 7181d8c4e1Snicm 7281d8c4e1Snicm #endif 7381d8c4e1Snicm 7481d8c4e1Snicm #endif /* HASHED_DB_H */ 75