10 fprint(2, "usage: read [-h host] [-t type] score\n");
11 threadexitsall("usage");
15 threadmain(int argc, char *argv[])
18 uchar score[VtScoreSize];
23 fmtinstall('F', vtfcallfmt);
24 fmtinstall('V', vtscorefmt);
30 host = EARGF(usage());
33 type = atoi(EARGF(usage()));
43 if(vtparsescore(argv[0], nil, score) < 0)
44 sysfatal("could not parse score '%s': %r", argv[0]);
46 buf = vtmallocz(VtMaxLumpSize);
50 sysfatal("could not connect to server: %r");
53 sysfatal("vtconnect: %r");
57 for(type=0; type<VtMaxType; type++){
58 n = vtread(z, score, type, buf, VtMaxLumpSize);
60 fprint(2, "venti/read%s%s %V %d\n", host ? " -h" : "", host ? host : "",
66 n = vtread(z, score, type, buf, VtMaxLumpSize);
70 sysfatal("could not read block: %r");
71 if(write(1, buf, n) != n)
72 sysfatal("write: %r");