OSSP CVS Repository

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

Check-in Number: 2450
Date: 2002-Aug-01 10:09:04 (local)
2002-Aug-01 08:09:04 (UTC)
User:ms
Branch:
Comment: Rooted out magic numbers and made new default value section for strings.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc_config.c      1.24 -> 1.25     3 inserted, 3 deleted
ossp-pkg/rc/rc_const.h      1.10 -> 1.11     8 inserted, 0 deleted

ossp-pkg/rc/rc_config.c 1.24 -> 1.25

--- rc_config.c  2002/07/30 16:32:40     1.24
+++ rc_config.c  2002/08/01 08:09:04     1.25
@@ -296,7 +296,7 @@
     try { /* Test members for empty attributes */
         if (!configGetval(RC_EVL_VAL) && !configGetval(RC_EXC_VAL) \
             && !configGetval(RC_PRN_VAL))
-            clioptSetval(RC_PRN_VAL, "1");
+            clioptSetval(RC_PRN_VAL, RC_DEF_ON);
 
 /*        if (!configGetval(RC_USE_VAL))
         if (!configGetval(RC_HLP_VAL))
@@ -345,14 +345,14 @@
         if (!configGetval(RC_ASS_VAL))*/
 
         if (!configGetval(RC_DEF_VAL))
-            clioptSetval(RC_DEF_VAL, "^%(\\w+).*?\\n(.*?)^$");
+            clioptSetval(RC_DEF_VAL, RC_DEF_DEF);
 
 /*        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");
+            clioptSetval(RC_NCF_VAL, RC_DEF_NCF);
 
 /*        if (!configGetval(RC_CMN_VAL))
         if (!configGetval(RC_DFL_VAL))


ossp-pkg/rc/rc_const.h 1.10 -> 1.11

--- rc_const.h   2002/07/30 16:33:51     1.10
+++ rc_const.h   2002/08/01 08:09:04     1.11
@@ -70,6 +70,7 @@
 #define RC_DFL_DESC "Name of the default section in a rcfile."
 #define RC_ERR_DESC "Name of the error section in a rcfile."
 
+/* Option friendly names, should not include newline termination */
 #define RC_USE_NAME "usage"
 #define RC_DBG_NAME "debug"
 #define RC_VER_NAME "version"
@@ -102,6 +103,7 @@
 #define RC_DFL_NAME "NameDefault"       
 #define RC_ERR_NAME "NameError"
 
+/* Error and warning strings, should not include newline termination */
 #define RC_ERRSTR_OK  "Okay"
 #define RC_ERRSTR_USE "Usage"
 #define RC_ERRSTR_MEM "Memory"
@@ -118,4 +120,10 @@
 
 #define RC_GLOB_WILD  "all"
 
+/* Default values, do not include newlines and special chars must be escaped */
+#define RC_DEF_ON     "1"                       /* Digital switch */
+#define RC_DEF_OFF    "0"                       /* Digital switch */
+#define RC_DEF_DEF    "^%(\\w+).*?\\n(.*?)^$"   /* Section definition */
+#define RC_DEF_NCF    "config"                  /* Config section name */
+
 #endif /* __OSSPRC_CONST_H__ */

CVSTrac 2.0.1