xref: /csrg-svn/lib/libc/db/hash/README (revision 46501)
1*46501Sbostic#	@(#)README	5.2 (Berkeley) 02/21/91
246363Sbostic
346363SbosticThis package implements a superset of the hsearch and dbm/ndbm libraries.
446363Sbostic
546363SbosticContents:
646363Sbostic
746363SbosticHashing Package:
846363Sbostic	dynahash.c
946363Sbostic	page.c
1046363Sbostic	buf.c
1146363Sbostic	big.c
1246363Sbostic	hfunc.c
1346363Sbostic	log2.c
1446363Sbostic
1546363Sbostic	hash.h
1646363Sbostic	page.h
1746363Sbostic	db.h
1846363Sbostic
1946363SbosticBackward Compatibility Routines:
2046363Sbostic	ndbm.c
2146363Sbostic	ndbm.h
2246363Sbostic	hsearch.c
2346363Sbostic	search.h
2446363Sbostic
25*46501SbosticMisc:
2646363Sbostic	byte_order.c
2746363Sbostic
28*46501SbosticCompatibilty routines:
2946363Sbostic	mkstemp.c
3046363Sbostic
31*46501Sbostic	ansi.h
32*46501Sbostic	cdefs.h
33*46501Sbostic	endian.h
34*46501Sbostic	posix.h
35*46501Sbostic	unistd.h
36*46501Sbostic
37*46501SbosticDIFFS:
38*46501Sbostic	These are diffs since the date of the file (i.e. a file labeled
39*46501Sbostic	DIFFS.2.12 are the diffs since the 2.12 version on arpa).  The
40*46501Sbostic	date of the DIFF file indicates when those diffs were installed.
41*46501Sbostic
4246363SbosticTest Programs:
4346363Sbostic	All test programs which need key/data pairs expect them entered
4446363Sbostic	with key and data on separate lines
4546363Sbostic
4646363Sbostic	tcreat3.c
4746363Sbostic		Takes
4846363Sbostic			bucketsize (bsize),
4946363Sbostic			fill factor (ffactor), and
5046363Sbostic			initial number of elements (nelem).
5146363Sbostic		Creates a hash table named hashtest containing the
5246363Sbostic		keys/data pairs entered from standard in.
5346363Sbostic	thash4.c
5446363Sbostic		Takes
5546363Sbostic			bucketsize (bsize),
5646363Sbostic			fill factor (ffactor),
5746363Sbostic			initial number of elements (nelem)
5846363Sbostic			bytes of cache (ncached), and
5946363Sbostic			file from which to read data  (fname)
6046363Sbostic		Creates a table from the key/data pairs on standard in and
6146363Sbostic		then does a read of each key/data in fname
6246363Sbostic	tdel.c
6346363Sbostic		Takes
6446363Sbostic			bucketsize (bsize), and
6546363Sbostic			fill factor (ffactor).
6646363Sbostic			file from which to read data (fname)
6746363Sbostic		Reads each key/data pair from fname and deletes the
6846363Sbostic		key from the hash table hashtest
6946363Sbostic	tseq.c
7046363Sbostic		Reads the key/data pairs in the file hashtest and writes them
7146363Sbostic		to standard out.
7246363Sbostic	tread2.c
7346363Sbostic		Takes
7446363Sbostic			butes of cache (ncached).
7546363Sbostic		Reads key/data pairs from standard in and looks them up
7646363Sbostic		in the file hashtest.
7746363Sbostic	tverify.c
7846363Sbostic		Reads key/data pairs from standard in, looks them up
7946363Sbostic		in the file hashtest, and verifies that the data is
8046363Sbostic		correct.
8146363Sbostic
82*46501SbosticNOTES:
8346363Sbostic
84*46501SbosticIf you are not running a 4.3BSD-Reno or later system, you may need to use
85*46501Sbosticsome of the compatibility files provided.  The files are as follows:
86*46501Sbostic
87*46501Sbostic	mkstemp.c	Mkstemp/mktemp library routine.
88*46501Sbostic
89*46501Sbostic	ansi.h		Map bcopy and friends to memcpy and friends.
90*46501Sbostic	cdefs.h		Handle the function prototypes in other include files.
91*46501Sbostic	endian.h	Handle byte ordering.  Be sure to set BYTE_ORDER in
92*46501Sbostic			endian.h appropriately for your machine.  If you don't
93*46501Sbostic			know what "endian" your machine is, compile
94*46501Sbostic			byte_order.c and run it.  It should tell you.
95*46501Sbostic	posix.h		Map various POSIX 1003.1 things to old-style things.
96*46501Sbostic	unistd.h	POSIX 1003.1 definitions.
97*46501Sbostic
98*46501SbosticThe file search.h is provided for using the hsearch compatible interface
99*46501Sbosticon BSD systems.  On System V derived systems, search.h should appear in
10046363Sbostic/usr/include.
10146363Sbostic
10246363SbosticThe man page db.3 explains the interface to the hashing system.
10346363SbosticThe file hash.ps is a postscript copy of a paper explaining
10446363Sbosticthe history, implementation, and performance of the hash package.
105*46501Sbostic
106*46501Sbostic"bugs" or idiosyncracies
107*46501Sbostic
108*46501SbosticIf you have a lot of overflows, it is possible to run out of overflow
109*46501Sbosticpages.  Currently, this will cause a message to be printed on stderr.
110*46501SbosticEventually, this will be indicated by a return error code.
111*46501Sbostic
112*46501SbosticIf you are using the ndbm interface and exit without flushing or closing the
113*46501Sbosticfile, you may lose updates since the package buffers all writes.  Also,
114*46501Sbosticthe db interface only creates a single database file.  To avoid overwriting
115*46501Sbosticthe user's original file, the suffix ".db" is appended to the file name
116*46501Sbosticpassed to dbm_open.  Additionally, if your code "knows" about the historic
117*46501Sbostic.dir and .pag files, it will break.
118*46501Sbostic
119*46501SbosticThere is a fundamental difference between this package and the old hsearch.
120*46501SbosticHsearch requires the user to maintain the keys and data in the application's
121*46501Sbosticallocated memory while hash takes care of all storage management.  The down
122*46501Sbosticside is that the byte strings passed in the ENTRY structure must be null
123*46501Sbosticterminated (both the keys and the data).
124