OSSP CVS Repository

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

ossp-pkg/fsl/fsl.c 1.8 -> 1.9

--- fsl.c        2002/07/17 09:57:44     1.8
+++ fsl.c        2002/07/17 14:28:00     1.9
@@ -181,18 +181,18 @@
     fprintf(stderr, "DEBUG: diving\n");
     while (cfgnode != NULL) {
         if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_TOKEN, &cp)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(T) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_TYPE, &cfgtyp)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(t) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_CHILDS, &cfgchilds)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(c) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         fprintf(stderr, "DEBUG: cfgnode=0x%.8lx[%d], *cp=\"%s\", type=%d\n", (unsigned long)cfgnode, cfgchilds, cp, cfgtyp);
         if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_CHILD1, &cfgchld)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(C) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgchld != NULL)
             traverse(cfg, cfgchld);
         if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_RBROTH, &cfgnode)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(R) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     }
     fprintf(stderr, "DEBUG: climbing\n");
     CU(0);
@@ -279,6 +279,10 @@
 #define OVECSIZE 30 //FIXME find a good place for this
     int ovec[OVECSIZE];
     const char   **acpMatch;
+    l2_env_t     *l2_env;
+    l2_channel_t *l2_nch; /* noop channel */
+    l2_channel_t *ch; /* scratch variable */
+    l2_result_t   l2rv;
 
     cfg = NULL;
     buf.base = NULL;
@@ -286,12 +290,32 @@
     buf.size = 0;
     cpIdent = NULL;
     cpISF = NULL;
+    l2_env = NULL;
+    l2_nch = NULL;
 
 fprintf(stderr, "DEBUG: BEGIN ident=\"%s\", logopt=0x%.8lx, facility=0x%.8lx\n", ident, (unsigned long)logopt, (unsigned long)facility);
 
+    /* create L2 environment */
+    if ((l2rv = l2_env_create(&l2_env)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: failed to create L2 environment (%d)\n", l2rv); CU(1); }
+    if ((l2rv = l2_env_levels(l2_env, L2_LEVEL_ALL, L2_LEVEL_NONE)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to set global logging level defaults %s(%d)\n", cp, l2rv); CU(1); }
+    if ((l2rv = l2_env_formatter(l2_env, 'D', l2_util_fmt_dump, NULL)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to register dump formatter %s(%d)\n", cp, l2rv); CU(1); }
+    if ((l2rv = l2_env_formatter(l2_env, 'S', l2_util_fmt_string, NULL)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to register string formatter %s(%d)\n", cp, l2rv); CU(1); }
+    if ((l2rv = l2_env_formatter(l2_env, 'm', l2_util_fmt_errno, NULL)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to register errno formatter %s(%d)\n", cp, l2rv); CU(1); }
+    if ((l2rv = l2_env_settimer(l2_env, 20)) != L2_OK) { //FIXME do we need this?
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: failed to configure timer %s(%d)\n", cp, l2rv); CU(1); }
+
+    /* create L2 noop channel */
+    if ((l2rv = l2_channel_create(&l2_nch, l2_env, "noop")) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to create noop channel; %s(%d)\n", cp, l2rv); CU(1); }
+
     /* create IdentSlashFacility */
     if ((cpIdent = strdup((ident != NULL) ? ident : "unknown")) == NULL) {
-        fprintf(stderr, "ERROR: strdup() failed\n"); CU(1); }
+        fprintf(stderr, "Error: strdup() failed\n"); CU(1); }
     cpFacility = "unknown";
     for (i = 0; facility2string[i].string != NULL; i++) {
         if (facility == facility2string[i].facility) {
@@ -300,7 +324,7 @@
         }
     }
     if ((cpISF = (char *)malloc(strlen(cpIdent) + 1 + strlen(cpFacility) + 1)) == NULL) {
-        fprintf(stderr, "ERROR: malloc() failed\n"); CU(1); }
+        fprintf(stderr, "Error: malloc() failed\n"); CU(1); }
     cpISF[0] = '\0';
     strcat(cpISF, cpIdent);
     strcat(cpISF, "/");
@@ -308,88 +332,87 @@
 fprintf(stderr, "DEBUG: ISF=\"%s\"\n", cpISF);
 
     if ((cfgrv = cfg_create(&cfg)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_create() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_create() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
 
-    if ((rv = readfileorallfiles(&buf, "config.log")) != FSL_OK)
-        fprintf(stderr, "DEBUG: error#%d, system#%s(%d)\n", rv, strerror(errno), errno);
+    if ((rv = readfileorallfiles(&buf, "config.log")) != FSL_OK) {
+        fprintf(stderr, "DEBUG: error %d, system %s(%d)\n", rv, strerror(errno), errno); CU(1); }
 
     if ((cfgrv = cfg_import(cfg, NULL, CFG_FMT_CFG, buf.base, buf.size)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_import() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_import() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
 
     /*  find root and check if it is a sequence and has one or more directives below it */
     if ((cfgrv = cfg_node_root(cfg, &cfgseq)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_root() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_root() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     //FIXME traverse(cfg, cfgseq); /* DEBUG */
     if ((cfgrv = cfg_node_get(cfg, cfgseq, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     if (cfgtype != CFG_NODE_TYPE_SEQ) {
-        fprintf(stderr, "ERROR: expected sequence\n"); CU(1); }
+        fprintf(stderr, "Error: expected sequence\n"); CU(1); }
     if ((cfgrv = cfg_node_get(cfg, cfgseq, CFG_NODE_ATTR_CHILDS, &cfgnumc)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     if (cfgnumc < 1) {
-        fprintf(stderr, "ERROR: sequence is missing directives, expected 1, got %d\n", cfgnumc); CU(1); }
+        fprintf(stderr, "Error: sequence is missing directives, expected 1, got %d\n", cfgnumc); CU(1); }
 
     /*  get first directive below sequence */
     if ((cfgrv = cfg_node_get(cfg, cfgseq, CFG_NODE_ATTR_CHILD1, &cfgdir)) != CFG_OK) {
-        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+        (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     while (cfgdir != NULL) {
         //FIXME fprintf(stderr, "DEBUG: cfgdir=0x%.8lx\n", (unsigned long)cfgdir);
 
         /*  check if operating on a directive which has exactly three arguments */
         if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgtype != CFG_NODE_TYPE_DIR) {
-            fprintf(stderr, "ERROR: expected directive\n"); CU(1); }
+            fprintf(stderr, "Error: expected directive\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_CHILDS, &cfgnumc)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgnumc != 3) {
-            fprintf(stderr, "ERROR: directive missing arguments, expected 3, got %d\n", cfgnumc); CU(1); }
+            fprintf(stderr, "Error: directive missing arguments, expected 3, got %d\n", cfgnumc); CU(1); }
 
         /*  process first child of directive, check if it is an argument and has a valid token attached */
         if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_CHILD1, &cfgarg)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgarg == NULL) {
-            fprintf(stderr, "ERROR: argument \"argident\" is NULL\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argident\" is NULL\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgtype != CFG_NODE_TYPE_ARG) {
-            fprintf(stderr, "ERROR: expected argument\n"); CU(1); }
+            fprintf(stderr, "Error: expected argument\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TOKEN, &argident)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (argident == NULL) {
-            fprintf(stderr, "ERROR: argument \"argident\" has NULL data\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argident\" has NULL data\n"); CU(1); }
 
         /*  process right brother of argument, check if it is an argument and has a valid token attached */
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_RBROTH, &cfgarg)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgarg == NULL) {
-            fprintf(stderr, "ERROR: argument \"argmatch\" is NULL\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argmatch\" is NULL\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgtype != CFG_NODE_TYPE_ARG) {
-            fprintf(stderr, "ERROR: expected argument\n"); CU(1); }
+            fprintf(stderr, "Error: expected argument\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TOKEN, &argmatch)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (argmatch == NULL) {
-            fprintf(stderr, "ERROR: argument \"argmatch\" has NULL data\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argmatch\" has NULL data\n"); CU(1); }
 
         /*  process right brother of argument, check if it is an argument and has a valid token attached */
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_RBROTH, &cfgarg)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgarg == NULL) {
-            fprintf(stderr, "ERROR: argument \"argl2spec\" is NULL\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argl2spec\" is NULL\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (cfgtype != CFG_NODE_TYPE_ARG) {
-            fprintf(stderr, "ERROR: expected argument\n"); CU(1); }
+            fprintf(stderr, "Error: expected argument\n"); CU(1); }
         if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TOKEN, &argl2spec)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
         if (argl2spec == NULL) {
-            fprintf(stderr, "ERROR: argument \"argl2spec\" has NULL data\n"); CU(1); }
+            fprintf(stderr, "Error: argument \"argl2spec\" has NULL data\n"); CU(1); }
 
         /*  process the directive using the three arguments found */
         fprintf(stderr, "DEBUG: argident=%s, argmatch=%s, argl2spec=%s\n", argident, argmatch, argl2spec);
-
         {
             pcre       *pcreRegex;
             pcre_extra *pcreExtra;
@@ -399,10 +422,10 @@
 
             /* compile regular expression into finite state machine and optimize */
             if ((pcreRegex = pcre_compile(argmatch, PCRE_CASELESS, &cpError, &iError, NULL)) == NULL) {
-                fprintf(stderr, "ERROR: pcre_compile() failed with error %s (%d)\n", cpError, iError); CU(1); }
+                fprintf(stderr, "Error: pcre_compile() failed with error %s (%d)\n", cpError, iError); CU(1); }
             pcreExtra = pcre_study(pcreRegex, 0, &cpError);
             if (cpError != NULL) {
-                fprintf(stderr, "ERROR: pcre_study() failed with error %s\n", cpError); CU(1); }
+                fprintf(stderr, "Error: pcre_study() failed with error %s\n", cpError); CU(1); }
 
             nMatch = pcre_exec(pcreRegex, pcreExtra, cpISF, strlen(cpISF), 0, 0, ovec, OVECSIZE);
             fprintf(stderr, "DEBUG: nMatch=%d when \"%s\" is used against \"%s\"\n", nMatch, argmatch, cpISF);
@@ -413,18 +436,29 @@
                         fprintf(stderr, "DEBUG: regex reference[%d]=\'%s\'\n", i, acpMatch[i] == NULL ? "(UNDEFINED)" : acpMatch[i]);
                 n = substcapture(argl2spec, strlen(argl2spec), acpMatch, nMatch, NULL);
                 if ((cp = (char *)malloc(n + 1)) == NULL) {
-                    fprintf(stderr, "ERROR: malloc() failed\n"); CU(1); }
+                    fprintf(stderr, "Error: malloc() failed\n"); CU(1); }
                 if (substcapture(argl2spec, strlen(argl2spec), acpMatch, nMatch, cp) != n) {
-                    fprintf(stderr, "ERROR: substcapture() failed\n"); CU(1); }
-                fprintf(stderr, "DEBUG: cp=\"%s\"\n", cp);
-                free(cp);
+                    fprintf(stderr, "Error: substcapture() failed\n"); CU(1); }
+                argl2spec = cp;
+        fprintf(stderr, "DEBUG: argident=%s, argmatch=%s, argl2spec=%s\n", argident, argmatch, argl2spec);
+
+                /* create L2 channel throuh spec and link into root channel */
+                if ((l2rv = l2_spec(&ch, l2_env, argl2spec)) != L2_OK) {
+                    cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to create stream from spec %s(%d)\n", cp, l2rv); CU(1); }
+                if ((l2rv = l2_channel_link(l2_nch, L2_LINK_CHILD, ch, NULL)) != L2_OK) {
+                    cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to link child channel %s(%d)\n", cp, l2rv); CU(1); }
+
+                free(argl2spec);
             }
         }
 
         /*  get right brother of current directive */
         if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_RBROTH, &cfgdir)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); }
     }
+    if ((l2rv = l2_channel_open(l2_nch)) != L2_OK) {
+        cp = l2_env_strerror(l2_env, l2rv); fprintf(stderr, "Error: logging failed to open channel stream %s(%d)\n", cp, l2rv); CU(1); }
+    l2_channel_log(l2_nch, L2_LEVEL_DEBUG, "Hello, World!"); //FIXME DEBUG
 
 fprintf(stderr, "DEBUG: *END*, buf.base=0x%.8lx, buf.used=%d, buf.size=%d\n", (unsigned long)buf.base, (int)buf.used, (int)buf.size);
     CU(0);
@@ -434,10 +468,14 @@
         free(cpISF);
     if (cpIdent != NULL)
         free(cpIdent);
+    if (l2_nch != NULL)
+        l2_channel_destroy(l2_nch);
+    if (l2_env != NULL)
+        l2_env_destroy(l2_env);
 #if 0
     if (cfg != NULL)
         if ((cfgrv = cfg_destroy(cfg)) != CFG_OK) {
-            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "ERROR: cfg_destroy() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
+            (void)cfg_error(cfg, cfgrv, &cp); fprintf(stderr, "Error: cfg_destroy() failed with error %s (%d)\n", cp, cfgrv); CU(1); }
 #endif
     return;
 }

CVSTrac 2.0.1