OSSP CVS Repository

ossp - Check-in [2428]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2428
Date: 2002-Jul-30 13:50:00 (local)
2002-Jul-30 11:50:00 (UTC)
User:thl
Branch:
Comment: reduce readfileorallfiles() to readallfiles() only
Tickets:
Inspections:
Files:
ossp-pkg/fsl/TODO      1.4 -> 1.5     0 inserted, 1 deleted
ossp-pkg/fsl/fsl.c      1.39 -> 1.40     2 inserted, 47 deleted
ossp-pkg/fsl/fsl.pod      1.15 -> 1.16     6 inserted, 10 deleted

ossp-pkg/fsl/TODO 1.4 -> 1.5

--- TODO 2002/07/30 09:42:54     1.4
+++ TODO 2002/07/30 11:50:00     1.5
@@ -1,4 +1,3 @@
-- is readfileorallfiles() really reasonable?
 - allow syslog() without previous openlog()?!
 - cfg_destroy fixing and use it
 - runtime version check for sub libraries


ossp-pkg/fsl/fsl.c 1.39 -> 1.40

--- fsl.c        2002/07/30 11:37:19     1.39
+++ fsl.c        2002/07/30 11:50:00     1.40
@@ -260,32 +260,6 @@
     return rc;
 }
 
-/* read a single file "fsl.xxx" into buffer */
-static fsl_rc_t readfile(buf_t *buffer, const char *ident)
-{
-    fsl_rc_t rc;
-    char *filename = NULL;
-
-    if (ident == NULL || buffer == NULL)
-        CU(FSL_ERR_ARG);
-    fsldebug(L2_LEVEL_TRACE, "readfile() ident=\"%s\")", ident);
-
-    if ((filename = (char *)malloc(strlen(FSL_CFGDIR) + 1 + 
-                                   strlen(FSL_PREFIX) + strlen(ident) + 1)) == NULL)
-        CU(FSL_ERR_MEM);
-    filename[0] = '\0';
-    strcat(filename, FSL_CFGDIR);
-    strcat(filename, "/");
-    strcat(filename, FSL_PREFIX);
-    strcat(filename, ident);
-
-    CU(appendfiletobuffer(buffer, filename));
-CUS:
-    if (filename != NULL)
-        free(filename);
-    return rc;
-}
-
 /* read all possible files "fsl.*" into buffer */
 static fsl_rc_t readallfiles(buf_t *buffer)
 {
@@ -328,25 +302,6 @@
     return rc;
 }
 
-/* read a single or all possible files */
-static fsl_rc_t readfileorallfiles(buf_t *buffer, const char *ident)
-{
-    fsl_rc_t rv;
-
-    if (ident == NULL)
-        return FSL_ERR_ARG;
-    fsldebug(L2_LEVEL_TRACE, "readfileorallfiles() ident=\"%s\")", ident);
-
-    if ((rv = readfile(buffer, ident)) == FSL_OK)
-        return FSL_OK;
-    if (rv != FSL_ERR_SYS || errno != ENOENT)
-        return rv;
-    fsldebug(L2_LEVEL_TRACE, "readfileorallfiles: specific file does not exist, trying all files from directory");
-    if ((rv = readallfiles(buffer)) != FSL_OK)
-        return rv;
-    return FSL_OK;
-}
-
 /* OSSP cfg node tree traversal function (recursive) */
 static void traverse(cfg_t *cfg, cfg_node_t *cfgnode)
 {
@@ -749,8 +704,8 @@
     strcat(cpISF, cpFacility);
 
     /* read configuration file(s) into buffer */
-    if ((rv = readfileorallfiles(&buf, ident)) != FSL_OK) {
-        fsldebug(L2_LEVEL_ERROR, "openlog: readfileorallfiles() for ident \"%s\" failed. Hint: last system error was \"%s\"(%d)", ident, strerror(errno), errno); CU(1); }
+    if ((rv = readallfiles(&buf)) != FSL_OK) {
+        fsldebug(L2_LEVEL_ERROR, "openlog: readallfiles() failed. Hint: last system error was \"%s\"(%d)", strerror(errno), errno); CU(1); }
 
     /* import configuration buffer into OSSP cfg node tree */
     if ((cfgrv = cfg_create(&cfg)) != CFG_OK) {


ossp-pkg/fsl/fsl.pod 1.15 -> 1.16

--- fsl.pod      2002/07/30 07:10:54     1.15
+++ fsl.pod      2002/07/30 11:50:00     1.16
@@ -56,16 +56,12 @@
 =head1 OPERATION
 
 If an application calls openlog(3) it passes an identification string
-(I<ident>) and a logging facility (I<facility>) along. B<OSSP fsl>
-tries to read the file "I<cfgdir>C</fsl.>I<ident>". If the file does not
-exist, all files matching "I<cfgdir>C</fsl.*>" are read.
-
-In both cases, all data that has been read in is parsed for
-configuration sections via B<OSSP cfg>. These 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 "I<ident>/I<facility>" given to the openlog(3)
-call.
+(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
+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
+"I<ident>/I<facility>" given to the openlog(3) call.
 
 The I<l2-spec> (single) argument is an B<OSSP l2> channel tree
 specification, usually quoted with B<OSSP cfg> flexible quotes (to make

CVSTrac 2.0.1