5 #include <ccan/err/err.h>
7 int main(int argc
, char *argv
[])
9 unsigned int i
, num_recs
;
10 struct ntdb_context
*ntdb
;
12 if (argc
!= 3 || (num_recs
= atoi(argv
[2])) == 0)
13 errx(1, "Usage: mktdb <tdbfile> <numrecords>");
15 ntdb
= ntdb_open(argv
[1], NTDB_DEFAULT
, O_CREAT
|O_TRUNC
|O_RDWR
, 0600,NULL
);
17 err(1, "Opening %s", argv
[1]);
19 for (i
= 0; i
< num_recs
; i
++) {
24 if (ntdb_store(ntdb
, d
, d
, NTDB_INSERT
) != 0)
25 err(1, "Failed to store record %i", i
);