158f0484fSRodney W. Grimes 258f0484fSRodney W. GrimesThis package implements a superset of the hsearch and dbm/ndbm libraries. 358f0484fSRodney W. Grimes 458f0484fSRodney W. GrimesTest Programs: 558f0484fSRodney W. Grimes All test programs which need key/data pairs expect them entered 658f0484fSRodney W. Grimes with key and data on separate lines 758f0484fSRodney W. Grimes 858f0484fSRodney W. Grimes tcreat3.c 958f0484fSRodney W. Grimes Takes 1058f0484fSRodney W. Grimes bucketsize (bsize), 1158f0484fSRodney W. Grimes fill factor (ffactor), and 1258f0484fSRodney W. Grimes initial number of elements (nelem). 1358f0484fSRodney W. Grimes Creates a hash table named hashtest containing the 1458f0484fSRodney W. Grimes keys/data pairs entered from standard in. 1558f0484fSRodney W. Grimes thash4.c 1658f0484fSRodney W. Grimes Takes 1758f0484fSRodney W. Grimes bucketsize (bsize), 1858f0484fSRodney W. Grimes fill factor (ffactor), 1958f0484fSRodney W. Grimes initial number of elements (nelem) 2058f0484fSRodney W. Grimes bytes of cache (ncached), and 2158f0484fSRodney W. Grimes file from which to read data (fname) 2258f0484fSRodney W. Grimes Creates a table from the key/data pairs on standard in and 2358f0484fSRodney W. Grimes then does a read of each key/data in fname 2458f0484fSRodney W. Grimes tdel.c 2558f0484fSRodney W. Grimes Takes 2658f0484fSRodney W. Grimes bucketsize (bsize), and 2758f0484fSRodney W. Grimes fill factor (ffactor). 2858f0484fSRodney W. Grimes file from which to read data (fname) 2958f0484fSRodney W. Grimes Reads each key/data pair from fname and deletes the 3058f0484fSRodney W. Grimes key from the hash table hashtest 3158f0484fSRodney W. Grimes tseq.c 3258f0484fSRodney W. Grimes Reads the key/data pairs in the file hashtest and writes them 3358f0484fSRodney W. Grimes to standard out. 3458f0484fSRodney W. Grimes tread2.c 3558f0484fSRodney W. Grimes Takes 3658f0484fSRodney W. Grimes butes of cache (ncached). 3758f0484fSRodney W. Grimes Reads key/data pairs from standard in and looks them up 3858f0484fSRodney W. Grimes in the file hashtest. 3958f0484fSRodney W. Grimes tverify.c 4058f0484fSRodney W. Grimes Reads key/data pairs from standard in, looks them up 4158f0484fSRodney W. Grimes in the file hashtest, and verifies that the data is 4258f0484fSRodney W. Grimes correct. 4358f0484fSRodney W. Grimes 4458f0484fSRodney W. GrimesNOTES: 4558f0484fSRodney W. Grimes 4658f0484fSRodney W. GrimesThe man page ../man/db.3 explains the interface to the hashing system. 4758f0484fSRodney W. GrimesThe file hash.ps is a postscript copy of a paper explaining 4858f0484fSRodney W. Grimesthe history, implementation, and performance of the hash package. 4958f0484fSRodney W. Grimes 5058f0484fSRodney W. Grimes"bugs" or idiosyncracies 5158f0484fSRodney W. Grimes 5258f0484fSRodney W. GrimesIf you have a lot of overflows, it is possible to run out of overflow 5358f0484fSRodney W. Grimespages. Currently, this will cause a message to be printed on stderr. 5458f0484fSRodney W. GrimesEventually, this will be indicated by a return error code. 5558f0484fSRodney W. Grimes 5658f0484fSRodney W. GrimesIf you are using the ndbm interface and exit without flushing or closing the 5758f0484fSRodney W. Grimesfile, you may lose updates since the package buffers all writes. Also, 5858f0484fSRodney W. Grimesthe db interface only creates a single database file. To avoid overwriting 5958f0484fSRodney W. Grimesthe user's original file, the suffix ".db" is appended to the file name 6058f0484fSRodney W. Grimespassed to dbm_open. Additionally, if your code "knows" about the historic 6158f0484fSRodney W. Grimes.dir and .pag files, it will break. 6258f0484fSRodney W. Grimes 6358f0484fSRodney W. GrimesThere is a fundamental difference between this package and the old hsearch. 6458f0484fSRodney W. GrimesHsearch requires the user to maintain the keys and data in the application's 6558f0484fSRodney W. Grimesallocated memory while hash takes care of all storage management. The down 6658f0484fSRodney W. Grimesside is that the byte strings passed in the ENTRY structure must be null 6758f0484fSRodney W. Grimesterminated (both the keys and the data). 68