Like cdbmake, the cdbpatch program makes changes to a cdb by rebuilding the database and renaming the new version into place. The difference is the input format; cdbpatch reads the old version of the target cdb and a patch file, rather than a flat file in cdbmake format. The intention is to allow a set of changes to be made to a large cdb as efficiently as possible. The patch file is itself a cdb, in a special format. All values in the patch cdb must either be of zero length or start with an '=' character. The new target cdb is generated as follows. First, entries are copied from the old target cdb to the new, skipping any for which there is an entry in the patch cdb. Next, entries are copied from the patch cdb to the new target cdb. Entries with zero length values are skipped, and the leading '=' is removed from all values copied. In effect, entries with zero length values in the patch cdb are instructions to delete entries, while entries with nonempty values are instructions to add or replace entries. For example, if the old target cdb contains: +5,4:hello->wooo +3,3:foo->foo +3,1:foo->x +3,3:bar->bar +2,2:oh->ho +2,2:hi->ho and we wish to change it to: +3,3:foo->foo +3,0:bar-> +4,1:woot:x +2,2:oh->ho +2,2:hi->ho then we would run this through cdbmake to build a patch cdb: +3,4:foo->=foo +3,1:bar->= +5,0:hello-> +4,2:woot->=x The cdbpatch program expects to read the old target cdb from fd 0 and the patch cdb from fd 6. Both must be seekable. For example: cdbpatch