#include "bacula.h"
#include "dird.h"
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
/* Forward referenced subroutines */
{"no", INC_KW_KEEPATIME, "0"},
{"yes", INC_KW_EXCLUDE, "e"},
{"no", INC_KW_EXCLUDE, "0"},
- {"yes", INC_KW_ACL, "A"},
- {"no", INC_KW_ACL, "0"},
- {NULL, 0, 0}
+ {"yes", INC_KW_ACL, "A"},
+ {"no", INC_KW_ACL, "0"},
+ {NULL, 0, 0}
};
/* Store regex info */
static void store_regex(LEX *lc, RES_ITEM *item, int index, int pass)
{
- int token;
+ int token, rc;
+ regex_t preg;
+ char prbuf[500];
if (pass == 1) {
/* Pickup regex string
case T_IDENTIFIER:
case T_UNQUOTED_STRING:
case T_QUOTED_STRING:
+ rc = regcomp(&preg, lc->str, REG_EXTENDED);
+ if (rc != 0) {
+ regerror(rc, &preg, prbuf, sizeof(prbuf));
+ regfree(&preg);
+ scan_err1(lc, _("Regex compile error. ERR=%s\n"), prbuf);
+ break;
+ }
+ regfree(&preg);
res_incexe.current_opts->regex.append(bstrdup(lc->str));
Dmsg3(900, "set regex %p size=%d %s\n",
res_incexe.current_opts, res_incexe.current_opts->regex.size(),lc->str);