OSSP CVS Repository

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

Check-in Number: 2091
Date: 2002-Apr-22 17:22:39 (local)
2002-Apr-22 15:22:39 (UTC)
User:ms
Branch:
Comment: Remove obsolete specs and implementations.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc.c      1.20 -> 1.21     2 inserted, 27 deleted
ossp-pkg/rc/rc.h      1.19 -> 1.20     1 inserted, 1 deleted
ossp-pkg/rc/rc_cliopt.c      1.4 -> 1.5     63 inserted, 91 deleted
ossp-pkg/rc/rc_cliopt.h      1.1->removed
ossp-pkg/rc/rc_config.c      1.11 -> 1.12     43 inserted, 0 deleted
ossp-pkg/rc/rc_opt.h      1.1->removed
ossp-pkg/rc/rc_optimpl.c      1.5->removed
ossp-pkg/rc/rc_option.c      1.5->removed
ossp-pkg/rc/rc_option.h      1.3->removed

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

--- rc.c 2002/04/22 12:16:39     1.20
+++ rc.c 2002/04/22 15:22:39     1.21
@@ -34,10 +34,6 @@
 #include "rc_const.h"
 #include "rc_private.h"
 
-/* FIXME BEGIN DEBUG */
-#include "rc_config.h"
-#include <string.h>
-/* FIXME END DEBUG */
 
 int main(int argc, char *argv[])
 {
@@ -64,29 +60,8 @@
         exit(1);        /* Failure */
     }
 
-/* FIXME BEGIN DEBUG */
-{
-int i = 0;
-int bCaught = FALSE;
-while (!bCaught) {
-    ex_try {
-        if (configGetval(i)) {
-            fprintf(stderr, "D Option %s: ", configGetname(i));
-            if (!(strcmp(configGetval(i), "1")))
-                fprintf(stderr, "on\n");
-            else
-                fprintf(stderr, "%s\n", configGetval(i));
-        }
-    }
-    ex_catch(Except) {  /* Breaks the otherwise endless while loop above    */
-        bCaught = TRUE;
-    }
-    i++;
-}
-}
-/* FIXME END DEBUG */
-
-configDestruct();/* FIXME Remove, allow first scope */
+fprintf(stderr, configSummarize());
+configDestruct();   /* FIXME Remove, allow first scope */
 TRACE("No exceptions caught\n");
     exit(0);            /* Success */
 }


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

--- rc.h 2002/04/22 12:16:39     1.19
+++ rc.h 2002/04/22 15:22:39     1.20
@@ -68,6 +68,7 @@
 /* Config accessor prototypes */
 const char *configGetval(rc_opt_t);
 const char *configGetname(rc_opt_t);
+const char *configSummarize(void);
 
 /* Command line function prototypes */
 rc_return_t clioptConstruct(void);
@@ -81,7 +82,6 @@
 
 /* Command line accessor prototypes */
 const char *clioptGetval(rc_opt_t);
-const char *clioptSummarize(void);
 
     /* Option function prototypes */
     /*FIXME rc_return_t optConstruct(rc_opt_t **);


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

--- rc_cliopt.c  2002/04/22 12:16:39     1.4
+++ rc_cliopt.c  2002/04/22 15:22:39     1.5
@@ -74,15 +74,6 @@
 }
 
 /***************************************
-* clioptSummarize(void)                *
-* Command line option summary          *
-***************************************/
-const char *clioptSummarize(void)
-{
-    return (NULL);
-}
-
-/***************************************
 * clioptProcess(int)                   *
 * Switch through available options     *
 * processing the corresponding option  *
@@ -93,95 +84,68 @@
     switch (cliOption) {
     /* Begin concrete (digital) options */
         case RC_USE_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Usage    */
-            break;
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Usage    */
         case RC_DBG_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Debug    */
-            break;
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Debug    */
         case RC_VER_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Version  */
-            break;
-        case RC_EVL_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Eval     */
-            break;
-        case RC_HLP_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Help     */
-            break;
-        case RC_INF_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Info     */
-            break;
-        case RC_LBL_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Label    */
-            break;
-        case RC_PRN_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Print    */
-            break;
-        case RC_SIL_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Silent   */
-            break;
-        case RC_RAW_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Raw      */
-            break;
-        case RC_VRB_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Verbose  */
-            break;
-        case RC_EXC_VAL:
-            m_szOptuples[cliOption] = strdup("1");  /* Exec     */
-            break;
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Version  */
+        case RC_EVL_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Eval     */
+        case RC_HLP_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Help     */
+        case RC_INF_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Info     */
+        case RC_LBL_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Label    */
+        case RC_PRN_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Print    */
+        case RC_SIL_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Silent   */
+        case RC_RAW_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Raw      */
+        case RC_VRB_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Verbose  */
+        case RC_EXC_VAL:                                   
+            m_szOptuples[cliOption] = strdup("1"); break;   /* Exec     */
+
     /* Begin abstract (nondigital) options */
         case RC_LOC_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Locations      */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Locations    */
         case RC_CNF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Conf file      */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Conf file    */
         case RC_FNC_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Func file      */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Func file    */
         case RC_QRY_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Format         */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Format       */
         case RC_TMP_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Temp dir       */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Temp dir     */
         case RC_OWN_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* User name      */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* User name    */
         case RC_GRP_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Group name     */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Group name   */
         case RC_MSK_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Umask          */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Umask        */
+
         case RC_ASS_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Assign regex   */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Assignregex  */
         case RC_DEF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Label regex    */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Labelregex   */
         case RC_REF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Ref regex      */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Refregex     */
         case RC_PRM_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Params regex   */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Paramregex   */
         case RC_TRM_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Terminal regex */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Termregex    */
+
         case RC_NCF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Config name    */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Configname   */
         case RC_CMN_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Common name    */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Commonname   */
         case RC_DFL_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Default name   */
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Defaultname  */
         case RC_ERR_VAL:
-            m_szOptuples[cliOption] = strdup(szArg);    /* Error name     */
-            break;
-        default :
-            break;
+            m_szOptuples[cliOption] = strdup(szArg); break; /* Errorname    */
+        default : break;
     }
 
     return(RC_THROW(RC_OK));
@@ -243,28 +207,35 @@
     popt_setotheroptionhelp(optCon, "[options] <rcfile> <sections [args]>");
 
     if (argc < 3) {
+        fprintf(stderr, "Please enter at least one rcfile and section.\n");
         popt_printusage(optCon, stderr, 0);
         return(RC_THROW(RC_ERR_USE));
     }
 
     /* Now do options processing */
-    while ((cliOpt = popt_getnextopt(optCon)) >= 0)
-    ex_try {
-        clioptProcess(cliOpt, popt_getoptarg(optCon));
-    }
-    ex_catch(Except) {
-        if ((rc_return_t)Except.ex_value != RC_ERR_USE)
-            fprintf(stderr, "Nonusage exception: %d\n",\
-                (rc_return_t)Except.ex_value);
-
-        fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\
-                (char *)Except.ex_class, *(int *)Except.ex_value,\
-                Except.ex_file, Except.ex_func, Except.ex_line);
+    while ((cliOpt = popt_getnextopt(optCon)) >= 0) { /* Loop, each time     */
+        ex_try {                                      /* eating a new option */
+            clioptProcess(cliOpt, popt_getoptarg(optCon));
+        }
+        ex_catch(Except) {
+            if ((rc_return_t)Except.ex_value == RC_ERR_USE) {
+                popt_printusage(optCon, stderr, 0);
+                rethrow;
+            }
+            else {  /* Some error condition probably deserves attention */
+                fprintf(stderr, "Class '%s' threw exception %d in %s:%s():\
+                    %d.\n", (char *)Except.ex_class, *(int *)Except.ex_value,\
+                    Except.ex_file, Except.ex_func, Except.ex_line);
+                rethrow;
+            }
+        }
     }
 
+    /* At this point we should be finished parsing options, so now we use  */
+    /* popt as a transport to read the user specified rcfile and sections. */
     szCLIBuf = (char *)popt_getarg(optCon);
     if ((szCLIBuf == NULL)) {
-        fprintf(stderr, "Please specify at least one rcfile and section.\n");
+        fprintf(stderr, "Please enter at least one rcfile and section.\n");
         popt_printusage(optCon, stderr, 0);
         return(RC_THROW(RC_ERR_USE));
     }
@@ -281,6 +252,7 @@
     popt_freecontext(optCon);
     return(RC_THROW(RC_OK));
 }
+
 /***************************************
 * clioptDestruct(void)                 *
 * Destruct a command line option       *


ossp-pkg/rc/rc_cliopt.h 1.1 -> 1.2



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

--- rc_config.c  2002/04/22 12:16:39     1.11
+++ rc_config.c  2002/04/22 15:22:39     1.12
@@ -29,11 +29,13 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "rc.h"
 #include "rc_const.h"               /* String constants                 */
 
 static int m_nLocks = 0;            /* Server locks, not thread-safe FIXME  */
+static char *m_szSummary = NULL;    /* Configuration summary storage        */
 
 
 /***************************************
@@ -109,6 +111,45 @@
     return(NULL);   /* Not reached  */
 }
 
+/***************************************
+* configSummarize(void)                *
+* Configuration summary                *
+***************************************/
+const char *configSummarize(void)
+{
+    ex_t Except;
+    int i = 0;
+    int bCaught = FALSE;
+
+    while (!bCaught) {
+        ex_try {    /* FIXME Not threadsafe, wrap with crit section */
+            if (configGetval(i)) { /* FIXME Is realloc portable here? */
+                /* FIXME Unportable kludge to ensure storage FIXME */
+                m_szSummary = realloc(m_szSummary, sizeof("OptionXXis") + \
+                    sizeof(configGetname(i)) + sizeof(configGetval(i) + 8));
+                if (!(strcmp(configGetval(i), "1"))) {
+                    strcat(m_szSummary, "Option ");
+                    strcat(m_szSummary, configGetname(i));
+                    strcat(m_szSummary, " is on.\n");
+                }
+                else {
+                    strcat(m_szSummary, "Option ");
+                    strcat(m_szSummary, configGetname(i));
+                    strcat(m_szSummary, " is ");
+                    strcat(m_szSummary, configGetval(i));
+                    strcat(m_szSummary, ".\n");
+                }
+            }
+        }           /* FIXME Not threadsafe, wrap with crit section */
+        ex_catch(Except) {  /* Breaks the otherwise endless loop above */
+            bCaught = TRUE;
+        }
+        i++;
+    }
+
+    return ((const char *)m_szSummary);
+}
+
 /************************************************
 * configLoad(int, char **)                      *
 * Load a configuration                          *
@@ -146,6 +187,8 @@
     if (--m_nLocks == 0) {          /* If m_nLocks is 0, deallocate */
         ex_try {                    /* FIXME, not thread-safe       */
             clioptDestruct();
+            if (m_szSummary)
+                free(m_szSummary);
         }
         ex_catch(Except) {
             rethrow;


ossp-pkg/rc/rc_opt.h 1.1 -> 1.2



ossp-pkg/rc/rc_optimpl.c 1.5 -> 1.6



ossp-pkg/rc/rc_option.c 1.5 -> 1.6



ossp-pkg/rc/rc_option.h 1.3 -> 1.4


CVSTrac 2.0.1