Index: ossp-pkg/fsl/fsl.c RCS File: /v/ossp/cvs/ossp-pkg/fsl/fsl.c,v rcsdiff -q -kk '-r1.34' '-r1.35' -u '/v/ossp/cvs/ossp-pkg/fsl/fsl.c,v' 2>/dev/null --- fsl.c 2002/07/29 12:48:43 1.34 +++ fsl.c 2002/07/29 13:07:05 1.35 @@ -217,7 +217,7 @@ if (filename == NULL || buffer == NULL) CU(FSL_ERR_ARG); - fsldebug(L2_LEVEL_TRACE, "appendfiletobuffer(buffer, filename=\"%s\")\n", filename); + fsldebug(L2_LEVEL_TRACE, "appendfiletobuffer(buffer, filename=\"%s\")", filename); if ((fd = open(filename, O_RDONLY)) == -1) CU(FSL_ERR_SYS); @@ -262,7 +262,7 @@ if (ident == NULL || buffer == NULL) CU(FSL_ERR_ARG); - fsldebug(L2_LEVEL_TRACE, "readfile(buffer, ident=\"%s\")\n", ident); + fsldebug(L2_LEVEL_TRACE, "readfile(buffer, ident=\"%s\")", ident); if ((filename = (char *)malloc(strlen(FSL_CFGDIR) + 1 + strlen(FSL_PREFIX) + strlen(ident) + 1)) == NULL) @@ -291,7 +291,7 @@ if (buffer == NULL) CU(FSL_ERR_ARG); - fsldebug(L2_LEVEL_TRACE, "readallfiles(buffer) globbing \"%s/%s*\"\n", FSL_CFGDIR, FSL_PREFIX); + fsldebug(L2_LEVEL_TRACE, "readallfiles(buffer) globbing \"%s/%s*\"", FSL_CFGDIR, FSL_PREFIX); if ((dp = opendir(FSL_CFGDIR)) == NULL) CU(FSL_ERR_SYS); @@ -329,7 +329,7 @@ if (ident == NULL) return FSL_ERR_ARG; - fsldebug(L2_LEVEL_TRACE, "readfileorallfiles(buffer, ident=\"%s\")\n", ident); + fsldebug(L2_LEVEL_TRACE, "readfileorallfiles(buffer, ident=\"%s\")", ident); if ((rv = readfile(buffer, ident)) == FSL_OK) return FSL_OK; @@ -353,18 +353,18 @@ while (cfgnode != NULL) { if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_TOKEN, &cp)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed: %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed: %s (%d)", cp, cfgrv); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_TYPE, &cfgtyp)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_TYPE) failed: %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_TYPE) failed: %s (%d)", cp, cfgrv); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_CHILDS, &cfgchilds)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed: %s (%d)\n", cp, cfgrv); CU(1); } - fsldebug(L2_LEVEL_DEBUG, "traverse: cfgnode=0x%.8lx[%d], cp=\"%s\", type=%d\n", (unsigned long)cfgnode, cfgchilds, (cp != NULL ? cp : ""), cfgtyp); + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed: %s (%d)", cp, cfgrv); CU(1); } + fsldebug(L2_LEVEL_DEBUG, "traverse: cfgnode=0x%.8lx[%d], cp=\"%s\", type=%d", (unsigned long)cfgnode, cfgchilds, (cp != NULL ? cp : ""), cfgtyp); if ((cfgrv = cfg_node_get(cfg, cfgnode, CFG_NODE_ATTR_CHILD1, &cfgchld)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed: %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed: %s (%d)", 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); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed: %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "traverse: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed: %s (%d)", cp, cfgrv); CU(1); } } CU(0); CUS: @@ -472,23 +472,23 @@ argl2spec = FSL_DEBUG; if (strlen(argl2spec) > 0) { if ((l2rv = l2_env_create(&ctx.l2_fslenv)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: failed to create L2 environment (%d) for fsl\n", l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: failed to create L2 environment (%d) for fsl", l2rv); CU(1); } if ((l2rv = l2_env_levels(ctx.l2_fslenv, L2_LEVEL_ALL, L2_LEVEL_NONE)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to set global logging level defaults %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to set global logging level defaults %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_fslenv, 'D', l2_util_fmt_dump, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register dump formatter %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register dump formatter %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_fslenv, 'S', l2_util_fmt_string, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register string formatter %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register string formatter %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_fslenv, 'm', l2_util_fmt_errno, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register errno formatter %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register errno formatter %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_channel_create(&ctx.l2_fslnch, ctx.l2_fslenv, "noop")) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create noop channel; %s(%d)\n for fsl", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create noop channel; %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_spec(&ch, ctx.l2_fslenv, "%s", argl2spec)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create stream from spec %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create stream from spec %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_channel_link(ctx.l2_fslnch, L2_LINK_CHILD, ch, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to link child channel %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to link child channel %s(%d) for fsl", cp, l2rv); CU(1); } if ((l2rv = l2_channel_open(ctx.l2_fslnch)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to open channel stream %s(%d) for fsl\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_fslenv, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to open channel stream %s(%d) for fsl", cp, l2rv); CU(1); } } /* tracing */ @@ -507,35 +507,35 @@ fsldebug(L2_LEVEL_WARNING, "openlog: ignore unsupported LOG_PID (use OSSP l2 formatter %%P in prefix channel to emulate)"); /* create default sysloglevel to l2_level mapping */ - fsldebug(L2_LEVEL_DEBUG, "openlog: create default syslog(3) to OSSP l2 level/priority mapping table\n"); + fsldebug(L2_LEVEL_DEBUG, "openlog: create default syslog(3) to OSSP l2 level/priority mapping table"); for (i = 0; sysloglevel2string[i].string != NULL; i++) ; if ((ctx.levelmap = (levelmap_t *)malloc(i * sizeof(levelmap_t))) == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed"); CU(1); } for (i = 0; sysloglevel2string[i].string != NULL; i++) { ctx.levelmap[i].syslog = sysloglevel2string[i].level; ctx.levelmap[i].l2 = sysloglevel2string[i].deflevelmap; - fsldebug(L2_LEVEL_DEBUG, "openlog: ctx.levelmap[%d].syslog = 0x%.8lx, ctx.levelmap[%d].l2 = 0x%.8lx\n", + fsldebug(L2_LEVEL_DEBUG, "openlog: ctx.levelmap[%d].syslog = 0x%.8lx, ctx.levelmap[%d].l2 = 0x%.8lx", i, (unsigned long)ctx.levelmap[i].syslog, i, (unsigned long)ctx.levelmap[i].l2); } /* create OSSP l2 environment for main application */ if ((l2rv = l2_env_create(&ctx.l2_env)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: failed to create OSSP l2 environment: (%d)\n", l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: failed to create OSSP l2 environment: (%d)", l2rv); CU(1); } if ((l2rv = l2_env_levels(ctx.l2_env, L2_LEVEL_ALL, L2_LEVEL_NONE)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to set global logging level defaults: %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to set global logging level defaults: %s(%d)", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_env, 'D', l2_util_fmt_dump, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register dump formatter: %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register dump formatter: %s(%d)", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_env, 'S', l2_util_fmt_string, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register string formatter: %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register string formatter: %s(%d)", cp, l2rv); CU(1); } if ((l2rv = l2_env_formatter(ctx.l2_env, 'm', l2_util_fmt_errno, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register errno formatter: %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to register errno formatter: %s(%d)", cp, l2rv); CU(1); } if ((l2rv = l2_channel_create(&ctx.l2_nch, ctx.l2_env, "noop")) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create noop channel: %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create noop channel: %s(%d)", cp, l2rv); CU(1); } /* create IdentSlashFacility */ if ((cpIdent = strdup((ident != NULL) ? ident : "unknown")) == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: strdup() failed\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: strdup() failed"); CU(1); } cpFacility = "unknown"; for (i = 0; syslogfacility2string[i].string != NULL; i++) { if (facility == syslogfacility2string[i].facility) { @@ -544,7 +544,7 @@ } } if ((cpISF = (char *)malloc(strlen(cpIdent) + 1 + strlen(cpFacility) + 1)) == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed"); CU(1); } cpISF[0] = '\0'; strcat(cpISF, cpIdent); strcat(cpISF, "/"); @@ -552,52 +552,52 @@ /* read in configuration file(s) */ if ((rv = readfileorallfiles(&buf, ident)) != FSL_OK) { - fsldebug(L2_LEVEL_ERROR, "openlog: readfileorallfiles(buf, \"%s\") returned %d, system error: %s(%d)\n", ident, rv, strerror(errno), errno); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: readfileorallfiles(buf, \"%s\") returned %d, system error: %s(%d)", ident, rv, strerror(errno), errno); CU(1); } /* import configuration buffer into OSSP cfg node tree */ if ((cfgrv = cfg_create(&cfg)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_create() failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_create() failed with error %s (%d)", cp, cfgrv); CU(1); } if ((cfgrv = cfg_import(cfg, NULL, CFG_FMT_CFG, buf.base, buf.size)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_import() failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_import() failed with error %s (%d)", cp, cfgrv); CU(1); } /* find configuration root node 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); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_root() failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_root() failed with error %s (%d)", cp, cfgrv); CU(1); } traverse(cfg, cfgseq); if ((cfgrv = cfg_node_get(cfg, cfgseq, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgtype != CFG_NODE_TYPE_SEQ) { - fsldebug(L2_LEVEL_ERROR, "openlog: expected sequence\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: expected sequence"); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgseq, CFG_NODE_ATTR_CHILDS, &cfgnumc)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgnumc < 1) { - fsldebug(L2_LEVEL_ERROR, "openlog: sequence is missing directives, expected 1, got %d\n", cfgnumc); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: sequence is missing directives, expected 1, got %d", 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); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)", cp, cfgrv); CU(1); } while (cfgdir != NULL) { /* check if operating on a directive */ if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgtype != CFG_NODE_TYPE_DIR) { - fsldebug(L2_LEVEL_ERROR, "openlog: expected directive\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: expected directive"); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgdir, CFG_NODE_ATTR_CHILDS, &cfgnumc)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILDS) failed with error %s (%d)", cp, cfgrv); 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); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_CHILD1) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgarg == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: first argument is NULL\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: first argument is NULL"); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgtype != CFG_NODE_TYPE_ARG) { - fsldebug(L2_LEVEL_ERROR, "openlog: expected first argument, got %d\n", cfgtype); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: expected first argument, got %d", cfgtype); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TOKEN, &cfgargtok)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgargtok == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: first argument has NULL data\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: first argument has NULL data"); CU(1); } cfgargtoka[0] = cfgargtok; cfgnume = 0; @@ -608,24 +608,24 @@ if (strcmp(cfgargtoka[0], "map") == 0) cfgnume = 3; if (cfgnume == 0) { - fsldebug(L2_LEVEL_ERROR, "openlog: syntax error, invalid argument \"%s\"\n", cfgargtoka[0]); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: syntax error, invalid argument \"%s\"", cfgargtoka[0]); CU(1); } if (cfgnume != cfgnumc) { - fsldebug(L2_LEVEL_ERROR, "openlog: directive missing arguments, expected %d, got %d\n", cfgnume, cfgnumc); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: directive missing arguments, expected %d, got %d", cfgnume, cfgnumc); CU(1); } for (i = 1; i < cfgnume; i++) { /* 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); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgarg == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: argument %d is NULL\n", i); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: argument %d is NULL", i); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TYPE, &cfgtype)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TYPE) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgtype != CFG_NODE_TYPE_ARG) { - fsldebug(L2_LEVEL_ERROR, "openlog: expected argument %d\n", i); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: expected argument %d", i); CU(1); } if ((cfgrv = cfg_node_get(cfg, cfgarg, CFG_NODE_ATTR_TOKEN, &cfgargtok)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_node_get(CFG_NODE_ATTR_TOKEN) failed with error %s (%d)", cp, cfgrv); CU(1); } if (cfgargtok == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: argument %d has NULL data\n", i); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: argument %d has NULL data", i); CU(1); } cfgargtoka[i] = cfgargtok; } @@ -635,7 +635,7 @@ argl2spec = cfgargtoka[2]; /* process the directive using the three arguments found */ - fsldebug(L2_LEVEL_DEBUG, "openlog: argident=%s, argmatch=%s, argl2spec=%s\n", argident, argmatch, argl2spec); + fsldebug(L2_LEVEL_DEBUG, "openlog: argident=%s, argmatch=%s, argl2spec=%s", argident, argmatch, argl2spec); { pcre *pcreRegex; pcre_extra *pcreExtra; @@ -645,37 +645,37 @@ /* compile regular expression into finite state machine and optimize */ if ((pcreRegex = pcre_compile(argmatch, PCRE_CASELESS, &cpError, &iError, NULL)) == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: pcre_compile() failed with error %s (%d)\n", cpError, iError); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: pcre_compile() failed with error %s (%d)", cpError, iError); CU(1); } pcreExtra = pcre_study(pcreRegex, 0, &cpError); if (cpError != NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: pcre_study() failed with error %s\n", cpError); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: pcre_study() failed with error %s", cpError); CU(1); } nMatch = pcre_exec(pcreRegex, pcreExtra, cpISF, strlen(cpISF), 0, 0, ovec, OVECSIZE); if (nMatch < 0) - fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" failed.\n", cpISF, argmatch); + fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" failed.", cpISF, argmatch); else if (nMatch == 0) - fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" succeeded, found $0\n", cpISF, argmatch); + fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" succeeded, found $0", cpISF, argmatch); else - fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" succeeded, found $0...$%d\n", cpISF, argmatch, (nMatch-1) > 9 ? 9 : (nMatch-1)); + fsldebug(L2_LEVEL_TRACE, "openlog: matching ident/facility \"%s\" against section \"%s\" succeeded, found $0...$%d", cpISF, argmatch, (nMatch-1) > 9 ? 9 : (nMatch-1)); if (nMatch >= 1) { pcre_get_substring_list(cpISF, ovec, nMatch, &acpMatch); if (acpMatch != NULL) for (i = 0; i < nMatch; i++) - fsldebug(L2_LEVEL_DEBUG, "openlog: regex reference[%d]=\'%s\'\n", i, acpMatch[i] == NULL ? "(UNDEFINED)" : acpMatch[i]); + fsldebug(L2_LEVEL_DEBUG, "openlog: regex reference[%d]=\'%s\'", i, acpMatch[i] == NULL ? "(UNDEFINED)" : acpMatch[i]); n = substcapture(argl2spec, strlen(argl2spec), acpMatch, nMatch, NULL); if ((cp = (char *)malloc(n + 1)) == NULL) { - fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: malloc() failed"); CU(1); } if (substcapture(argl2spec, strlen(argl2spec), acpMatch, nMatch, cp) != n) { - fsldebug(L2_LEVEL_ERROR, "openlog: substcapture() failed\n"); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: substcapture() failed"); CU(1); } argl2spec = cp; - fsldebug(L2_LEVEL_DEBUG, "openlog: argident=%s, argmatch=%s, argl2spec=%s\n", argident, argmatch, argl2spec); + fsldebug(L2_LEVEL_DEBUG, "openlog: argident=%s, argmatch=%s, argl2spec=%s", argident, argmatch, argl2spec); /* create L2 channel throuh spec and link into root channel */ if ((l2rv = l2_spec(&ch, ctx.l2_env, "%s", argl2spec)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create stream from spec %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to create stream from spec %s(%d)", cp, l2rv); CU(1); } if ((l2rv = l2_channel_link(ctx.l2_nch, L2_LINK_CHILD, ch, NULL)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to link child channel %s(%d)\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to link child channel %s(%d)", cp, l2rv); CU(1); } free(argl2spec); } @@ -691,24 +691,24 @@ mapfrom = i; } if (mapfrom == -1) { - fsldebug(L2_LEVEL_ERROR, "openlog: trying to map from unknown syslog level \"%s\"\n", cfgargtoka[1]); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: trying to map from unknown syslog level \"%s\"", cfgargtoka[1]); CU(1); } for (i = 0, mapto = -1; (mapto == -1) && (l2level2string[i].string != NULL); i++) { if (strcmp(l2level2string[i].string, cfgargtoka[2]) == 0) mapto = i; } if (mapto == -1) { - fsldebug(L2_LEVEL_ERROR, "openlog: trying to map to unknown l2 level \"%s\"\n", cfgargtoka[2]); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: trying to map to unknown l2 level \"%s\"", cfgargtoka[2]); CU(1); } ctx.levelmap[mapfrom].l2 = l2level2string[mapto].level; - fsldebug(L2_LEVEL_DEBUG, "openlog: map levelmap[%10s/%d].l2 = l2level2string[%10s/%d].level = 0x%.8lx\n", cfgargtoka[1], mapfrom, cfgargtoka[2], mapto, (unsigned long)l2level2string[mapto].level); + fsldebug(L2_LEVEL_DEBUG, "openlog: map levelmap[%10s/%d].l2 = l2level2string[%10s/%d].level = 0x%.8lx", cfgargtoka[1], mapfrom, cfgargtoka[2], mapto, (unsigned long)l2level2string[mapto].level); } else { - fsldebug(L2_LEVEL_ERROR, "openlog: internal, argument \"%s\" not implemented\n", cfgargtoka[0]); CU(1); } + fsldebug(L2_LEVEL_ERROR, "openlog: internal, argument \"%s\" not implemented", cfgargtoka[0]); CU(1); } /* 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); fsldebug(L2_LEVEL_ERROR, "cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "cfg_node_get(CFG_NODE_ATTR_RBROTH) failed with error %s (%d)", cp, cfgrv); CU(1); } } if (logopt & LOG_NDELAY) { @@ -717,7 +717,7 @@ } else { if ((l2rv = l2_channel_open(ctx.l2_nch)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to open channel stream %s(%d) immediately\n", cp, l2rv); CU(1); } + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "openlog: logging failed to open channel stream %s(%d) immediately", cp, l2rv); CU(1); } fsldebug(L2_LEVEL_TRACE, "openlog: logging succeeded to open channel stream immediately"); } @@ -730,7 +730,7 @@ #if 0 /* FIXME */ if (cfg != NULL) if ((cfgrv = cfg_destroy(cfg)) != CFG_OK) { - (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_destroy() failed with error %s (%d)\n", cp, cfgrv); CU(1); } + (void)cfg_error(cfg, cfgrv, &cp); fsldebug(L2_LEVEL_ERROR, "openlog: cfg_destroy() failed with error %s (%d)", cp, cfgrv); CU(1); } #endif if (buf.base != NULL) free(buf.base); @@ -819,7 +819,7 @@ /* check for delayed open */ if ((ctx.logopt & LOG_NDELAY) && (ctx.delayopen == TRUE)) { if ((l2rv = l2_channel_open(ctx.l2_nch)) != L2_OK) { - cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "vsyslog: logging failed to open channel stream %s(%d) delayed\n", cp, l2rv); + cp = l2_env_strerror(ctx.l2_env, l2rv); fsldebug(L2_LEVEL_ERROR, "vsyslog: logging failed to open channel stream %s(%d) delayed", cp, l2rv); closelog(); } fsldebug(L2_LEVEL_TRACE, "vsyslog: logging succeeded to open channel stream delayed"); @@ -832,22 +832,22 @@ /* check against maskpri */ if ((LOG_MASK(priority) & ctx.maskpri) == 0) { - fsldebug(L2_LEVEL_DEBUG, "vsyslog: short circuit maskpri\n"); + fsldebug(L2_LEVEL_DEBUG, "vsyslog: short circuit maskpri"); return; } levelmask = 0; for (i = 0; sysloglevel2string[i].string != NULL; i++) { - fsldebug(L2_LEVEL_DEBUG, "vsyslog: ctx.levelmap[%d].syslog = 0x%.8lx, ctx.levelmap[%d].l2 = 0x%.8lx\n", i, (unsigned long)ctx.levelmap[i].syslog, i, (unsigned long)ctx.levelmap[i].l2); + fsldebug(L2_LEVEL_DEBUG, "vsyslog: ctx.levelmap[%d].syslog = 0x%.8lx, ctx.levelmap[%d].l2 = 0x%.8lx", i, (unsigned long)ctx.levelmap[i].syslog, i, (unsigned long)ctx.levelmap[i].l2); if (ctx.levelmap[i].syslog == priority) { levelmask = ctx.levelmap[i].l2; break; } } - fsldebug(L2_LEVEL_DEBUG, "vsyslog: levelmask=0x%.8lx\n", (unsigned long)levelmask); + fsldebug(L2_LEVEL_DEBUG, "vsyslog: levelmask=0x%.8lx", (unsigned long)levelmask); if ((l2rv = l2_channel_vlog(ctx.l2_nch, levelmask, fmt, args)) != L2_OK) { cp = l2_env_strerror(ctx.l2_env, l2rv); - fsldebug(L2_LEVEL_PANIC, "vsyslog: application logging failed: %s (%d)\n", cp, l2rv); + fsldebug(L2_LEVEL_PANIC, "vsyslog: application logging failed: %s (%d)", cp, l2rv); } return; }