X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/e03be5f4f70614fea2479741cb54cd411be963f8..78b1464e4a78dc364ecc8aebcfd5ec13b3f6bb07:/lbuf.c?ds=sidebyside diff --git a/lbuf.c b/lbuf.c index 9c0ec22..8b93076 100644 --- a/lbuf.c +++ b/lbuf.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: lbuf.c,v 1.4 2000/06/17 10:38:14 mdw Exp $ + * $Id: lbuf.c,v 1.5 2001/02/03 16:23:33 mdw Exp $ * * Block-to-line buffering * @@ -30,6 +30,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: lbuf.c,v $ + * Revision 1.5 2001/02/03 16:23:33 mdw + * Bug fix: handle a disable during a close-induced flush without dumping + * core. + * * Revision 1.4 2000/06/17 10:38:14 mdw * Add support for variable buffer sizes. * @@ -87,6 +91,11 @@ void lbuf_flush(lbuf *b, char *p, size_t len) char *base; /* Base address of current line */ int cr; /* Carriage return state */ + if (b->f & LBUF_CLOSE) { + b->func(0, b->p); + return; + } + /* --- Initialize variables as necessary --- */ if (!p) { @@ -192,6 +201,7 @@ void lbuf_close(lbuf *b) x_free(b->a, b->buf); b->buf = 0; } + b->f |= LBUF_CLOSE; if (b->f & LBUF_ENABLE) b->func(0, b->p); }