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

main(int argc, char *argv[])
{
    DBM *dbp;
    datum kdat, vdat;
    

    dbp = dbm_open(argv[1], O_RDWR+O_CREAT, 0777);
    if (dbp == NULL)
    {
	perror("dbadd: dbm_open");
	exit(1);
    }

    kdat.dsize = strlen(argv[2]);
    kdat.dptr = argv[2];

    vdat.dsize = strlen(argv[3]);
    vdat.dptr = argv[3];
    
    if (dbm_store(dbp, kdat, vdat, DBM_REPLACE) < 0)
    {
	perror("dbadd: dbm_store");
	dbm_close(dbp);
	exit(1);
    }
    
    dbm_close(dbp);
    exit(0);
}
