Subject: Re: db(1) show size of key and/or value (with patch)
To: Jeremy C. Reed <reed@reedmedia.net>
From: Luke Mewburn <lukem@NetBSD.org>
List: tech-userlevel
Date: 08/31/2007 16:16:21
--/d7X7C0hV/blnKmH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Aug 30, 2007 at 06:01:38AM -0500, Jeremy C. Reed wrote:
| Any thoughts on this db(1) -s addition:
|=20
| $ db -S b -T w -s hash /var/db/services.db | head -5
| 37 (3) gopher\04070/tcp\040nicname\040 (23)
| \M-~pop3s (7) 197 (4)
| 286 (4) afs3-resserver\0407010/udp\040icq\040 (29)
| \M^?87/tcp (8) 43 (3)
| 38 (3) gopher\04070/udp\040nicname\040 (23)
I'm curious; what did you need this for that a post-processor
program (hi awk(1) :) couldn't do?
| Another example:
|=20
| $ db -s btree /var/db/pkg/pkgdb.byfile.db | head -3
| /usr/pkg//bin/ccmakedep (24) xorg-imake-6.9.0nb1 (20)
| /usr/pkg//bin/cleanlinks (25) xorg-imake-6.9.0nb1 (20)
| /usr/pkg//bin/gccmakedep (25) xorg-imake-6.9.0nb1 (20)
|=20
| Is it okay that the size is one larger? For example:
|=20
| $ db -w hash abc.db key value =20
| Added key `key'
| $ db -s hash abc.db
| key (4) value (6)
The size is including the trailing NUL.
Does it return the correct length when using -N ?
| Would you prefer different output format?
If we implemented this, I'd remove the surrounding parenthesis
to make the number easy to parse.
cheers,
Luke.
--/d7X7C0hV/blnKmH
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)
iD8DBQFG17I1pBhtmn8zJHIRAmxXAJ9VoLlQlm5/5n2NaxycarX3uRj0hgCgqQSK
YQl1fUmsYtQqCNLPKvEgq4M=
=SoWb
-----END PGP SIGNATURE-----
--/d7X7C0hV/blnKmH--