Index: ossp-pkg/fsl/.cvsignore RCS File: /v/ossp/cvs/ossp-pkg/fsl/.cvsignore,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/fsl/.cvsignore,v' 2>/dev/null --- .cvsignore 2002/07/09 09:42:09 1.1 +++ .cvsignore 2002/08/01 11:41:05 1.2 @@ -4,10 +4,13 @@ config.h.in config.sub configure -libtool.m4 -ltmain.sh fsl-config fsl.3 fsl.h fsl_test +fsl_test.cfg +fsl_test.debug +fsl_test.syslog +libtool.m4 +ltmain.sh shtool Index: ossp-pkg/fsl/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/fsl/Makefile.in,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/fsl/Makefile.in,v' 2>/dev/null --- Makefile.in 2002/08/01 09:36:53 1.8 +++ Makefile.in 2002/08/01 11:41:05 1.9 @@ -60,6 +60,7 @@ TST_OBJS = fsl_test.o FSL_CFGDIR = @FSL_CFGDIR@ +FSL_PREFIX = @FSL_PREFIX@ SUBDIRS = @SUBDIR_L2@ @SUBDIR_CFG@ @SUBDIR_PCRE@ @@ -108,10 +109,17 @@ $(POD2MAN) --quotes=none \ --section=3 --center="Faking/Flexible Syslog Library" \ --release="$$D" --date="OSSP fsl $$VS" fsl.pod | \ - sed -e "s;FSL_VERSION_STR;$$VL;" -e "s;FSL_CFGDIR;$(FSL_CFGDIR);g" >fsl.3 + sed -e "s;FSL_VERSION_STR;$$VL;" \ + -e "s;\@FSL_CFGDIR\@;$(FSL_CFGDIR);g" \ + -e "s;\@FSL_PREFIX\@;$(FSL_PREFIX);g" >fsl.3 check: $(TST_NAME) - @$(LIBTOOL) --mode=execute ./$(TST_NAME) + @$(RM) fsl_test.debug >/dev/null 2>&1 || true; \ + $(RM) fsl_test.syslog >/dev/null 2>&1 || true; \ + FSL_CFGDIR=.; export FSL_CFGDIR; \ + FSL_PREFIX=fsl_test.cfg; export FSL_PREFIX; \ + FSL_DEBUG="trace: file(path=fsl_test.debug)"; export FSL_DEBUG; \ + $(LIBTOOL) --mode=execute ./$(TST_NAME) install: all $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix) @@ -136,6 +144,7 @@ @$(MAKE) $(MFLAGS) _SUBDIRS_clean -$(RM) $(LIB_NAME) $(LIB_OBJS) -$(RM) $(TST_NAME) $(TST_OBJS) + -$(RM) fsl_test.debug fsl_test.syslog >/dev/null 2>&1 || $(TRUE) -$(RM) -r .libs >/dev/null 2>&1 || $(TRUE) -$(RM) *.o *.lo Index: ossp-pkg/fsl/fsl.ac RCS File: /v/ossp/cvs/ossp-pkg/fsl/fsl.ac,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/fsl/fsl.ac,v' 2>/dev/null --- fsl.ac 2002/08/01 10:18:06 1.3 +++ fsl.ac 2002/08/01 11:41:05 1.4 @@ -53,10 +53,10 @@ ;; esac -dnl # built-time configuration parameter --with-cfgdir +dnl # built-time configuration parameter --with-fsl-cfgdir AC_MSG_CHECKING(for configuration directory) AC_ARG_WITH(fsl-cfgdir,dnl -[ --with-fsl-cfgdir=PATH set configuration directory (default=PREFIX/etc/fsl)], +[ --with-fsl-cfgdir=PATH set configuration directory (default="PREFIX/etc/fsl")], [ fsl_cfgdir=$withval ], [ fsl_cfgdir="${prefix}/etc/fsl" ] )dnl @@ -65,14 +65,28 @@ AC_SUBST(FSL_CFGDIR) AC_MSG_RESULT([$fsl_cfgdir]) -dnl # built-time configuration parameter --with-debug +dnl # built-time configuration parameter --with-fsl-prefix +AC_MSG_CHECKING(for configuration file prefix) +AC_ARG_WITH(fsl-prefix,dnl +[ --with-fsl-prefix=PATH set configuration file prefix (default="fsl.")], +[ fsl_prefix=$withval ], +[ fsl_prefix="fsl." ] +)dnl +AC_DEFINE_UNQUOTED(FSL_PREFIX, "$fsl_prefix", [Define for OSSP fsl configuration file prefix]) +FSL_PREFIX="$fsl_prefix" +AC_SUBST(FSL_PREFIX) +AC_MSG_RESULT([$fsl_prefix]) + +dnl # built-time configuration parameter --with-fsl-debug AC_MSG_CHECKING(for debugging using a l2spec) AC_ARG_WITH(fsl-debug,dnl -[ --with-fsl-debug=L2SPEC set internal debugging (default="")], +[ --with-fsl-debug=L2SPEC set internal debugging (default="null")], [ fsl_debug=$withval ], -[ fsl_debug="" ] +[ fsl_debug="null" ] )dnl AC_DEFINE_UNQUOTED(FSL_DEBUG, "$fsl_debug", [Define for OSSP fsl debugging]) +FSL_DEBUG="$fsl_debug" +AC_SUBST(FSL_DEBUG) AC_MSG_RESULT([$fsl_debug]) ]) Index: ossp-pkg/fsl/fsl.c RCS File: /v/ossp/cvs/ossp-pkg/fsl/fsl.c,v rcsdiff -q -kk '-r1.44' '-r1.45' -u '/v/ossp/cvs/ossp-pkg/fsl/fsl.c,v' 2>/dev/null --- fsl.c 2002/07/31 13:20:50 1.44 +++ fsl.c 2002/08/01 11:41:05 1.45 @@ -73,9 +73,6 @@ #define CU(returncode) STMT( rc = returncode; goto CUS; ) #define VCU STMT( goto CUS; ) -/* prefix of configuration files */ -#define FSL_PREFIX "fsl." - /* general return codes */ typedef enum { FSL_OK = 0, /* everything ok */ @@ -277,24 +274,32 @@ DIR *dp = NULL; struct dirent *de; char *filename = NULL; + char *cfgdir; + char *prefix; int n; if (buffer == NULL) CU(FSL_ERR_ARG); - fsldebug(L2_LEVEL_TRACE, "readallfiles() globbing \"%s/%s*\"", FSL_CFGDIR, FSL_PREFIX); - if ((dp = opendir(FSL_CFGDIR)) == NULL) + if ((cfgdir = getenv("FSL_CFGDIR")) == NULL) + cfgdir = FSL_CFGDIR; + if ((prefix = getenv("FSL_PREFIX")) == NULL) + prefix = FSL_PREFIX; + + fsldebug(L2_LEVEL_TRACE, "readallfiles() globbing \"%s/%s*\"", cfgdir, prefix); + + if ((dp = opendir(cfgdir)) == NULL) CU(FSL_ERR_SYS); rc = FSL_ERR_ARG; while ((de = readdir(dp)) != NULL) { n = strlen(de->d_name); - if ( (n >= strlen(FSL_PREFIX)) - && (strncmp(de->d_name, FSL_PREFIX, strlen(FSL_PREFIX)) == 0)) { - if ((filename = (char *)malloc(strlen(FSL_CFGDIR) + 1 + n + 1)) == NULL) + if ( (n >= strlen(prefix)) + && (strncmp(de->d_name, prefix, strlen(prefix)) == 0)) { + if ((filename = (char *)malloc(strlen(cfgdir) + 1 + n + 1)) == NULL) CU(FSL_ERR_MEM); filename[0] = '\0'; - strcat(filename, FSL_CFGDIR); + strcat(filename, cfgdir); strcat(filename, "/"); strcat(filename, de->d_name); if (appendfiletobuffer(buffer, filename) == FSL_OK) Index: ossp-pkg/fsl/fsl.pod RCS File: /v/ossp/cvs/ossp-pkg/fsl/fsl.pod,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/fsl/fsl.pod,v' 2>/dev/null --- fsl.pod 2002/08/01 10:18:06 1.22 +++ fsl.pod 2002/08/01 11:41:05 1.23 @@ -59,7 +59,7 @@ If an application calls openlog(3) it passes an identification string (I) and a logging facility (I) along. B reads all -configuration files matching "IC" and parses them using +configuration files matching "ICIC<*>" and parses them using B. Sections are identified by "CICIC<;>" directives. The I argument is an B (Perl-compatible) regular expression that is matched against a string concatenated from @@ -354,7 +354,6 @@ A very simple I just writing everything to F (filedescriptor 2): - ident .* fd(fd=2) =head2 Example 2: simple logfile writing @@ -485,6 +484,21 @@ =over 4 +=item C + +This variable overrides the default value (hard-coded in B +under built-time via C<--with-fsl-cfgdir=>I) under run-time. The +value has to point to an existing directory where configuration files +named "IC<*>" (see below) exist. The default value is +"C<@FSL_CFGDIR@>". + +=item C + +This variable overrides the default value (hard-coded in B +under built-time via C<--with-fsl-prefix=>I) under run-time. +The value has to be a valid partial Unix filename. The default value is +"C<@FSL_PREFIX@>". + =item C This variable overrides the default value (hard-coded in B @@ -501,12 +515,9 @@ =over 4 -=item F +=item F<@FSL_CFGDIR@/@FSL_PREFIX@*> -B reads configuration sections located in these files. The -path FSL_CFGDIR of the directory containing these file(s) has to be -specified at build-time of B via the F option -C<--with-cfgdir=>I. +B reads configuration sections located in these files. =back Index: ossp-pkg/fsl/fsl_test.cfg RCS File: /v/ossp/cvs/ossp-pkg/fsl/fsl_test.cfg,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/fsl/fsl_test.cfg,v' | diff -u /dev/null - -L'ossp-pkg/fsl/fsl_test.cfg' 2>/dev/null --- ossp-pkg/fsl/fsl_test.cfg +++ - 2024-05-16 10:45:39.656586759 +0200 @@ -0,0 +1,27 @@ + +# map syslog(3) API priorities to OSSP l2 levels +# Notes: - syslog(3) has no corresponding priority for OSSP l2 "trace" +# - OSSP l2 has no corresponding level for syslog(3) emerg +map emerg panic; +map alert panic; +map crit critical; +map err error; +map warning warning; +map notice notice; +map info info; +map debug debug; + +# default logging specification +default (.+)/.+ q{ + debug: + prefix( + prefix="%b %d %H:%M:%S <%L> $1[%P]: ", + timezone=local + ) -> + file( + path="./fsl_test.syslog", + append=1, + perm=0644 + ) +}; +