OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_file.c versions 1.9 and 1.10
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_file.c 1.9 -> 1.10

--- l2_ch_file.c 2001/09/04 13:52:59     1.9
+++ l2_ch_file.c 2001/09/04 15:41:17     1.10
@@ -43,7 +43,7 @@
 } l2_ch_file_t;
 
 /* create channel */
-static int hook_create(l2_context_t *ctx)
+static int hook_create(l2_context_t *ctx, l2_channel_t *ch)
 {
     l2_ch_file_t *cfg;
 
@@ -64,7 +64,7 @@
 }
 
 /* configure channel */
-static int hook_configure(l2_context_t *ctx, const char *fmt, va_list ap)
+static int hook_configure(l2_context_t *ctx, l2_channel_t *ch, const char *fmt, va_list ap)
 {
     l2_ch_file_t *cfg;
     l2_param_t pa[4]; 
@@ -85,9 +85,10 @@
 }
 
 /* open channel */
-static int hook_open(l2_context_t *ctx, l2_channel_t *downstream)
+static int hook_open(l2_context_t *ctx, l2_channel_t *ch)
 {
     l2_ch_file_t *cfg;
+    l2_channel_t *downstream;
     int mode;
 
     /* parameter checks */
@@ -104,7 +105,7 @@
         return L2_ERROR;
 
     /* optionally open downstream channel, too */
-    if (downstream != NULL)
+    if ((downstream = l2_channel_downstream(ch)) != NULL)
         if (l2_channel_open(downstream) == L2_ERROR)
             return L2_ERROR;
 
@@ -112,10 +113,11 @@
 }
 
 /* write to channel */
-static int hook_write(l2_context_t *ctx, l2_channel_t *downstream, 
+static int hook_write(l2_context_t *ctx, l2_channel_t *ch, 
                       const char *buf, size_t buf_size)
 {
     l2_ch_file_t *cfg;
+    l2_channel_t *downstream;
 
     /* parameter checks */
     if ((cfg = (l2_ch_file_t *)ctx->vp) == NULL)
@@ -128,7 +130,7 @@
         return L2_ERROR;
 
     /* optionally write to downstream channel, too */
-    if (downstream != NULL)
+    if ((downstream = l2_channel_downstream(ch)) != NULL)
         if (l2_channel_write(downstream, buf, buf_size) == L2_ERROR)
             return L2_ERROR;
 
@@ -136,12 +138,14 @@
 }
 
 /* flush channel */
-static int hook_flush(l2_context_t *ctx, l2_channel_t *downstream)
+static int hook_flush(l2_context_t *ctx, l2_channel_t *ch)
 {
+    l2_channel_t *downstream;
+
     /* NOP for this channel, because Unix I/O files are unbuffered! */
 
     /* optionally flush downstream channel, too */
-    if (downstream != NULL)
+    if ((downstream = l2_channel_downstream(ch)) != NULL)
         if (l2_channel_flush(downstream) == L2_ERROR)
             return L2_ERROR;
 
@@ -149,12 +153,13 @@
 }
 
 /* close channel */
-static int hook_close(l2_context_t *ctx, l2_channel_t *downstream)
+static int hook_close(l2_context_t *ctx, l2_channel_t *ch)
 {
     l2_ch_file_t *cfg;
+    l2_channel_t *downstream;
 
     /* optionally close downstream channel, too */
-    if (downstream != NULL)
+    if ((downstream = l2_channel_downstream(ch)) != NULL)
         if (l2_channel_close(downstream) == L2_ERROR)
             return L2_ERROR;
 
@@ -172,7 +177,7 @@
 }
 
 /* destroy channel */
-static int hook_destroy(l2_context_t *ctx)
+static int hook_destroy(l2_context_t *ctx, l2_channel_t *ch)
 {
     /* parameter checks */
     if (ctx->vp == NULL) 
@@ -186,6 +191,7 @@
 
 /* exported channel handler structure */
 l2_handler_t l2_handler_file = {
+    L2_CHANNEL_OUTPUT,
     hook_create,
     hook_configure,
     hook_open,

CVSTrac 2.0.1