4 typedef struct Source Source;
15 uchar score[VtScoreSize];
26 uchar fscore[VtScoreSize];
28 void (*parse)(Source*, uchar*);
31 int vtGetUint16(uchar *p);
32 ulong vtGetUint32(uchar *p);
33 uvlong vtGetUint48(uchar *p);
35 int parseScore(uchar *score, char *buf, int n);
36 void readRoot(VtRootLump*, uchar *score, char *file);
37 void parse1(Source*, uchar*);
38 void parse2(Source*, uchar*);
39 int dumpDir(Source*, int indent);
42 main(int argc, char *argv[])
45 uchar score[VtScoreSize];
46 uchar buf[VtMaxLumpSize];
60 bout = vtMemAllocZ(sizeof(Biobuf));
61 Binit(bout, 1, OWRITE);
68 fmtinstall('V', vtScoreFmt);
69 fmtinstall('R', vtErrFmt);
73 vtFatal("could not connect to server: %s", vtGetError());
76 sysfatal("vtConnect: %r");
78 if(!parseScore(score, argv[0], strlen(argv[0])))
79 vtFatal("could not parse score: %s", vtGetError());
81 n = vtRead(z, score, type, buf, VtMaxLumpSize);
83 vtFatal("could not read block: %s", vtGetError());
96 fprint(2, "%s: -t type score\n", argv0);
101 parseScore(uchar *score, char *buf, int n)
105 memset(score, 0, VtScoreSize);
107 if(n < VtScoreSize*2)
109 for(i=0; i<VtScoreSize*2; i++) {
110 if(buf[i] >= '0' && buf[i] <= '9')
112 else if(buf[i] >= 'a' && buf[i] <= 'f')
113 c = buf[i] - 'a' + 10;
114 else if(buf[i] >= 'A' && buf[i] <= 'F')
115 c = buf[i] - 'A' + 10;