X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffastbuf.c;h=00fa51bcccd902538514cbbb069598008094b06f;hb=91373ee6489fbe08db12bef2cf6df704b31e1378;hp=2d00bf05687f7252c1fa26a4847559644b6530df;hpb=aa9a3e9ddff81327d5735c41aa960051ff9a8fd5;p=libucw.git diff --git a/lib/fastbuf.c b/lib/fastbuf.c index 2d00bf05..00fa51bc 100644 --- a/lib/fastbuf.c +++ b/lib/fastbuf.c @@ -256,6 +256,28 @@ bgets(struct fastbuf *f, byte *b, uns l) 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) {