OSSP CVS Repository

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

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)

CVSTrac 2.0.1