Multiple DBM databases?

Jeffrey Jongeward jeff at ssc-vax.UUCP
Tue Sep 24 08:28:25 AEST 1985


> 
> I have an application where I'd like to set up 4 DBM type databases.
> However, from looking at the documentation, I assume I would have to
> deal with one at a time. Am I correct? Is there a way to 'talk' to
> 4 of these animals at once besides hacking dbm up?
> 
> UUCP: {ihnp4,uwvax!uwmacc}!uwmcsd1!dave
> ARPA: uwmcsd1!dave at wisc-rsch.arpa

There is no easy way because of the declaration of pagbuf and dirbuf in dbm.h 
(as character arrays), and becuase of a couple of static internal variables in 
dbm.c.  If you have the source, you can just change the declarations of pagebuf 
and dirbuf in dbm.h (to char pointers), change the static internals to external
unique variables, declare some per-database storage for pagebuf and dirbuf, then
switch from one dbm database to the other by saving and restoring the necessary 
variables w/in dbm.h + the (old) static internal variables.

I have a set of high-level routines that do just this if you want them (plus a 
diff script for dbm), however, it's really a trivial task to write your own.  



More information about the Comp.unix mailing list