1 2This package implements a superset of the hsearch and dbm/ndbm libraries. 3 4Test Programs: 5 All test programs which need key/data pairs expect them entered 6 with key and data on separate lines 7 8 tcreat3.c 9 Takes 10 bucketsize (bsize), 11 fill factor (ffactor), and 12 initial number of elements (nelem). 13 Creates a hash table named hashtest containing the 14 keys/data pairs entered from standard in. 15 thash4.c 16 Takes 17 bucketsize (bsize), 18 fill factor (ffactor), 19 initial number of elements (nelem) 20 bytes of cache (ncached), and 21 file from which to read data (fname) 22 Creates a table from the key/data pairs on standard in and 23 then does a read of each key/data in fname 24 tdel.c 25 Takes 26 bucketsize (bsize), and 27 fill factor (ffactor). 28 file from which to read data (fname) 29 Reads each key/data pair from fname and deletes the 30 key from the hash table hashtest 31 tseq.c 32 Reads the key/data pairs in the file hashtest and writes them 33 to standard out. 34 tread2.c 35 Takes 36 butes of cache (ncached). 37 Reads key/data pairs from standard in and looks them up 38 in the file hashtest. 39 tverify.c 40 Reads key/data pairs from standard in, looks them up 41 in the file hashtest, and verifies that the data is 42 correct. 43 44NOTES: 45 46The man page ../man/db.3 explains the interface to the hashing system. 47The file hash.ps is a postscript copy of a paper explaining 48the history, implementation, and performance of the hash package. 49 50"bugs" or idiosyncracies 51 52If you have a lot of overflows, it is possible to run out of overflow 53pages. Currently, this will cause a message to be printed on stderr. 54Eventually, this will be indicated by a return error code. 55 56If you are using the ndbm interface and exit without flushing or closing the 57file, you may lose updates since the package buffers all writes. Also, 58the db interface only creates a single database file. To avoid overwriting 59the user's original file, the suffix ".db" is appended to the file name 60passed to dbm_open. Additionally, if your code "knows" about the historic 61.dir and .pag files, it will break. 62 63There is a fundamental difference between this package and the old hsearch. 64Hsearch requires the user to maintain the keys and data in the application's 65allocated memory while hash takes care of all storage management. The down 66side is that the byte strings passed in the ENTRY structure must be null 67terminated (both the keys and the data). 68