OSSP CVS Repository

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

Check-in Number: 2092
Date: 2002-Apr-23 14:30:29 (local)
2002-Apr-23 12:30:29 (UTC)
User:ms
Branch:
Comment: Added OSSP str back to build configuration, and used it for output formatting. Added pieces of rc file and section command line parsing logic.
Tickets:
Inspections:
Files:
ossp-pkg/rc/Makefile.in      1.22 -> 1.23     1 inserted, 1 deleted
ossp-pkg/rc/configure.in      1.16 -> 1.17     11 inserted, 11 deleted
ossp-pkg/rc/devtool.conf      1.11 -> 1.12     6 inserted, 6 deleted
ossp-pkg/rc/rc.h      1.20 -> 1.21     2 inserted, 0 deleted
ossp-pkg/rc/rc_cliopt.c      1.5 -> 1.6     65 inserted, 37 deleted
ossp-pkg/rc/rc_config.c      1.12 -> 1.13     6 inserted, 13 deleted

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

--- Makefile.in  2002/04/22 12:16:39     1.22
+++ Makefile.in  2002/04/23 12:30:29     1.23
@@ -65,7 +65,7 @@
 OBJS            = rc.o rc_config.o rc_cliopt.o \
                   rc_version.o rc_pcre.o rc_util.o
 
-SUBDIRS         = @SUBDIR_EX@ @SUBDIR_POPT@
+SUBDIRS         = @SUBDIR_EX@ @SUBDIR_STR@ @SUBDIR_POPT@
 #SUBDIRS         = @SUBDIR_EX@ @SUBDIR_VAR@ @SUBDIR_VAL@ @SUBDIR_STR@ @SUBDIR_POPT@
 
 .SUFFIXES:


ossp-pkg/rc/configure.in 1.16 -> 1.17

--- configure.in 2002/04/08 15:37:10     1.16
+++ configure.in 2002/04/23 12:30:29     1.17
@@ -90,16 +90,16 @@
                  LIBS_EXTRA="$LIBS_EXTRA -lex"])
 AC_SUBST(SUBDIR_EX)
 
-#dnl Check for OSSP str library
-#AC_CHECK_EXTLIB([OSSP str],
-#                str, str_parse, str.h,
-#                [SUBDIR_STR=""],
-#                [SUBDIR_STR="rc_str"
-#                 CPPFLAGS="$CPPFLAGS -Irc_str"
-#                 CFLAGS="$CFLAGS -Irc_str"
-#                 LDFLAGS="$LDFLAGS -Lrc_str/.libs"
-#                 LIBS_EXTRA="$LIBS_EXTRA -lstr"])
-#AC_SUBST(SUBDIR_STR)
+dnl Check for OSSP str library
+AC_CHECK_EXTLIB([OSSP str],
+                str, str_parse, str.h,
+                [SUBDIR_STR=""],
+                [SUBDIR_STR="rc_str"
+                 CPPFLAGS="$CPPFLAGS -Irc_str"
+                 CFLAGS="$CFLAGS -Irc_str"
+                 LDFLAGS="$LDFLAGS -Lrc_str/.libs"
+                 LIBS_EXTRA="$LIBS_EXTRA -lstr"])
+AC_SUBST(SUBDIR_STR)
 
 #dnl Check for OSSP var library
 #AC_CHECK_EXTLIB([OSSP var],
@@ -131,7 +131,7 @@
 enable_headline=no
 export enable_headline
 dnl Call other configure scripts
-AC_CONFIG_SUBDIRS([$SUBDIR_EX $SUBDIR_POPT])
+AC_CONFIG_SUBDIRS([$SUBDIR_EX $SUBDIR_STR $SUBDIR_POPT])
 #AC_CONFIG_SUBDIRS([$SUBDIR_EX $SUBDIR_STR $SUBDIR_VAR $SUBDIR_VAL $SUBDIR_POPT])
 
 dnl Make all the necessary Makefiles


ossp-pkg/rc/devtool.conf 1.11 -> 1.12

--- devtool.conf 2002/04/08 15:37:10     1.11
+++ devtool.conf 2002/04/23 12:30:29     1.12
@@ -12,9 +12,9 @@
     echo "===> rc_popt (devtool autogen)"
     (cd rc_popt && ./devtool autogen)
     echo "<=== rc_popt"
-#    echo "===> rc_str (devtool autogen)"
-#    (cd rc_str && ./devtool autogen)
-#    echo "<=== rc_str"
+    echo "===> rc_str (devtool autogen)"
+    (cd rc_str && ./devtool autogen)
+    echo "<=== rc_str"
 #    echo "===> rc_var (devtool autogen)"
 #    (cd rc_var && ./devtool autogen)
 #    echo "<=== rc_var"
@@ -32,9 +32,9 @@
     echo "===> rc_popt (devtool autoclean)"
     (cd rc_popt && ./devtool autoclean)
     echo "<=== rc_popt"
-#    echo "===> rc_str (devtool autoclean)"
-#    (cd rc_str && ./devtool autoclean)
-#    echo "<=== rc_str"
+    echo "===> rc_str (devtool autoclean)"
+    (cd rc_str && ./devtool autoclean)
+    echo "<=== rc_str"
 #    echo "===> rc_var (devtool autoclean)"
 #    (cd rc_var && ./devtool autoclean)
 #    echo "<=== rc_var"


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

--- rc.h 2002/04/22 15:22:39     1.20
+++ rc.h 2002/04/23 12:30:29     1.21
@@ -82,6 +82,8 @@
 
 /* Command line accessor prototypes */
 const char *clioptGetval(rc_opt_t);
+const char *clioptGetrcfile(void);
+const char *clioptGetsec(void);
 
     /* Option function prototypes */
     /*FIXME rc_return_t optConstruct(rc_opt_t **);


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

--- rc_cliopt.c  2002/04/22 15:22:39     1.5
+++ rc_cliopt.c  2002/04/23 12:30:29     1.6
@@ -34,9 +34,11 @@
 #include "rc.h"
 #include "rc_const.h"
 #include "rc_config.h"
-#include "popt.h"       /* OSSP popt options library    */
+#include "popt.h"                       /* OSSP popt options library*/
 
-static char *m_szOptuples[RC_NUMOPTS];  /* Option name value tuples */
+static char *m_pszOptuples[RC_NUMOPTS]; /* Option name value tuples */
+static char *m_szRcfile = NULL;         /* rc file                  */
+static char *m_szSec   = NULL;          /* Section names            */
 
 
 /***************************************
@@ -55,7 +57,7 @@
 /*    s_pBintab->pOptlist->pvData = NULL;
     s_pBintab->pOptlist->pvNext = NULL;*/
 
-    memset(m_szOptuples, NULL, sizeof(m_szOptuples));
+    memset(m_pszOptuples, NULL, sizeof(m_pszOptuples));
 
 TRACE("cliopt constructed.\n");
     return(RC_THROW(RC_OK));
@@ -70,7 +72,25 @@
     if (!(Optname < RC_NUMOPTS))    /* Validate option range    */
         RC_THROW(RC_ERR_USE);
 
-    return((const char *)m_szOptuples[Optname]);
+    return((const char *)m_pszOptuples[Optname]);
+}
+
+/***************************************
+* clioptGetrcfile(void)                *
+* Command line rc file accessor        *
+***************************************/
+const char *clioptGetrcfile(void)
+{
+    return((const char *)m_szRcfile);
+}
+
+/***************************************
+* clioptGetsec(void)                   *
+* Command line section accessor        *
+***************************************/
+const char *clioptGetsec(void)
+{
+    return((const char *)m_szSec);
 }
 
 /***************************************
@@ -84,67 +104,68 @@
     switch (cliOption) {
     /* Begin concrete (digital) options */
         case RC_USE_VAL:
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Usage    */
+            m_pszOptuples[cliOption] = strdup("1");          /* Usage    */
+            return(RC_THROW(RC_ERR_USE));
         case RC_DBG_VAL:
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Debug    */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Debug    */
         case RC_VER_VAL:
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Version  */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Version  */
         case RC_EVL_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Eval     */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Eval     */
         case RC_HLP_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Help     */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Help     */
         case RC_INF_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Info     */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Info     */
         case RC_LBL_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Label    */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Label    */
         case RC_PRN_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Print    */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Print    */
         case RC_SIL_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Silent   */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Silent   */
         case RC_RAW_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Raw      */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Raw      */
         case RC_VRB_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Verbose  */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Verbose  */
         case RC_EXC_VAL:                                   
-            m_szOptuples[cliOption] = strdup("1"); break;   /* Exec     */
+            m_pszOptuples[cliOption] = strdup("1"); break;   /* Exec     */
 
     /* Begin abstract (nondigital) options */
         case RC_LOC_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Locations    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Locations    */
         case RC_CNF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Conf file    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Conf file    */
         case RC_FNC_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Func file    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Func file    */
         case RC_QRY_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Format       */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Format       */
         case RC_TMP_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Temp dir     */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Temp dir     */
         case RC_OWN_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* User name    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* User name    */
         case RC_GRP_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Group name   */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Group name   */
         case RC_MSK_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Umask        */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Umask        */
 
         case RC_ASS_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Assignregex  */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Assignregex  */
         case RC_DEF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Labelregex   */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Labelregex   */
         case RC_REF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Refregex     */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Refregex     */
         case RC_PRM_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Paramregex   */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Paramregex   */
         case RC_TRM_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Termregex    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Termregex    */
 
         case RC_NCF_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Configname   */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Configname   */
         case RC_CMN_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Commonname   */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Commonname   */
         case RC_DFL_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Defaultname  */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Defaultname  */
         case RC_ERR_VAL:
-            m_szOptuples[cliOption] = strdup(szArg); break; /* Errorname    */
+            m_pszOptuples[cliOption] = strdup(szArg); break; /* Errorname    */
         default : break;
     }
 
@@ -274,14 +295,21 @@
         rethrow;
     }*/
 
-    for (i = 0; i < RC_NUMOPTS; i++)                      /* Free the tuple */
-        m_szOptuples[i] ? free(m_szOptuples[i]) : RC_NOP; /* or do nothing  */
+    for (i = 0; i < RC_NUMOPTS; i++) {  /* Free the tuples themselves */
+        if (m_pszOptuples[i]) {
+            free(m_pszOptuples[i]);
+            m_pszOptuples[i] = NULL;
+        }
+    }
 
-    memset(m_szOptuples, NULL, sizeof(m_szOptuples));     /* Clear tuples   */
+    if (m_szRcfile)                     /* Free the rc file arg       */
+        free(m_szRcfile);
+    if (m_szSec)                        /* Free the section name arg  */
+        free(m_szSec);
 
 /* FIXME BEGIN DEBUG */
 for (i = 0; i < RC_NUMOPTS; i++)
-    if (m_szOptuples[i])
+    if (m_pszOptuples[i])
         TRACE("Problem! Destructor failed!\n");
 TRACE("cliopt destructed.\n");
 /* FIXME END DEBUG */


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

--- rc_config.c  2002/04/22 15:22:39     1.12
+++ rc_config.c  2002/04/23 12:30:29     1.13
@@ -32,7 +32,8 @@
 #include <string.h>
 
 #include "rc.h"
-#include "rc_const.h"               /* String constants                 */
+#include "str.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        */
@@ -127,18 +128,10 @@
                 /* 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");
-                }
+                if (!(strcmp(configGetval(i), "1")))
+                    str_concat(m_szSummary, "Option ", configGetname(i), " is on.\n");
+                else
+                    str_concat(m_szSummary, "Option ", configGetname(i), " is ", configGetval(i), ".\n");
             }
         }           /* FIXME Not threadsafe, wrap with crit section */
         ex_catch(Except) {  /* Breaks the otherwise endless loop above */

CVSTrac 2.0.1