--- rc_config.c 2002/04/25 09:51:29 1.15
+++ rc_config.c 2002/05/22 13:29:40 1.16
@@ -48,22 +48,14 @@
void configDebug(void)
{
int i = 0;
- ex_t Except;
- char *szTemp = NULL;
+ char **szTemp = NULL;
fprintf(stderr, "Run command file: %s\n", configGetrcfile());
- szTemp = (char *)configGetsec(i);
+ szTemp = (char **)configGetsecs();
fprintf(stderr, "Sections:");
- while (szTemp) {
- fprintf(stderr, " %s", szTemp);
- ex_try {
- szTemp = (char *)configGetsec(++i);
- }
- ex_catch(Except) {
- break;
- }
- }
+ while (szTemp[i])
+ fprintf(stderr, " %s", szTemp[i++]);
fprintf(stderr, "\n%s", configSummarize());
}
@@ -151,7 +143,7 @@
/* (2) it must be specified on the command line, */
/* we don't bother checking the environment or conf file */
/* contrary to the behaviour of Getval earlier */
- return (clioptGetrcfile());
+ return(clioptGetrcfile());
}
ex_catch(Except) {
rethrow;
@@ -160,22 +152,17 @@
else {
RC_THROW(RC_ERR_USE);
}
+
return(NULL); /* Not reached */
}
-const char *configGetsec(int nIndex)
+const char **configGetsecs(void)
{
ex_t Except;
- char **pszSectemp = NULL;
- if (m_nLocks && nIndex < clioptGetseclen()) {/* Make sure config exists */
- ex_try { /* FIXME Might need to check */
- pszSectemp = (char **)clioptGetsec();/* FIXME env, conf, configs */
- if (pszSectemp[nIndex])
- return(pszSectemp[nIndex]);
- else {
- RC_THROW(RC_ERR_USE);
- }
+ if (m_nLocks) { /* Make sure config exists */
+ ex_try { /* FIXME Might need to check */
+ return(clioptGetsecs()); /* FIXME env, conf, configs */
}
ex_catch(Except) {
rethrow;
@@ -184,6 +171,7 @@
else {
RC_THROW(RC_ERR_USE);
}
+
return(NULL); /* Not reached */
}
@@ -234,17 +222,16 @@
}
/************************************************
-* configLoad(int, char **) *
+* configLoad(int, const char **) *
* Load a configuration *
************************************************/
-rc_return_t configLoad(int argc, char *argv[])
+rc_return_t configLoad(int nTotal, const char *szArgvec[])
{
ex_t Except;
- ex_try { /* Parse option groups in order of priority */
- clioptParseopt(argc, argv); /* Command line options */
- clioptParserc(); /* Command line rc file */
- clioptParsesec(); /* Command line sections */
+ ex_try { /* Parse option groups in order of priority */
+ clioptParseopts(nTotal, szArgvec); /* Command line options */
+ clioptParseargs(); /* Command line args */
/* envoptParse(m_nLocks->pOpt);*/ /* Environment options */
/* cnfoptParse(m_nLocks->pOpt);*/ /* Configfile options */
}
|