src/filed/job.c
int add_regex_to_fileset(JCR *jcr, const char *item, int type)
{
   findFOPTS *current_opts = start_options(jcr->ff);
   regex_t *preg;
   int rc;
   char prbuf[500];

   preg = (regex_t *)malloc(sizeof(regex_t));
   if (current_opts->flags & FO_IGNORECASE) {
      rc = regcomp(preg, item, REG_EXTENDED|REG_ICASE);
   } else {
      rc = regcomp(preg, item, REG_EXTENDED);
   }
   if (rc != 0) {
      regerror(rc, preg, prbuf, sizeof(prbuf));
      regfree(preg);
      free(preg);
      Jmsg(jcr, M_FATAL, 0, _("REGEX %s compile error. ERR=%s\n"), item, prbuf);
      return state_error;
   }
   if (type == ' ') {
      current_opts->regex.append(preg);
   } else if (type == 'D') {
      current_opts->regexdir.append(preg);
   } else if (type == 'F') {
      current_opts->regexfile.append(preg);
   } else {
      return state_error;
   }
   return state_options;
}
/**
 * Add a regex to the current fileset
 */
Add a regex to the current fileset
Add a regex to the current fileset
int add_regex_to_fileset(JCR *jcr, const char *item, int type)
{
   findFOPTS *current_opts = start_options(jcr->ff);
   regex_t *preg;
   int rc;
   char prbuf[500];
   preg = (regex_t *)malloc(sizeof(regex_t));
   if (current_opts->flags & FO_IGNORECASE) {
      rc = regcomp(preg, item, REG_EXTENDED|REG_ICASE);
   } else {
      rc = regcomp(preg, item, REG_EXTENDED);
   }
   if (rc != 0) {
      regerror(rc, preg, prbuf, sizeof(prbuf));
      regfree(preg);
      free(preg);
      Jmsg(jcr, M_FATAL, 0, _("REGEX %s compile error. ERR=%s\n"), item, prbuf);
      return state_error;
   }
   if (type == ' ') {
      current_opts->regex.append(preg);
   } else if (type == 'D') {
      current_opts->regexdir.append(preg);
   } else if (type == 'F') {
      current_opts->regexfile.append(preg);
   } else {
      return state_error;
   }
   return state_options;
}
int add_regex_to_fileset ( JCR * jcr , const char * item , int type ) { findFOPTS * current_opts = start_options ( jcr -> ff ) ; regex_t * preg ; int rc ; char prbuf [ 500 ] ; preg = ( regex_t * ) malloc ( sizeof ( regex_t ) ) ; if ( current_opts -> flags & FO_IGNORECASE ) { rc = regcomp ( preg , item , REG_EXTENDED | REG_ICASE ) ; } else { rc = regcomp ( preg , item , REG_EXTENDED ) ; } if ( rc != 0 ) { regerror ( rc , preg , prbuf , sizeof ( prbuf ) ) ; regfree ( preg ) ; free ( preg ) ; Jmsg ( jcr , M_FATAL , 0 , _ ( " \n " ) , item , prbuf ) ; return state_error ; } if ( type == ' ' ) { current_opts -> regex . append ( preg ) ; } else if ( type == ' ' ) { current_opts -> regexdir . append ( preg ) ; } else if ( type == ' ' ) { current_opts -> regexfile . append ( preg ) ; } else { return state_error ; } return state_options ; }
Add a regex to the current fileset
Add a regex to the current fileset