home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / useful / dist / gnu / gdbm / gdbm-1.6-amiga / readme < prev    next >
Encoding:
Text File  |  1993-07-19  |  12.5 KB  |  389 lines

  1. This is release 1.6 of GNU dbm.  It now uses GNU autoconf for configuration.
  2.  
  3. To compile gdbm:
  4.  
  5.    a)  configure <config parameters like -prefix ...>
  6.    b)  make
  7.  
  8. To Install
  9.  
  10.    a)  make install
  11.  
  12. (You might want to "make -n install" to make sure it will put things
  13. were you want them.)
  14.  
  15. ------------------------------------------
  16.  
  17. The following remains 
  18.  
  19. The files are:
  20.  
  21. COPYING        - Copying information.
  22. README        - This file.
  23.  
  24. bucket.c, extern.h, falloc.c, findkey.c, gdbm.proto, gdbmclose.c,
  25. gdbmconst.h gdbmdefs.h, gdbmdelete.c, gdbmerrno.h, gdbmfetch.c, gdbmsync.c,
  26. gdbmopen.c, gdbmreorg.c, gdbmseq.c, gdbmstore.c, global.c, gndbm.h,
  27. hash.c systems.h, update.c, version.c - Source for GNU dbm library.
  28.  
  29. dbm.h dbminit.c, delete.c, fetch.c, seq.c, store.c - Source for the
  30. DBM interface.
  31.  
  32. dbmclose.c, dbmdelete.c, dbmdirfno.c, dbmfetch.c, dbmopen.c, dbmpagfno.c
  33. dbmseq.c, dbmstore.c, ndbm.h - Source for the NDBM interface.
  34.  
  35. Makefile     - Makefile, will make gdbm.a  (BSD and SYSV)
  36. testgdbm.c    - A simple test program.
  37. testdbm.c    - A simple test program.
  38. testndbm.c    - A simple test program.
  39. conv2gdbm.c    - A dbm database conversion program.
  40.  
  41. gdbm.3, gdbm.texinfo - Documentation for gdbm.
  42.  
  43. CHANGES from 1.5 to 1.6
  44.   1.  New documentation in both man and texinfo formats.
  45.   2.  Bug fixes.
  46.   3.  A New "writers" mode that does not fsync the database.
  47.   4.  Uses Autoconf now.
  48.  
  49. CHANGES from 1.4 to 1.5:
  50.   1.  Minor bug fixes.  See the ChangeLog.
  51.   2.  Added gdbmconst.h to allow users to change the size of the
  52.       bucket cache in the systems.h file.
  53.  
  54. CHANGES from 1.0 to 1.4:
  55.   1.  Mainly bug fixes.
  56.   2.  A define for "dbmclose()" was added to dbm.h for those few 
  57.       implementaions that need that call.
  58.   3.  For details, see the ChangeLog.
  59.  
  60. CHANGES from 0.9 to 1.0:
  61.   1.  Makefiles were combined into one and a few new things added to it.
  62.   2.  Several minor bugs were fixed including a cache bug.
  63.   3.  Two new calls (dbm_pagfno, dbm_dirfno) were added to the NDBM interface.
  64.   3.  A conversion program from dbm files to gdbm files was added.
  65.   4.  Reorganize was changed to allow complex file names. (dir/file form)
  66.   5.  testgdbm, testndbm, and testdbm were modified to return key and data
  67.       pairs where needed and to take an optional file name as an argument.
  68.       testgdbm had some command characters changed.
  69.   6.  The DBM and NDBM interfaces were separated.
  70.   7.  An include file for dbm users was added. (dbm.h)
  71.   8.  The include file for ndbm users was renamed ndbm.h. (It was gndbm.h.)
  72.  
  73. CHANGES from 0.8 to 0.9:
  74.   1.  The hash function changed.
  75.   2.  The file format changed.
  76.   3.  There was a complete rewrite of falloc.c.
  77.   4.  There were added compatiblity routines for ndbm.
  78.   5.  The file names for dbm compatibility routines were made to
  79.       look like dbm.
  80.   6.  Test programs changed.
  81.   7.  Support for System V.
  82.   8.  Various other small changes.
  83.   9.  The need for recovery and associated code was removed.
  84.  
  85.  
  86. GNU dbm is a set of database routines that use extendible hashing and
  87. works similar to the standard UNIX dbm routines.  The basic unit of
  88. data is the structure
  89.  
  90.   typedef struct {
  91.              char *dptr;
  92.              int   dsize;
  93.           } datum;
  94.  
  95. The following is a quick list of the routines.  After this list, a
  96. longer description of each routine will be given.  An include file
  97. will be produced that can be included by the user. The file is
  98. "gdbm.h".  The following routines are defined in terms of gdbm.h:
  99.  
  100.   GDBM_FILE gdbm_open ( name, block_size, read_write, mode, fatal_func )
  101.  
  102.   void gdbm_close ( dbf )
  103.   
  104.   int gdbm_store ( dbf, key, content, flags )
  105.  
  106.   datum gdbm_fetch ( dbf, key )
  107.  
  108.   int gdbm_delete ( dbf, key )
  109.  
  110.   datum gdbm_firstkey ( dbf )
  111.  
  112.   datum gdbm_nextkey ( dbf, key )
  113.  
  114.   int gdbm_reorganize ( dbf )
  115.  
  116.   void gdbm_sync ( dbf )
  117.  
  118.  
  119. For compatibility with the standard dbm, the following routines are 
  120. defined.  There is an include file for dbm users called "dbm.h".
  121.  
  122.   int dbminit ( name )
  123.  
  124.   int store ( key, content )
  125.  
  126.   datum fetch ( key )
  127.  
  128.   int delete ( key )
  129.  
  130.   datum firstkey ()
  131.  
  132.   datum nextkey ( key )
  133.  
  134.  
  135. There are also compatibility routines for ndbm.  For ndbm compatiblity
  136. routines, you need the include file "ndbm.h".  The routines are:
  137.  
  138. DBM *dbm_open (name, flags, mode)
  139.  
  140. void dbm_close (file)
  141.  
  142. datum dbm_fetch (file, key)
  143.  
  144. int dbm_store (file, key, content, flags)
  145.  
  146. int dbm_delete (file, key)
  147.  
  148. datum dbm_firstkey (file)
  149.  
  150. datum dbm_nextkey (file)
  151.  
  152. int dbm_error (file)
  153.  
  154. int dbm_clearerr (file)
  155.  
  156. int dbm_pagfno (file)
  157.  
  158. int dbm_dirfno (file)
  159.  
  160.  
  161. Description of GNU dbm routines.
  162. --------------------------------
  163.  
  164. GNU dbm allows multiple data files.  A routine that opens a gdbm file
  165. is designated as a "reader" or a "writer".  Only one writer may open a
  166. gdbm file and many readers may open the file.  Readers and writers can
  167. not open the gdbm file at the same time. The procedure for opening a
  168. gdbm file is:
  169.  
  170. GDBM_FILE dbf;
  171.  
  172. dbf = gdbm_open ( name, block_size, flags, mode, fatal_func )
  173.  
  174. The parameters are:
  175.   char *name - the name of the file (the complete name, gdbm does
  176.       not append any characters to this name)
  177.   int block_size - the size of a single transfer from disk to memory.
  178.       This parameter is ignored unless the file is a new file.
  179.       The minimum size is 512.  If it is less than 512, dbm will
  180.       use the stat block size for the file system.
  181.   int flags - 0 => reader, 1 => writer, 2 => writer (if the database
  182.       does not exist, create a new one, 3 => writer and create a new
  183.       database regardless if one exists.  (Defined in gdbm.h as
  184.       GDBM_READER, GDBM_WRITER, GDBM_WRCREAT, GDBM_NEWDB.)
  185.       4 + previous => no fsync (GDBM_FAST)
  186.   int mode - file mode (see chmod(2) and open(2)) if the file is created.
  187.   void (*fatal_func) () - a function for dbm to call if it detects a
  188.       fatal error. The only parameter of this function is a string.
  189.       If the value of 0 is provided, gdbm will use a default function.
  190.  
  191. The return value, dbf, is the pointer needed by all other routines to
  192. access that gdbm file.  If the return is the NULL pointer, gdbm_open
  193. was not successful.  The errors can be found in "gdbm_errno" for gdbm
  194. errors and in "errno" for file system errors.  (For error codes, see
  195. gdbmerrno.h.)
  196.  
  197. In all of the following calls, the parameter "dbf" refers to the pointer
  198. returned from gdbm_open.
  199.  
  200. It is important that every file opened is also closed.  This is needed to
  201. update the reader/writer count on the file.  This is done by:
  202.  
  203.   gdbm_close(dbf);
  204.  
  205.  
  206. The database is used by 3 primary routines.  The first stores data in the
  207. database.
  208.  
  209.   ret = gdbm_store ( dbf, key, content, flag )
  210.  
  211.   The parameters are:
  212.      char *dbf - the pointer returned by gdbm_open
  213.      datum key - the key data
  214.      datum content - the data to be associated with the key
  215.      int   flag - 0 => insert only, generate an error if key exists.
  216.               1 => replace contents if key exists.  (Defined in
  217.               gdbm.h as GDBM_INSERT and GDBM_REPLACE.)
  218.  
  219.   If a reader calls store, ret gets -1.  If called with GDBM_INSERT and
  220.   key is in the database, ret gets 1.  Otherwise, ret is 0.
  221.   NOTICE: If you store data for a key that is already in the data base,
  222.   gdbm replaces the old data with the new data if called with GDBM_REPLACE.
  223.   You do not get two data items for the same key and you do not get an
  224.   error from gdbm_store.
  225.   NOTICE: The size in gdbm is not restricted like dbm or ndbm.  Your data
  226.   can be as large as your "want".
  227.   NOTICE: Both key and content must have the dptr field be a non-NULL
  228.   value.  Since a NULL dptr field is used by other routines to indicate an
  229.   error, a NULL field cannot be valid data.  If either key or content have
  230.   a null dptr field, gdbm_open will return an error.
  231.  
  232. To search for some data:
  233.  
  234.   content = gdbm_fetch ( dbf, key )
  235.  
  236.   The parameters are:
  237.      char *dbf - the pointer returned by gdbm_open
  238.      datum key - the key data
  239.  
  240.   The "datum" returned in content is a pointer to the data found.  If the
  241.   dptr is NULL, no data was found.  If dptr is not NULL, then it points
  242.   to data allocated by malloc.  gdbm does not automatically free this data.
  243.   The user must free this storage when done using it.  This eliminates the
  244.   need to copy the result to save it for later use. (You just save the 
  245.   pointer.)
  246.  
  247. To remove some data from the database:
  248.  
  249.   ret = gdbm_delete ( dbf, key )
  250.  
  251.   The parameters are:
  252.      char *dbf - the pointer returned by gdbm_open
  253.      datum key - the key data
  254.  
  255.   The ret value is -1 if the item is not present or the requester is a reader.
  256.   The ret value is 0 if there was a successful delete.
  257.  
  258.  
  259. The next two routines allow for accessing all items in the database.  This 
  260. access is not key sequential, but it is guaranteed to visit every key in
  261. the database once.  (The order has to do with the hash values.)
  262.  
  263.   key = gdbm_firstkey ( dbf )
  264.  
  265.   nextkey = gdbm_nextkey ( dbf, key )
  266.  
  267.   The parameters are:
  268.      char *dbf - the pointer returned by gdbm_open
  269.      datum key - the key data
  270.  
  271.   The return values are both datum.  If key.dptr or nextkey.dptr is NULL,
  272.   there is no first key or next key.  Again notice that dptr points to
  273.   data allocated by malloc and gdbm will not free it for you. 
  274.  
  275. The following routine should be used very seldom.  
  276.   
  277.   ret = gdbm_reorganize ( dbf )
  278.  
  279.   If you have had a lot of deletions and would like to shrink the space
  280.   used by the gdbm file, the this routine will reorganize the database.
  281.   gdbm will not shorten the length of a gdbm file except by using this
  282.   reorganization.  (Deleted file space will be reused.)
  283.  
  284.  
  285. For use in the GDBM_FAST mode:
  286.  
  287.   gdbm_sync ( dbf )
  288.  
  289.   This routine returns only after the on-disk version of the file is
  290.   completely up to date.
  291.  
  292.  
  293. The following two are variables that may need to be used:
  294.  
  295.   gdbm_error gdbm_errno   -   the variable that contains more information
  296.                               about gdbm errors.  ( gdbm.h has the
  297.                   definitions of the error values. )
  298.  
  299.   char * gdbm_version     -   the string containing the version information.
  300.  
  301.  
  302. There are a few more things of interest.  First, gdbm files are not
  303. "sparse".  You can copy them with the UNIX cp command and they will
  304. not expand in the copying process.  Also, there is a compatibility
  305. mode for use with programs that already use UNIX dbm.  In this
  306. compatibility mode, no gdbm file pointer is required by the user.
  307. Only one file may be opened at a time.  All users in compatibility
  308. mode are assumed to be writers.  If the gdbm file is a read only, it
  309. will fail as a writer, but will also try to open it as a reader.  All
  310. returned pointers in datum structures point to data that gdbm WILL
  311. free.  They should be treated as static pointers (as standard UNIX dbm
  312. does).  The compatibility routine names are the same as the UNIX dbm
  313. routine names.  Their definitions follow:
  314.  
  315.   int dbminit ( name )
  316.  
  317.   int store ( key, content )
  318.  
  319.   datum fetch ( key )
  320.  
  321.   int delete ( key )
  322.  
  323.   datum firstkey ()
  324.  
  325.   datum nextkey ( key )
  326.  
  327. NOTE: Some implementations have an include file "dbm.h".  That file is just
  328. a file that defines datum and the above routines.  Many original dbm 
  329. sites do not have a "dbm.h" file.  One is included here for those who 
  330. want it.
  331.  
  332. WARNING: standard UNIX dbm and GNU dbm do not have the same data format in the
  333. file.  You cannot access a standard UNIX dbm file with GNU dbm!  If you want
  334. to use an old database with GNU dbm, you must use the convert program.
  335.  
  336. Also, GNU dbm has compatibility routines for ndbm.  For ndbm compatiblity
  337. routines, you need the include file "ndbm.h".  
  338.  
  339. WARNING: If you have ndbm and gdbm, there is a conflict in the names of the
  340. include file for the ndbm interface and the original ndbm package.  Do not
  341. blindly copy "ndbm.h" to your include directory.
  342.  
  343. The routines are:
  344.  
  345.     DBM *dbm_open (name, flags, mode)
  346.  
  347.     void dbm_close (file)
  348.  
  349.     datum dbm_fetch (file, key)
  350.  
  351.     int dbm_store (file, key, content, flags)
  352.  
  353.     int dbm_delete (file, key)
  354.  
  355.     datum dbm_firstkey (file)
  356.  
  357.     datum dbm_nextkey (file)
  358.  
  359.     int dbm_error (file)
  360.  
  361.     int dbm_clearerr (file)
  362.  
  363.     int dbm_dirfno (file)
  364.  
  365.     int dbm_pagfno (file)
  366.  
  367. Again, just like ndbm, any returned datum can be assumed to be static
  368. storage.  You do not have to free that memory, the ndbm compatibility
  369. routines will do it for you.
  370.  
  371.  
  372. CONV2GDBM
  373. ---------
  374.  
  375. The program conv2gdbm has been provided to help you convert from dbm
  376. databases to gdbm.  The usage is:
  377.  
  378.    conv2gdbm [-q] [-b block_size] dbm_file [gdbm_file]
  379.  
  380. The optional "block_size" is the same as in gdbm_open.  The dbm_file is
  381. the name of the dbm file without the .pag or .dir extensions.  The
  382. optional gdbm_file is the complete file name.  If not included, the
  383. gdbm file name is the same as the dbm file name without any extensions.
  384. That is "conv2gdbm dbmfile" converts the files "dbmfile.pag" and
  385. "dbmfile.dir" into a gdbm file called "dbmfile".  The -q option causes
  386. conv2gdbm to work quietly.
  387.  
  388.  
  389.