OSSP CVS Repository

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

Check-in Number: 2420
Date: 2002-Jul-29 18:34:58 (local)
2002-Jul-29 16:34:58 (UTC)
User:ms
Branch:
Comment: Implement about half of the necessary default configuration members.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc.c      1.39 -> 1.40     2 inserted, 1 deleted
ossp-pkg/rc/rc.h      1.35 -> 1.36     1 inserted, 0 deleted
ossp-pkg/rc/rc_config.c      1.22 -> 1.23     80 inserted, 0 deleted

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

--- rc.c 2002/07/10 19:02:24     1.39
+++ rc.c 2002/07/29 16:34:58     1.40
@@ -39,10 +39,11 @@
 {
     ex_t Except;
 
-    try {                       /* Configuration block                        */
+    try {                       /* Configuration block, config is built here  */
         configNew();            /* Construct a new config, add default values */
         configLoad(argc, (const char **)argv);   /* Load cli, env, and conf   */
         configVerify();         /* Test for usage, help and version options   */
+        configDefaults();       /* Add default values to empty config members */
     }
     catch(Except)               /* Exceptions of the configuration block      */
         rcError(Except);


ossp-pkg/rc/rc.h 1.35 -> 1.36

--- rc.h 2002/07/04 16:49:58     1.35
+++ rc.h 2002/07/29 16:34:58     1.36
@@ -73,6 +73,7 @@
 rc_return_t configLoad(int, const char **);
 rc_return_t configInfo(void);
 rc_return_t configVerify(void);
+rc_return_t configDefaults(void);
 rc_return_t configDelete(void);
 
 /* Config accessor prototypes */


ossp-pkg/rc/rc_config.c 1.22 -> 1.23

--- rc_config.c  2002/07/05 14:10:24     1.22
+++ rc_config.c  2002/07/29 16:34:59     1.23
@@ -252,6 +252,86 @@
         return(RC_THROW(RC_OK));        /* No, we should continue processing. */
 }
 
+/************************************************
+* configDefaults(void)                          *
+* Write default values to empty config members  *
+************************************************/
+rc_return_t configDefaults(void)
+{
+    ex_t Except;
+
+    try { /* Test members for empty attributes */
+        if (!configGetval(RC_EVL_VAL) && !configGetval(RC_EXC_VAL) \
+            && !configGetval(RC_PRN_VAL))
+            clioptSetval(RC_PRN_VAL, "1");
+
+/*        if (!configGetval(RC_USE_VAL))
+        if (!configGetval(RC_HLP_VAL))
+        if (!configGetval(RC_INF_VAL))
+        if (!configGetval(RC_LBL_VAL))
+        if (!configGetval(RC_SIL_VAL))
+        if (!configGetval(RC_RAW_VAL))
+        if (!configGetval(RC_VRB_VAL))*/
+
+/*
+        if (!configGetval(RC_LOC_VAL)) {
+            If exists '/etc/rc.d'
+                clioptSetval(RC_LOC_VAL, "/etc/rc.d/rc.");
+                FIXME: !This 'rc.' reading logic must still be implemented!
+            Else
+                RC_NOP;
+        }
+        if (!configGetval(RC_CNF_VAL)) {
+            If exists '/etc/rcconf'
+                clioptSetval(RC_CNF_VAL, "/etc/rcconf");
+            Else
+                RC_NOP;
+        }
+        if (!configGetval(RC_FNC_VAL)) {
+            If exists '/etc/rc.func'
+                clioptSetval(RC_FNC_VAL, "/etc/rc.func");
+            Else
+                RC_NOP;
+        }
+*/
+
+/*        if (!configGetval(RC_QRY_VAL))*/
+
+/*
+        if (!configGetval(RC_TMP_VAL)) {
+            If exists '/tmp'
+                clioptSetval(RC_TMP_VAL, "/tmp");
+            Else
+                RC_NOP;
+        }
+*/
+
+/*        if (!configGetval(RC_OWN_VAL))
+        if (!configGetval(RC_GRP_VAL))
+        if (!configGetval(RC_MSK_VAL))
+        if (!configGetval(RC_ASS_VAL))*/
+
+        if (!configGetval(RC_DEF_VAL))
+            clioptSetval(RC_DEF_VAL, "^%(\\w+).*?\\n(.*?)^$");
+
+/*        if (!configGetval(RC_REF_VAL))
+        if (!configGetval(RC_PRM_VAL))
+        if (!configGetval(RC_TRM_VAL))*/
+
+        if (!configGetval(RC_NCF_VAL))
+            clioptSetval(RC_NCF_VAL, "config");
+
+/*        if (!configGetval(RC_CMN_VAL))
+        if (!configGetval(RC_DFL_VAL))
+        if (!configGetval(RC_ERR_VAL))*/
+    }
+    catch(Except) {
+        rethrow;
+    }
+
+    return(RC_THROW(RC_OK));    /* Normal response */
+}
+
 /***************************************
 * configDelete(void)                   *
 * Destruct a configuration             *

CVSTrac 2.0.1