/contrib/cvs/src/myndbm.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 59 lines · 29 code · 9 blank · 21 comment · 0 complexity · fbe370d61ad514cd3ac3cf0178c16420 MD5 · raw file

  1. /*
  2. * Copyright (C) 1994-2005 The Free Software Foundation, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2, or (at your option)
  7. * any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifdef MY_NDBM
  15. #define DBLKSIZ 4096
  16. typedef struct
  17. {
  18. List *dbm_list; /* cached database */
  19. Node *dbm_next; /* next key to return for nextkey() */
  20. /* Name of the file to write to if modified is set. malloc'd. */
  21. char *name;
  22. /* Nonzero if the database has been modified and dbm_close needs to
  23. write it out to disk. */
  24. int modified;
  25. } DBM;
  26. typedef struct
  27. {
  28. char *dptr;
  29. int dsize;
  30. } datum;
  31. /*
  32. * So as not to conflict with other dbm_open, etc., routines that may
  33. * be included by someone's libc, all of my emulation routines are prefixed
  34. * by "my" and we define the "standard" ones to be "my" ones here.
  35. */
  36. #define dbm_open mydbm_open
  37. #define dbm_close mydbm_close
  38. #define dbm_fetch mydbm_fetch
  39. #define dbm_firstkey mydbm_firstkey
  40. #define dbm_nextkey mydbm_nextkey
  41. #define dbm_store mydbm_store
  42. #define DBM_INSERT 0
  43. #define DBM_REPLACE 1
  44. DBM *mydbm_open PROTO((char *file, int flags, int mode));
  45. void mydbm_close PROTO((DBM * db));
  46. datum mydbm_fetch PROTO((DBM * db, datum key));
  47. datum mydbm_firstkey PROTO((DBM * db));
  48. datum mydbm_nextkey PROTO((DBM * db));
  49. extern int mydbm_store PROTO ((DBM *, datum, datum, int));
  50. #endif /* MY_NDBM */