--- rc_config.c 2002/04/11 16:52:45 1.9
+++ rc_config.c 2002/04/12 19:15:12 1.10
@@ -33,7 +33,7 @@
#include "rc.h"
#include "rc_const.h" /* String constants */
-static int s_nLocks = 0; /* Server locks, not thread-safe FIXME */
+static int m_nLocks = 0; /* Server locks, not thread-safe FIXME */
/***************************************
@@ -44,7 +44,7 @@
{
ex_t Except;
- if (s_nLocks == 0) { /* If we don't have one yet */
+ if (m_nLocks == 0) { /* If we don't have one yet */
ex_try { /* then construct a new one */
clioptConstruct(); /* Member cliopt instance */
}
@@ -52,21 +52,21 @@
rethrow;
}
}
- s_nLocks++; /* FIXME not threadsafe */
+ m_nLocks++; /* FIXME not threadsafe */
return(RC_THROW(RC_OK));
}
/***************************************
-* configGetoptval(rc_opt_t) *
+* configGetXXX(rc_opt_t) *
* Configuration accessors *
***************************************/
-const char *configGetoptval(rc_opt_t Optname)
+const char *configGetval(rc_opt_t Optname)
{
ex_t Except;
char *szTemp = NULL;
- if (s_nLocks) { /* Make sure config exists */
+ if (m_nLocks) { /* Make sure config exists */
ex_try {
if ((szTemp = (char *)clioptGetval(Optname)))
return((const char *)szTemp);
@@ -87,6 +87,28 @@
return(NULL); /* Not reached */
}
+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
+ };
+
+ if (m_nLocks) { /* Make sure config exists */
+ return((const char *)s_szOptnametab[Optname]);
+ }
+ else {
+ RC_THROW(RC_ERR_USE);
+ }
+ return(NULL); /* Not reached */
+}
+
/************************************************
* configLoad(int, char **) *
* Load a configuration *
@@ -97,8 +119,8 @@
ex_try { /* Parse option groups in order of priority */
clioptParse(argc, argv); /* Command line options */
-/* envoptParse(s_nLocks->pOpt);*/ /* Environment options */
-/* cnfoptParse(s_nLocks->pOpt);*/ /* Configfile options */
+/* envoptParse(m_nLocks->pOpt);*/ /* Environment options */
+/* cnfoptParse(m_nLocks->pOpt);*/ /* Configfile options */
}
ex_catch(Except) {
rethrow;
@@ -121,7 +143,7 @@
{
ex_t Except;
- if (--s_nLocks == 0) { /* If m_nLocks is 0, deallocate */
+ if (--m_nLocks == 0) { /* If m_nLocks is 0, deallocate */
ex_try { /* FIXME, not thread-safe */
clioptDestruct();
}
|