ossp-pkg/rc/rc_script.c 1.3 -> 1.4
--- 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 <stdlib.h>
#include <string.h>
-#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);
|
|