chiark / gitweb /
Make the magical constants for the buffer flags uppercase.
authormdw <mdw>
Mon, 17 May 1999 20:36:50 +0000 (20:36 +0000)
committermdw <mdw>
Mon, 17 May 1999 20:36:50 +0000 (20:36 +0000)
lbuf.c
lbuf.h
selbuf.c

diff --git a/lbuf.c b/lbuf.c
index b81136f74393f17a50db766f3346457ad3c43abd..63eb4471bbd8c8023661d63c71117412a9dea258 100644 (file)
--- a/lbuf.c
+++ b/lbuf.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: lbuf.c,v 1.1 1999/05/14 21:01:14 mdw Exp $
+ * $Id: lbuf.c,v 1.2 1999/05/17 20:36:08 mdw Exp $
  *
  * Block-to-line buffering
  *
  *
  * Block-to-line buffering
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lbuf.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lbuf.c,v $
+ * Revision 1.2  1999/05/17 20:36:08  mdw
+ * Make the magical constants for the buffer flags uppercase.
+ *
  * Revision 1.1  1999/05/14 21:01:14  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
  * Revision 1.1  1999/05/14 21:01:14  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
@@ -82,7 +85,7 @@ void lbuf_flush(lbuf *b, char *p, size_t len)
     cr = 0;
     len = b->len;
   } else
     cr = 0;
     len = b->len;
   } else
-    cr = b->f & lbuf_cr;
+    cr = b->f & LBUF_CR;
 
   l = p + len;
 
 
   l = p + len;
 
@@ -132,7 +135,7 @@ void lbuf_flush(lbuf *b, char *p, size_t len)
       else
        *q = 0;
       b->func(base, b->p);
       else
        *q = 0;
       b->func(base, b->p);
-      if (!(b->f & lbuf_enable)) {
+      if (!(b->f & LBUF_ENABLE)) {
        base = q + 1;
        break;
       }
        base = q + 1;
        break;
       }
@@ -152,9 +155,9 @@ void lbuf_flush(lbuf *b, char *p, size_t len)
       memmove(b->buf, base, len);
     b->len = len;
     if (cr)
       memmove(b->buf, base, len);
     b->len = len;
     if (cr)
-      b->f |= lbuf_cr;
+      b->f |= LBUF_CR;
     else
     else
-      b->f &= ~lbuf_cr;
+      b->f &= ~LBUF_CR;
   }
 }
 
   }
 }
 
@@ -176,7 +179,7 @@ void lbuf_close(lbuf *b)
     b->buf[b->len] = 0;
     b->func(b->buf, b->p);
   }
     b->buf[b->len] = 0;
     b->func(b->buf, b->p);
   }
-  if (b->f & lbuf_enable)
+  if (b->f & LBUF_ENABLE)
     b->func(0, b->p);
 }
 
     b->func(0, b->p);
 }
 
@@ -263,7 +266,7 @@ void lbuf_init(lbuf *b,
   b->func = func;
   b->p = p;
   b->len = 0;
   b->func = func;
   b->p = p;
   b->len = 0;
-  b->f = lbuf_enable;
+  b->f = LBUF_ENABLE;
 }
 
 /*----- That's all, folks -------------------------------------------------*/
 }
 
 /*----- That's all, folks -------------------------------------------------*/
diff --git a/lbuf.h b/lbuf.h
index 7772885e16f56353515e68fa37a8865a8adf0685..9543d08241c5c020156577ea2f566e60d2161047 100644 (file)
--- a/lbuf.h
+++ b/lbuf.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: lbuf.h,v 1.1 1999/05/14 21:01:14 mdw Exp $
+ * $Id: lbuf.h,v 1.2 1999/05/17 20:36:08 mdw Exp $
  *
  * Block-to-line buffering
  *
  *
  * Block-to-line buffering
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lbuf.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lbuf.h,v $
+ * Revision 1.2  1999/05/17 20:36:08  mdw
+ * Make the magical constants for the buffer flags uppercase.
+ *
  * Revision 1.1  1999/05/14 21:01:14  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
  * Revision 1.1  1999/05/14 21:01:14  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
@@ -105,8 +108,8 @@ typedef struct lbuf {
 } lbuf;
 
 enum {
 } lbuf;
 
 enum {
-  lbuf_cr = 1,                         /* Read a carriage return */
-  lbuf_enable = 2                      /* Buffer is currently enabled */
+  LBUF_CR = 1,                         /* Read a carriage return */
+  LBUF_ENABLE = 2                      /* Buffer is currently enabled */
 };
 
 /*----- Functions provided ------------------------------------------------*/
 };
 
 /*----- Functions provided ------------------------------------------------*/
index 0f07dfc056dc99934301323bd433c59ee7050ce2..aafe711f59dbec1ad86b9078b606a3b9aa4b31fc 100644 (file)
--- a/selbuf.c
+++ b/selbuf.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: selbuf.c,v 1.1 1999/05/14 21:01:15 mdw Exp $
+ * $Id: selbuf.c,v 1.2 1999/05/17 20:36:50 mdw Exp $
  *
  * Line-buffering select handler
  *
  *
  * Line-buffering select handler
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: selbuf.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: selbuf.c,v $
+ * Revision 1.2  1999/05/17 20:36:50  mdw
+ * Make the magical constants for the buffer flags uppercase.
+ *
  * Revision 1.1  1999/05/14 21:01:15  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
  * Revision 1.1  1999/05/14 21:01:15  mdw
  * Integrated `select' handling bits from the background resolver project.
  *
@@ -64,8 +67,8 @@
 
 void selbuf_enable(selbuf *b)
 {
 
 void selbuf_enable(selbuf *b)
 {
-  if (!(b->b.f & lbuf_enable)) {
-    b->b.f |= lbuf_enable;
+  if (!(b->b.f & LBUF_ENABLE)) {
+    b->b.f |= LBUF_ENABLE;
     sel_addfile(&b->reader);
     lbuf_flush(&b->b, 0, 0);
   }
     sel_addfile(&b->reader);
     lbuf_flush(&b->b, 0, 0);
   }
@@ -83,8 +86,8 @@ void selbuf_enable(selbuf *b)
 
 void selbuf_disable(selbuf *b)
 {
 
 void selbuf_disable(selbuf *b)
 {
-  if (b->b.f & lbuf_enable) {
-    b->b.f &= ~lbuf_enable;
+  if (b->b.f & LBUF_ENABLE) {
+    b->b.f &= ~LBUF_ENABLE;
     sel_rmfile(&b->reader);
   }
 }
     sel_rmfile(&b->reader);
   }
 }
@@ -147,7 +150,7 @@ void selbuf_init(selbuf *b,
                 void *p)
 {
   lbuf_init(&b->b, func, p);
                 void *p)
 {
   lbuf_init(&b->b, func, p);
-  b->b.f &= ~lbuf_enable;
+  b->b.f &= ~LBUF_ENABLE;
   sel_initfile(s, &b->reader, fd, SEL_READ, selbuf_read, b);
   selbuf_enable(b);
 }
   sel_initfile(s, &b->reader, fd, SEL_READ, selbuf_read, b);
   selbuf_enable(b);
 }