]> mj.ucw.cz Git - libucw.git/blobdiff - lib/buckettool.c
Added tests for the hash table module.
[libucw.git] / lib / buckettool.c
index a5ac300861bad5d42adfb3f95d3928336c7a63b9..6458c539a1268ad342cdbcabc76b6967f3738ca2 100644 (file)
@@ -120,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);
@@ -159,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);
@@ -239,7 +236,7 @@ cat(void)
 
   obuck_init(0);
   out = bfdopen_shared(1, 65536);
-  while (b = obuck_slurp_pool(&h))
+  while (b = obuck_slurp_pool(&h, OBUCK_OID_ANY))
     {
       bprintf(out, "### %08x %6d %08x\n", h.oid, h.length, h.type);
       if (h.type < BUCKET_TYPE_V33 || !buck_buf)