home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / llib-dbm < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  2.0 KB

  1. From: genrad!mit-eddie!mirror!rs (Rich Salz)
  2. Subject: Submission for mod.sources
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 86
  7. Submitted by: genrad!mit-eddie!mirror!rs (Rich Salz)
  8.  
  9.  
  10. At least on the distributed 4.2 there is no lint library specification
  11. for the DBM library.  Here's one.
  12.  
  13. --
  14. Rich $alz    {mit-eddie, ihnp4!inmet, wjh12, cca, datacube}!mirror!rs
  15. Mirror Systems    2067 Massachusetts Avenue  Cambridge, MA, 02140
  16. Telephone:    6,176,610,777
  17.  
  18. # This is a shell archive.  Remove anything before this line,
  19. # then unpack it by saving it in a file and typing "sh file".
  20. #
  21. # Wrapped by mirror!rs on Wed Dec  4 17:00:49 EST 1985
  22. # Contents:  llib-ldbm
  23.  
  24. echo x - llib-ldbm
  25. sed 's/^XX//' > "llib-ldbm" <<'@//E*O*F llib-ldbm//'
  26. XX/*
  27. XXstatic char sccsid[] = "@(#)dbm.c    4.1 (Berkeley) 6/27/83";
  28. XX*/
  29.  
  30. XX#include    "dbm.h"
  31. XX#include    <sys/types.h>
  32. XX#include    <sys/stat.h>
  33.  
  34. XX/* initialize the data. */
  35. XXlong bitno = 1;
  36. XXlong maxbno = 1;
  37. XXlong blkno = 1;
  38. XXlong hmask = 1;
  39. XXint dirf = 1;
  40. XXint pagf = 1;
  41. XXint dbrdonly = 1;
  42.  
  43. XX/* needed herein. */
  44. XXstatic datum __data__;
  45.  
  46. XXdbminit(file)
  47. XX    char *file;
  48. XX    { return(pagbuf[0] = dirbuf[0] = *file); }
  49.  
  50. XXlong forder(key)
  51. XX    datum key;
  52. XX    { return(key.dsize); }
  53.  
  54. XXdatum fetch(key)
  55. XX    datum key;
  56. XX    { return(key); }
  57.  
  58. XXdelete(key)
  59. XX    datum key;
  60. XX    { blkno = key.dsize; }
  61.  
  62. XXstore(key, dat)
  63. XX    datum key, dat;
  64. XX    { key = dat; }
  65.  
  66. XXdatum firstkey()
  67. XX    { return(__data__); }
  68.  
  69. XXdatum nextkey(key)
  70. XX    datum key;
  71. XX    { return(key); }
  72.  
  73. XXdatum firsthash(hash)
  74. XX    long hash;
  75. XX    { return(blkno = hash, __data__); }
  76.  
  77. XXdatum makdatum(buf, n)
  78. XX    char buf[PBLKSIZ];
  79. XX    { return(__data__.dptr = buf+n, __data__); }
  80.  
  81. XXcmpdatum(d1, d2)
  82. XX    datum d1, d2;
  83. XX    { return(d1.dsize - d2.dsize); }
  84.  
  85. XXlong hashinc(hash)
  86. XX    long hash;
  87. XX    { return(hash); }
  88.  
  89. XXlong calchash(item)
  90. XX    datum item;
  91. XX    { return(item.dsize); }
  92. @//E*O*F llib-ldbm//
  93. chmod u=rw,g=rw,o=rw llib-ldbm
  94.  
  95. exit 0
  96.  
  97.