Check-in Number:
|
2460 | |
Date: |
2002-Aug-01 13:41:05 (local)
2002-Aug-01 11:41:05 (UTC) |
User: | rse |
Branch: | |
Comment: |
add support for FSL_PREFIX and FSL_DEBUG variables. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/fsl/.cvsignore 1.1 -> 1.2
--- .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
|
|
ossp-pkg/fsl/Makefile.in 1.8 -> 1.9
--- 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
|
|
ossp-pkg/fsl/fsl.ac 1.3 -> 1.4
--- 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])
])
|
|
ossp-pkg/fsl/fsl.c 1.44 -> 1.45
--- 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)
|
|
ossp-pkg/fsl/fsl.pod 1.22 -> 1.23
--- 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<ident>) and a logging facility (I<facility>) along. B<OSSP fsl> reads all
-configuration files matching "I<cfgdir>C</fsl.*>" and parses them using
+configuration files matching "I<cfgdir>C</>I<prefix>C<*>" and parses them using
B<OSSP cfg>. Sections are identified by "C<ident>I<match>C</>I<l2-spec>C<;>"
directives. The I<match> argument is an B<OSSP pcre> (Perl-compatible)
regular expression that is matched against a string concatenated from
@@ -354,7 +354,6 @@
A very simple I<l2-spec> just writing everything to F<stderr>
(filedescriptor 2):
- ident .*
fd(fd=2)
=head2 Example 2: simple logfile writing
@@ -485,6 +484,21 @@
=over 4
+=item C<FSL_CFGDIR>
+
+This variable overrides the default value (hard-coded in B<OSSP fsl>
+under built-time via C<--with-fsl-cfgdir=>I<path>) under run-time. The
+value has to point to an existing directory where configuration files
+named "I<prefix>C<*>" (see below) exist. The default value is
+"C<@FSL_CFGDIR@>".
+
+=item C<FSL_PREFIX>
+
+This variable overrides the default value (hard-coded in B<OSSP fsl>
+under built-time via C<--with-fsl-prefix=>I<prefix>) under run-time.
+The value has to be a valid partial Unix filename. The default value is
+"C<@FSL_PREFIX@>".
+
=item C<FSL_DEBUG>
This variable overrides the default value (hard-coded in B<OSSP fsl>
@@ -501,12 +515,9 @@
=over 4
-=item F<FSL_CFGDIR/fsl.*>
+=item F<@FSL_CFGDIR@/@FSL_PREFIX@*>
-B<OSSP fsl> 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<OSSP fsl> via the F<configure> option
-C<--with-cfgdir=>I<cfgdir>.
+B<OSSP fsl> reads configuration sections located in these files.
=back
|
|
ossp-pkg/fsl/fsl_test.cfg -> 1.1
*** /dev/null Sat Nov 23 00:57:17 2024
--- - Sat Nov 23 00:57:35 2024
***************
*** 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
+ )
+ };
+
|
|