10 fprint(2, "usage: mkroot [-h host] name type score blocksize prev\n");
11 threadexitsall("usage");
15 threadmain(int argc, char *argv[])
17 uchar score[VtScoreSize];
18 uchar buf[VtRootSize];
24 host = EARGF(usage());
34 fmtinstall('V', vtscorefmt);
36 strecpy(root.name, root.name+sizeof root.name, argv[0]);
37 strecpy(root.type, root.type+sizeof root.type, argv[1]);
38 if(vtparsescore(argv[2], strlen(argv[2]), nil, root.score) < 0)
39 sysfatal("bad score '%s'", argv[2]);
40 root.blocksize = atoi(argv[3]);
41 if(vtparsescore(argv[4], strlen(argv[4]), nil, root.prev) < 0)
42 sysfatal("bad score '%s'", argv[4]);
43 vtrootpack(&root, buf);
47 sysfatal("could not connect to server: %r");
50 sysfatal("vtconnect: %r");
52 if(vtwrite(z, score, VtRootType, buf, VtRootSize) < 0)
53 sysfatal("vtwrite: %r");
55 sysfatal("vtsync: %r");