6 Bpass(Biobuf *bin, Biobuf *bout, int n)
15 m = Bread(bin, buf, m);
17 fprint(2, "corrupt archive\n");
27 main(int argc, char **argv)
35 fprint(2, "usage: cat mkfs-archive | touchfs date (in seconds)\n");
39 d = strtoul(argv[1], 0, 0);
42 Binit(&bin, 0, OREAD);
43 Binit(&bout, 1, OWRITE);
45 while(p = Brdline(&bin, '\n')) {
46 p[Blinelen(&bin)-1] = '\0';
47 if(strcmp(p, "end of archive") == 0) {
48 Bprint(&bout, "end of archive\n");
52 nf = tokenize(p, f, nelem(f));
54 fprint(2, "corrupt archive\n");
58 Bprint(&bout, "%q %q %q %q %lud %q\n",
59 f[0], f[1], f[2], f[3], d, f[5]);
61 size = strtoul(f[5], 0, 0);
62 Bpass(&bin, &bout, size);
64 fprint(2, "premature end of archive\n");