Index: ossp-pkg/rc/rc_proc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v' 2>/dev/null --- rc_proc.c 2002/07/01 15:03:33 1.10 +++ rc_proc.c 2002/07/02 18:03:17 1.11 @@ -77,6 +77,8 @@ int nFdfunc = 0; int nRet = 0; int nIter = 0; + ex_t Except; + char *sBuf = NULL; char *szSec = NULL; char *szLocex = NULL; @@ -126,20 +128,26 @@ if (nRet == -1) /* Handle read errors */ RC_THROW(RC_ERR_IO); - for (i = 0; pRc->m_pAnal->m_pszSecs[i]; i++) { /* Iterate over secvec */ - /* Extract a section from the temp script, and append it */ - szSec = scriptSection(pTempscript, pRc->m_pAnal->m_pszSecs[i]); - - if (szSec) /* Only call append if the section lookup succeeded */ - scriptAppend(pRc->m_pScript, szSec, strlen(szSec)); - else if (configGetval(RC_DBG_VAL)) /* Only show when debug is set */ - fprintf(stderr, "#Warning: Missing section '%s' in %s!\n", pRc->m_pAnal->m_pszSecs[i], pRc->m_pAnal->m_szRcs[nIter]); - - if (szSec) { /* Cleanup section string */ - free(szSec); - szSec = NULL; + try { + for (i = 0; pRc->m_pAnal->m_pszSecs[i]; i++) { /* Iterate over */ + /* Extract a section from the temp script, and append it */ + szSec = scriptSection(pTempscript, pRc->m_pAnal->m_pszSecs[i]); + + if (szSec) /* Only call append if the section lookup succeeds */ + scriptAppend(pRc->m_pScript, szSec, strlen(szSec)); + else if (configGetval(RC_DBG_VAL)) /* Only show if debug set */ + fprintf(stderr, "#Warning: Missing section '%s' in %s!\n",\ + pRc->m_pAnal->m_pszSecs[i],\ + pRc->m_pAnal->m_szRcs[nIter]); + + if (szSec) { /* Cleanup section string */ + free(szSec); + szSec = NULL; + } } } + catch(Except) + rethrow; /* Clean up our crap */ scriptDelete(pTempscript); /* Temp script */ Index: ossp-pkg/rc/rc_script.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_script.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/rc/rc_script.c,v' 2>/dev/null --- rc_script.c 2002/06/28 17:43:23 1.3 +++ rc_script.c 2002/07/02 18:03:17 1.4 @@ -30,7 +30,9 @@ #include #include -#include "rc.h" +#include "rc.h" /* Public Rc interface */ +#include "rc_pcre.h" /* For section parsing */ +#include "rc_config.h" /* For configuration access */ /************************************************ @@ -100,12 +102,27 @@ ************************************************/ char *scriptSection(rc_script_t *pScript, const char *kszSecname) { - char *szTempout = NULL; - char *szTmpsec = NULL; - char *piStart = NULL; - char *piEnd = NULL; + char *szTempout = NULL; + char *szTmpsec = NULL; + char *piStart = NULL; + char *piEnd = NULL; + int nOffset = 0; + const int kiRegopt = 0; + const char *szErr = NULL; + + pcre *pRegex = NULL; /* Perl Compatible Regular Expression */ + pcre_extra *pExtra = NULL; /* Used for studying an expression */ + + assert(pScript); /* Check for a valid incoming script */ + assert(configGetval(RC_DEF_VAL)); + + if (!kszSecname) /* If we get a NULL section label, give a NULL result */ + return (NULL); /* This might be useful in some loop constructs */ + + if ((pRegex = pcre_compile(configGetval(RC_DEF_VAL), kiRegopt, &szErr, &nOffset, NULL)) == NULL) { + RC_THROW(RC_ERR_SYS); + } - assert(pScript); /* Check for a valid incoming script */ szTmpsec = malloc(strlen(kszSecname) + sizeof(char)); strcpy(szTmpsec, "%"); strcat(szTmpsec, kszSecname);