|
0
|
1 |
#include "uint32.h"
|
|
|
2 |
#include "scan.h"
|
|
|
3 |
#include "strerr.h"
|
|
|
4 |
#include "cdb_make.h"
|
|
|
5 |
|
|
|
6 |
#define FATAL "testzero: fatal: "
|
|
|
7 |
|
|
|
8 |
void die_write(void)
|
|
|
9 |
{
|
|
|
10 |
strerr_die2sys(111,FATAL,"unable to write: ");
|
|
|
11 |
}
|
|
|
12 |
|
|
|
13 |
static char key[4];
|
|
|
14 |
static char data[65536];
|
|
|
15 |
struct cdb_make c;
|
|
|
16 |
|
|
|
17 |
main(int argc,char **argv)
|
|
|
18 |
{
|
|
|
19 |
int fd;
|
|
|
20 |
unsigned long loop;
|
|
|
21 |
|
|
|
22 |
if (!*argv) _exit(0);
|
|
|
23 |
if (!*++argv) _exit(0);
|
|
|
24 |
scan_ulong(*argv,&loop);
|
|
|
25 |
|
|
|
26 |
if (cdb_make_start(&c,1) == -1) die_write();
|
|
|
27 |
|
|
|
28 |
while (loop) {
|
|
|
29 |
uint32_pack(key,--loop);
|
|
|
30 |
if (cdb_make_add(&c,key,4,data,sizeof data) == -1) die_write();
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
if (cdb_make_finish(&c) == -1) die_write();
|
|
|
34 |
_exit(0);
|
|
|
35 |
}
|