OSSP CVS Repository

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

Check-in Number: 2089
Date: 2002-Apr-22 14:16:39 (local)
2002-Apr-22 12:16:39 (UTC)
User:ms
Branch:
Comment: Configuration string parsing logic.
Tickets:
Inspections:
Files:
ossp-pkg/rc/Makefile.in      1.21 -> 1.22     1 inserted, 1 deleted
ossp-pkg/rc/rc.c      1.19 -> 1.20     1 inserted, 1 deleted
ossp-pkg/rc/rc.h      1.18 -> 1.19     1 inserted, 1 deleted
ossp-pkg/rc/rc_cliopt.c      1.3 -> 1.4     58 inserted, 56 deleted
ossp-pkg/rc/rc_config.c      1.10 -> 1.11     9 inserted, 9 deleted
ossp-pkg/rc/rc_config.h      1.2 -> 1.3     31 inserted, 30 deleted

ossp-pkg/rc/Makefile.in 1.21 -> 1.22

--- Makefile.in  2002/04/11 16:52:45     1.21
+++ Makefile.in  2002/04/22 12:16:39     1.22
@@ -109,7 +109,7 @@
 rc.1: rc.pod
         VS=`$(SHTOOL) version -lc -dshort rc_version.c`; \
         VL=`$(SHTOOL) version -lc -dlong rc_version.c`; \
-        $(POD2MAN) --section=5 --center="Run-command processor" \
+        $(POD2MAN) --section=1 --center="Run-command processor" \
                --release="$$VS" --date="$$VL" \
                rc.pod >rc.1
 


ossp-pkg/rc/rc.c 1.19 -> 1.20

--- rc.c 2002/04/12 19:15:12     1.19
+++ rc.c 2002/04/22 12:16:39     1.20
@@ -78,7 +78,7 @@
                 fprintf(stderr, "%s\n", configGetval(i));
         }
     }
-    ex_catch(Except) {
+    ex_catch(Except) {  /* Breaks the otherwise endless while loop above    */
         bCaught = TRUE;
     }
     i++;


ossp-pkg/rc/rc.h 1.18 -> 1.19

--- rc.h 2002/04/12 19:15:12     1.18
+++ rc.h 2002/04/22 12:16:39     1.19
@@ -75,7 +75,7 @@
     rc_return_t clioptRemallimp(rc_bintup_t **);
     rc_return_t clioptRemall(void);
     rc_return_t clioptAppnode(const char *, const char *);*/
-rc_return_t clioptProcess(int);
+rc_return_t clioptProcess(int, const char *);
 rc_return_t clioptParse(int, char **);
 rc_return_t clioptDestruct(void);
 


ossp-pkg/rc/rc_cliopt.c 1.3 -> 1.4

--- rc_cliopt.c  2002/04/12 19:15:12     1.3
+++ rc_cliopt.c  2002/04/22 12:16:39     1.4
@@ -88,95 +88,97 @@
 * processing the corresponding option  *
 * and update option table accordingly  *
 ***************************************/
-rc_return_t clioptProcess(int cliOption)
+rc_return_t clioptProcess(int cliOption, const char *szArg)
 {
     switch (cliOption) {
+    /* Begin concrete (digital) options */
         case RC_USE_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Usage    */
             break;
         case RC_DBG_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Debug    */
             break;
         case RC_VER_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Version  */
             break;
         case RC_EVL_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Eval     */
             break;
         case RC_HLP_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Help     */
             break;
         case RC_INF_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Info     */
             break;
         case RC_LBL_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Label    */
             break;
         case RC_PRN_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Print    */
             break;
         case RC_SIL_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Silent   */
             break;
         case RC_RAW_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Raw      */
             break;
         case RC_VRB_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Verbose  */
             break;
         case RC_EXC_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup("1");  /* Exec     */
             break;
+    /* Begin abstract (nondigital) options */
         case RC_LOC_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Locations      */
             break;
         case RC_CNF_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Conf file      */
             break;
         case RC_FNC_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Func file      */
             break;
         case RC_QRY_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Format         */
             break;
         case RC_TMP_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Temp dir       */
             break;
         case RC_OWN_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* User name      */
             break;
         case RC_GRP_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Group name     */
             break;
         case RC_MSK_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Umask          */
             break;
         case RC_ASS_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Assign regex   */
             break;
         case RC_DEF_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Label regex    */
             break;
         case RC_REF_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Ref regex      */
             break;
         case RC_PRM_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Params regex   */
             break;
         case RC_TRM_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Terminal regex */
             break;
         case RC_NCF_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Config name    */
             break;
         case RC_CMN_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Common name    */
             break;
         case RC_DFL_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Default name   */
             break;
         case RC_ERR_VAL:
-            m_szOptuples[cliOption] = strdup("1");
+            m_szOptuples[cliOption] = strdup(szArg);    /* Error name     */
             break;
         default :
             break;
@@ -193,18 +195,18 @@
 {
     static struct popt_option optionsTable[] = {
         /* Long options with short keys but no arguments */
-        { RC_USE_NAME, '?', POPT_ARG_NONE,   0, RC_USE_VAL, RC_USE_DESC, NULL },
-        { RC_DBG_NAME, 'd', POPT_ARG_NONE,   0, RC_DBG_VAL, RC_DBG_DESC, NULL },
-        { RC_VER_NAME, 'V', POPT_ARG_NONE,   0, RC_VER_VAL, RC_VER_DESC, NULL },
-        { RC_EVL_NAME, 'e', POPT_ARG_NONE,   0, RC_EVL_VAL, RC_EVL_DESC, NULL },
-        { RC_HLP_NAME, 'h', POPT_ARG_NONE,   0, RC_HLP_VAL, RC_HLP_DESC, NULL },
-        { RC_INF_NAME, 'i', POPT_ARG_NONE,   0, RC_INF_VAL, RC_INF_DESC, NULL },
-        { RC_LBL_NAME, 'l', POPT_ARG_NONE,   0, RC_LBL_VAL, RC_LBL_DESC, NULL },
-        { RC_PRN_NAME, 'p', POPT_ARG_NONE,   0, RC_PRN_VAL, RC_PRN_DESC, NULL },
-        { RC_SIL_NAME, 's', POPT_ARG_NONE,   0, RC_SIL_VAL, RC_SIL_DESC, NULL },
-        { RC_RAW_NAME, 'r', POPT_ARG_NONE,   0, RC_RAW_VAL, RC_RAW_DESC, NULL },
-        { RC_VRB_NAME, 'v', POPT_ARG_NONE,   0, RC_VRB_VAL, RC_VRB_DESC, NULL },
-        { RC_EXC_NAME, 'x', POPT_ARG_NONE,   0, RC_EXC_VAL, RC_EXC_DESC, NULL },
+        {RC_USE_NAME, '?', POPT_ARG_NONE, 0, RC_USE_VAL, RC_USE_DESC, NULL},
+        {RC_DBG_NAME, 'd', POPT_ARG_NONE, 0, RC_DBG_VAL, RC_DBG_DESC, NULL},
+        {RC_VER_NAME, 'V', POPT_ARG_NONE, 0, RC_VER_VAL, RC_VER_DESC, NULL},
+        {RC_EVL_NAME, 'e', POPT_ARG_NONE, 0, RC_EVL_VAL, RC_EVL_DESC, NULL},
+        {RC_HLP_NAME, 'h', POPT_ARG_NONE, 0, RC_HLP_VAL, RC_HLP_DESC, NULL},
+        {RC_INF_NAME, 'i', POPT_ARG_NONE, 0, RC_INF_VAL, RC_INF_DESC, NULL},
+        {RC_LBL_NAME, 'l', POPT_ARG_NONE, 0, RC_LBL_VAL, RC_LBL_DESC, NULL},
+        {RC_PRN_NAME, 'p', POPT_ARG_NONE, 0, RC_PRN_VAL, RC_PRN_DESC, NULL},
+        {RC_SIL_NAME, 's', POPT_ARG_NONE, 0, RC_SIL_VAL, RC_SIL_DESC, NULL},
+        {RC_RAW_NAME, 'r', POPT_ARG_NONE, 0, RC_RAW_VAL, RC_RAW_DESC, NULL},
+        {RC_VRB_NAME, 'v', POPT_ARG_NONE, 0, RC_VRB_VAL, RC_VRB_DESC, NULL},
+        {RC_EXC_NAME, 'x', POPT_ARG_NONE, 0, RC_EXC_VAL, RC_EXC_DESC, NULL},
                                               
         /* Single argument long options with short keys */
         {RC_LOC_NAME, 'L', POPT_ARG_STRING, 0, RC_LOC_VAL, RC_LOC_DESC, "regx"},
@@ -214,22 +216,22 @@
         {RC_TMP_NAME, 't', POPT_ARG_STRING, 0, RC_TMP_VAL, RC_TMP_DESC, "path"},
 
         /* Single argument long options without short keys */
-        { RC_OWN_NAME, 0, POPT_ARG_STRING, 0, RC_OWN_VAL, RC_OWN_DESC, "user" },
-        { RC_GRP_NAME, 0, POPT_ARG_STRING, 0, RC_GRP_VAL, RC_GRP_DESC, "group"},
-        { RC_MSK_NAME, 0, POPT_ARG_INT,    0, RC_MSK_VAL, RC_MSK_DESC, "umask"},
-        { RC_ASS_NAME, 0, POPT_ARG_STRING, 0, RC_ASS_VAL, RC_ASS_DESC, "regx" },
-        { RC_DEF_NAME, 0, POPT_ARG_STRING, 0, RC_DEF_VAL, RC_DEF_DESC, "regx" },
-        { RC_REF_NAME, 0, POPT_ARG_STRING, 0, RC_REF_VAL, RC_REF_DESC, "regx" },
-        { RC_PRM_NAME, 0, POPT_ARG_STRING, 0, RC_PRM_VAL, RC_PRM_DESC, "regx" },
-        { RC_TRM_NAME, 0, POPT_ARG_STRING, 0, RC_TRM_VAL, RC_TRM_DESC, "regx" },
-        { RC_NCF_NAME, 0, POPT_ARG_STRING, 0, RC_NCF_VAL, RC_NCF_DESC, "name" },
-        { RC_CMN_NAME, 0, POPT_ARG_STRING, 0, RC_CMN_VAL, RC_CMN_DESC, "name" },
-        { RC_DFL_NAME, 0, POPT_ARG_STRING, 0, RC_DFL_VAL, RC_DFL_DESC, "name" },
-        { RC_ERR_NAME, 0, POPT_ARG_STRING, 0, RC_ERR_VAL, RC_ERR_DESC, "name" },
+        {RC_OWN_NAME, 0, POPT_ARG_STRING, 0, RC_OWN_VAL, RC_OWN_DESC, "user"},
+        {RC_GRP_NAME, 0, POPT_ARG_STRING, 0, RC_GRP_VAL, RC_GRP_DESC, "group"},
+        {RC_MSK_NAME, 0, POPT_ARG_INT,    0, RC_MSK_VAL, RC_MSK_DESC, "umask"},
+        {RC_ASS_NAME, 0, POPT_ARG_STRING, 0, RC_ASS_VAL, RC_ASS_DESC, "regx"},
+        {RC_DEF_NAME, 0, POPT_ARG_STRING, 0, RC_DEF_VAL, RC_DEF_DESC, "regx"},
+        {RC_REF_NAME, 0, POPT_ARG_STRING, 0, RC_REF_VAL, RC_REF_DESC, "regx"},
+        {RC_PRM_NAME, 0, POPT_ARG_STRING, 0, RC_PRM_VAL, RC_PRM_DESC, "regx"},
+        {RC_TRM_NAME, 0, POPT_ARG_STRING, 0, RC_TRM_VAL, RC_TRM_DESC, "regx"},
+        {RC_NCF_NAME, 0, POPT_ARG_STRING, 0, RC_NCF_VAL, RC_NCF_DESC, "name"},
+        {RC_CMN_NAME, 0, POPT_ARG_STRING, 0, RC_CMN_VAL, RC_CMN_DESC, "name"},
+        {RC_DFL_NAME, 0, POPT_ARG_STRING, 0, RC_DFL_VAL, RC_DFL_DESC, "name"},
+        {RC_ERR_NAME, 0, POPT_ARG_STRING, 0, RC_ERR_VAL, RC_ERR_DESC, "name"},
 
         /* Special stuff    */
         POPT_AUTOHELP
-        { NULL, 0, 0, NULL, 0 }
+        {NULL, 0, 0, NULL, 0}
     };
 
     ex_t Except;
@@ -248,7 +250,7 @@
     /* Now do options processing */
     while ((cliOpt = popt_getnextopt(optCon)) >= 0)
     ex_try {
-        clioptProcess(cliOpt);
+        clioptProcess(cliOpt, popt_getoptarg(optCon));
     }
     ex_catch(Except) {
         if ((rc_return_t)Except.ex_value != RC_ERR_USE)


ossp-pkg/rc/rc_config.c 1.10 -> 1.11

--- rc_config.c  2002/04/12 19:15:12     1.10
+++ rc_config.c  2002/04/22 12:16:39     1.11
@@ -89,15 +89,15 @@
 
 const char *configGetname(rc_opt_t Optname)
 {
-    static char *s_szOptnametab[] = {
-        RC_USE_NAME, RC_DBG_NAME, RC_VER_NAME, RC_EVL_NAME,
-        RC_HLP_NAME, RC_INF_NAME, RC_LBL_NAME, RC_PRN_NAME,
-        RC_SIL_NAME, RC_RAW_NAME, RC_VRB_NAME, RC_EXC_NAME,
-        RC_LOC_NAME, RC_CNF_NAME, RC_FNC_NAME, RC_QRY_NAME,
-        RC_TMP_NAME, RC_OWN_NAME, RC_GRP_NAME, RC_MSK_NAME,
-        RC_ASS_NAME, RC_DEF_NAME, RC_REF_NAME, RC_PRM_NAME,
-        RC_TRM_NAME, RC_NCF_NAME, RC_CMN_NAME, RC_DFL_NAME,
-        RC_ERR_NAME
+    static char *s_szOptnametab[] = { /* NULL is for alignment */
+        NULL,        RC_USE_NAME, RC_DBG_NAME, RC_VER_NAME,
+        RC_EVL_NAME, RC_HLP_NAME, RC_INF_NAME, RC_LBL_NAME,
+        RC_PRN_NAME, RC_SIL_NAME, RC_RAW_NAME, RC_VRB_NAME,
+        RC_EXC_NAME, RC_LOC_NAME, RC_CNF_NAME, RC_FNC_NAME,
+        RC_QRY_NAME, RC_TMP_NAME, RC_OWN_NAME, RC_GRP_NAME,
+        RC_MSK_NAME, RC_ASS_NAME, RC_DEF_NAME, RC_REF_NAME,
+        RC_PRM_NAME, RC_TRM_NAME, RC_NCF_NAME, RC_CMN_NAME,
+        RC_DFL_NAME, RC_ERR_NAME
     };
 
     if (m_nLocks) { /* Make sure config exists  */


ossp-pkg/rc/rc_config.h 1.2 -> 1.3

--- rc_config.h  2002/04/11 16:52:45     1.2
+++ rc_config.h  2002/04/22 12:16:39     1.3
@@ -31,36 +31,37 @@
 #define __OSSPRC_CONFIG_H__
 
 /* Available options and their values */
-#define RC_USE_VAL   0
-#define RC_DBG_VAL   1
-#define RC_VER_VAL   2
-#define RC_EVL_VAL   3
-#define RC_HLP_VAL   4
-#define RC_INF_VAL   5
-#define RC_LBL_VAL   6
-#define RC_PRN_VAL   7
-#define RC_SIL_VAL   8
-#define RC_RAW_VAL   9
-#define RC_VRB_VAL  10
-#define RC_EXC_VAL  11
-#define RC_LOC_VAL  12
-#define RC_CNF_VAL  13
-#define RC_FNC_VAL  14
-#define RC_QRY_VAL  15
-#define RC_TMP_VAL  16
-#define RC_OWN_VAL  17
-#define RC_GRP_VAL  18
-#define RC_MSK_VAL  19
-#define RC_ASS_VAL  20
-#define RC_DEF_VAL  21
-#define RC_REF_VAL  22
-#define RC_PRM_VAL  23
-#define RC_TRM_VAL  24
-#define RC_NCF_VAL  25
-#define RC_CMN_VAL  26
-#define RC_DFL_VAL  27
-#define RC_ERR_VAL  28
+#define RC_HEADVAL   0  /* Unused, as popt reserves 0 to return success */
+#define RC_USE_VAL   1
+#define RC_DBG_VAL   2
+#define RC_VER_VAL   3
+#define RC_EVL_VAL   4
+#define RC_HLP_VAL   5
+#define RC_INF_VAL   6
+#define RC_LBL_VAL   7
+#define RC_PRN_VAL   8
+#define RC_SIL_VAL   9
+#define RC_RAW_VAL  10
+#define RC_VRB_VAL  11
+#define RC_EXC_VAL  12
+#define RC_LOC_VAL  13
+#define RC_CNF_VAL  14
+#define RC_FNC_VAL  15
+#define RC_QRY_VAL  16
+#define RC_TMP_VAL  17
+#define RC_OWN_VAL  18
+#define RC_GRP_VAL  19
+#define RC_MSK_VAL  20
+#define RC_ASS_VAL  21
+#define RC_DEF_VAL  22
+#define RC_REF_VAL  23
+#define RC_PRM_VAL  24
+#define RC_TRM_VAL  25
+#define RC_NCF_VAL  26
+#define RC_CMN_VAL  27
+#define RC_DFL_VAL  28
+#define RC_ERR_VAL  29
 
-#define RC_NUMOPTS  29  /* Increment with each option addition */
+#define RC_NUMOPTS  30  /* Increment with each option addition */
 
 #endif /* __OSSPRC_CONFIG_H__ */

CVSTrac 2.0.1