From: Martin Mares Date: Tue, 24 Feb 2004 18:36:23 +0000 (+0000) Subject: Blank lines are considered separators, not terminators of buckets. X-Git-Tag: holmes-import~1114 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=96ad312b2e6be5f9aaaf05056547c7350d3da06f;p=libucw.git Blank lines are considered separators, not terminators of buckets. Hence extraneous blank lines between buckets and trailing blank lines after the last buckets are all ignored. --- diff --git a/lib/buckettool.c b/lib/buckettool.c index aeec5373..886bd41b 100644 --- a/lib/buckettool.c +++ b/lib/buckettool.c @@ -118,14 +118,19 @@ insert(byte *arg) obuck_init(1); do { - b = obuck_create(type); + b = NULL; while ((e = bgets(in, buf, sizeof(buf))) && buf[0]) { *e++ = '\n'; + if (!b) + b = obuck_create(type); bwrite(b, buf, e-buf); } - obuck_create_end(b, &h); - printf("%08x %d %08x\n", h.oid, h.length, h.type); + if (b) + { + obuck_create_end(b, &h); + printf("%08x %d %08x\n", h.oid, h.length, h.type); + } } while (e); obuck_cleanup();