X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fbuckettool.c;h=5b503580ec9fbbb2e54e6a4344ee26e3bc053322;hb=4d8d2943da06f65f953549e10a59a59300f90959;hp=212508bb176a0cd056ac1909dcd844741ad60ca3;hpb=90e4a2cc675da72059b655a7c0222ee03a9dd74a;p=libucw.git diff --git a/lib/buckettool.c b/lib/buckettool.c index 212508bb..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); @@ -254,6 +252,7 @@ cat(void) } else dump_parsed_bucket(out, &h, b); + bputc(out, '\n'); } bclose(out); obuck_cleanup();