1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-21 03:17:08 +03:00
Rusty Russell 16cc345d4f TDB2: Goodbye TDB2, Hello NTDB.
This renames everything from tdb2 to ntdb: importantly, we no longer
use the tdb_ namespace, so you can link against both ntdb and tdb if
you want to.

This also enables building of standalone ntdb by the autobuild script.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19 05:38:06 +02:00

30 lines
641 B
C

#include "ntdb.h"
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <ccan/err/err.h>
int main(int argc, char *argv[])
{
unsigned int i, num_recs;
struct ntdb_context *ntdb;
if (argc != 3 || (num_recs = atoi(argv[2])) == 0)
errx(1, "Usage: mktdb <tdbfile> <numrecords>");
ntdb = ntdb_open(argv[1], NTDB_DEFAULT, O_CREAT|O_TRUNC|O_RDWR, 0600,NULL);
if (!ntdb)
err(1, "Opening %s", argv[1]);
for (i = 0; i < num_recs; i++) {
NTDB_DATA d;
d.dptr = (void *)&i;
d.dsize = sizeof(i);
if (ntdb_store(ntdb, d, d, NTDB_INSERT) != 0)
err(1, "Failed to store record %i", i);
}
printf("Done\n");
return 0;
}