9 // XXX What to do here?
10 VtMaxLumpSize = 65535,
23 fprint(2, "usage: readlist [-h host] list\n");
24 threadexitsall("usage");
28 parsescore(uchar *score, char *buf, int n)
32 memset(score, 0, VtScoreSize);
34 if(n != VtScoreSize*2){
35 werrstr("score wrong length %d", n);
38 for(i=0; i<VtScoreSize*2; i++) {
39 if(buf[i] >= '0' && buf[i] <= '9')
41 else if(buf[i] >= 'a' && buf[i] <= 'f')
42 c = buf[i] - 'a' + 10;
43 else if(buf[i] >= 'A' && buf[i] <= 'F')
44 c = buf[i] - 'A' + 10;
47 werrstr("bad score char %d '%c'", c, c);
60 threadmain(int argc, char *argv[])
66 host = EARGF(usage());
73 fmtinstall('V', vtscorefmt);
74 buf = vtmallocz(VtMaxLumpSize);
77 sysfatal("could not connect to server: %r");
79 sysfatal("vtconnect: %r");
85 for(i=0; i<argc; i++){
86 if((fd = open(argv[i], OREAD)) < 0)
87 sysfatal("open %s: %r", argv[i]);
103 while((p = Brdline(b, '\n')) != nil){
104 p[Blinelen(b)-1] = 0;
105 nf = tokenize(p, f, nelem(f));
107 sysfatal("syntax error in work list");
108 if(parsescore(score, f[0], strlen(f[0])) < 0)
109 sysfatal("bad score %s in work list", f[0]);
111 n = vtread(z, score, type, buf, VtMaxLumpSize);
113 sysfatal("could not read %s %s: %r", f[0], f[1]);
114 /* write(1, buf, n); */