17 fprint(2, "usage: readlist [-h host] list\n");
18 threadexitsall("usage");
22 parsescore(uchar *score, char *buf, int n)
26 memset(score, 0, VtScoreSize);
28 if(n != VtScoreSize*2){
29 werrstr("score wrong length %d", n);
32 for(i=0; i<VtScoreSize*2; i++) {
33 if(buf[i] >= '0' && buf[i] <= '9')
35 else if(buf[i] >= 'a' && buf[i] <= 'f')
36 c = buf[i] - 'a' + 10;
37 else if(buf[i] >= 'A' && buf[i] <= 'F')
38 c = buf[i] - 'A' + 10;
41 werrstr("bad score char %d '%c'", c, c);
54 threadmain(int argc, char *argv[])
60 host = EARGF(usage());
67 fmtinstall('V', vtscorefmt);
68 buf = vtmallocz(VtMaxLumpSize);
71 sysfatal("could not connect to server: %r");
73 sysfatal("vtconnect: %r");
79 for(i=0; i<argc; i++){
80 if((fd = open(argv[i], OREAD)) < 0)
81 sysfatal("open %s: %r", argv[i]);
97 while((p = Brdline(b, '\n')) != nil){
99 nf = tokenize(p, f, nelem(f));
101 sysfatal("syntax error in work list");
102 if(parsescore(score, f[0], strlen(f[0])) < 0)
103 sysfatal("bad score %s in work list", f[0]);
105 n = vtread(z, score, type, buf, VtMaxLumpSize);
107 sysfatal("could not read %s %s: %r", f[0], f[1]);
108 /* write(1, buf, n); */