]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.c
Defined a GET_TAGGED_CHAR macro to read our internal representation
[libucw.git] / lib / fastbuf.c
index 2d00bf05687f7252c1fa26a4847559644b6530df..00fa51bcccd902538514cbbb069598008094b06f 100644 (file)
@@ -256,6 +256,28 @@ bgets(struct fastbuf *f, byte *b, uns l)
   die("%s: Line too long", f->name);
 }
 
   die("%s: Line too long", f->name);
 }
 
+byte *
+bgets0(struct fastbuf *f, byte *b, uns l)
+{
+  byte *e = b + l - 1;
+  int k;
+
+  k = bgetc(f);
+  if (k == EOF)
+    return NULL;
+  while (b < e)
+    {
+      if (!k || k == EOF)
+       {
+         *b = 0;
+         return b;
+       }
+      *b++ = k;
+      k = bgetc(f);
+    }
+  die("%s: Line too long", f->name);
+}
+
 int
 bdirect_read(struct fastbuf *f, byte **buf)
 {
 int
 bdirect_read(struct fastbuf *f, byte **buf)
 {