30 Mar 2006
Discovering hidden utilities in Solaris: makedbm and makemap

While blogging on the
dbm theme, I had always used a PERL one-liner to dump the contents of my dbm databases.
dbmopen(%D,$ARGV[0],0444);for(keys %D){print "$_ $D{$_}\n"}
Scripting languages like PERL make it really easy to write "your own", rather than try to find "some other tool" that does the work. It is perhaps faster to write your own.
However, let us see if there is anything readily available in Solaris that dumps the contents of a dbm file. If there is such a command, it might use dbm_open(3C). So we
search for it in the source browser. The
makedbm.c looks promising and see that it has a function
unmake()
which is clearly reading keys and values from a given dbm database. Even though the command name sounds like it is a tool to create dbm files, its
manpage
says it can also dump the contents of a dbm file with option -u. (while not very intuitive, think of -u as adding a negative i.e "not makedbm")
So
makedbm -u filename (without the .pag or .dir prefix) is your friend if you want to see whats in a dbm file.
makedbm is part of Solaris yp/NIS naming toolchest. It has a cousin in sendmail space too (
makemap -u dbm filename)
Link |
Trackback URL: http://blogs.sun.com/chandan/entry/discovering_hidden_utilities_in_solaris