#include <stdio.h>
#include <fcntl.h>
#include <gdbm.h>

main(int argc, char *argv[])
{
    GDBM_FILE dbp;
    datum key, val;
    

    dbp = gdbm_open(argv[1], 64, O_RDONLY, 0777, NULL);
    if (dbp == NULL)
    {
	perror("dbadd: dbm_open");
	exit(1);
    }

    for (key = gdbm_firstkey(dbp); key.dptr != NULL;
	 key = gdbm_nextkey(dbp, key))
    {
	val = gdbm_fetch(dbp, key);

	printf("%.*s %.*s\n", key.dsize, key.dptr,
	       val.dsize, val.dptr);
    }
    
    gdbm_close(dbp);
    exit(0);
}
