}
static inline void
-dump_oattrs(struct fastbuf *out, struct oattr *a)
+dump_oattrs(struct fastbuf *out, struct oattr *oa)
{
- for (; a; a = a->same)
- bprintf(out, "%c%s\n", a->attr, a->val);
+ for (; oa; oa = oa->next)
+ for (struct oattr *a=oa; a; a = a->same)
+ bprintf(out, "%c%s\n", a->attr, a->val);
}
static void
extract(char *id)
{
struct fastbuf *b, *out;
- byte buf[1024];
- int l;
struct obuck_header h;
h.oid = parse_id(id);
obuck_init(0);
obuck_find_by_oid(&h);
out = bfdopen_shared(1, 65536);
+ if (verbose)
+ bprintf(out, "### %08x %6d %08x\n", h.oid, h.length, h.type);
b = obuck_fetch();
if (h.type < BUCKET_TYPE_V33 || !buck_buf)
- {
- while ((l = bread(b, buf, sizeof(buf))))
- bwrite(out, buf, l);
- }
+ bbcopy_slow(b, out, ~0U);
else
dump_parsed_bucket(out, &h, b);
bclose(b);
type = BUCKET_TYPE_PLAIN;
else if (sscanf(arg, "%x", &type) != 1)
die("Type `%s' is not a hexadecimal number");
- attr_set_type(type);
+ if (type < 10)
+ type += BUCKET_TYPE_PLAIN;
+ put_attr_set_type(type);
in = bfdopen_shared(0, 4096);
obuck_init(1);
bputl(b, lizard_filled
#if 0 //TEST error resilience: write wrong length
+1
+#endif
+ );
+ bputl(b, adler32(lizard_buf.ptr, lizard_filled)
+#if 0 //TEST error resilience: write wrong checksum
+ +1
#endif
);
uns want_len = lizard_filled * LIZARD_MAX_MULTIPLY + LIZARD_MAX_ADD;
}
else
dump_parsed_bucket(out, &h, b);
+ bputc(out, '\n');
}
bclose(out);
obuck_cleanup();