X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fbuckettool.c;h=5b503580ec9fbbb2e54e6a4344ee26e3bc053322;hb=4d8d2943da06f65f953549e10a59a59300f90959;hp=76b8fc37c21f5586074490981ecee352eefbf23a;hpb=e828732528e0ed88973dd18f2dee97a42c0b4e59;p=libucw.git diff --git a/lib/buckettool.c b/lib/buckettool.c index 76b8fc37..5b503580 100644 --- a/lib/buckettool.c +++ b/lib/buckettool.c @@ -92,10 +92,11 @@ delete(char *id) } 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 @@ -119,20 +120,17 @@ 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); @@ -158,7 +156,7 @@ insert(byte *arg) die("Type `%s' is not a hexadecimal number"); if (type < 10) type += BUCKET_TYPE_PLAIN; - attr_set_type(type); + put_attr_set_type(type); in = bfdopen_shared(0, 4096); obuck_init(1);