]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl use regexwhere instead of rwhere
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 22 Apr 2007 19:49:30 +0000 (19:49 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 22 Apr 2007 19:49:30 +0000 (19:49 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4600 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/testing/breg.c
bacula/patches/testing/breg.h
bacula/src/dird/dird_conf.c
bacula/src/dird/restore.c
bacula/src/dird/ua_restore.c
bacula/src/dird/ua_run.c
bacula/src/filed/job.c

index 8c53e6a93baec6b03c9cc7e033d885894993277a..6c9a4ef560a04093f24c54c7043d3fee1ae31765 100644 (file)
@@ -245,7 +245,17 @@ char *BREGEXP::replace(const char *fname)
 {
    success = false;            /* use this.success to known if it's ok */
    int flen = strlen(fname);
+#ifndef HAVE_REGEX_H
+   int i;
+   check_pool_memory_size(lcase, flen);
+   for(i=0; fname[i] ; i++) {
+      lcase[i] = tolower(fname[i]);
+   }
+   lcase[i] = '\0';
+   int rc = re_search(&preg, (BREGEX_CAST char*) lcase, flen, 0, flen, &regs);
+#else
    int rc = re_search(&preg, (BREGEX_CAST char*) fname, flen, 0, flen, &regs);
+#endif
 
    if (rc < 0) {
       Dmsg0(500, "bregexp: regex mismatch\n");
index 9c1e50a8c7d6c0dbc4dbafa7cf3f5ecabc817090..fa639f17a879e8a6c9dd89ea7ca2fcff63cd8301 100644 (file)
@@ -68,6 +68,7 @@ public:
    /* private */
    POOLMEM *expr;              /* search epression */
    POOLMEM *subst;             /* substitution */
+   POOLMEM *lcase;             /* fname in lower case when using bregexp.c */
    regex_t preg;               /* regex_t result of regcomp() */
    struct re_registers regs;   /* contains match */
    char *eor;                  /* end of regexp in expr */
index 022dff20ef79134148f2de507e4b0cecb4e40741..f5feb2ba4e84c2642f2fd58964188e40b9772113 100644 (file)
@@ -616,10 +616,11 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          dump_resource(-R_SCHEDULE, (RES *)res->res_job.schedule, sendit, sock);
       }
       if (res->res_job.RestoreWhere) {
-         sendit(sock, _("  --> Where=%s\n"), NPRT(res->res_job.RestoreWhere));
-      }
-      if (res->res_job.where_use_regexp) {
-         sendit(sock, _("  --> RWhere=%u\n"), res->res_job.where_use_regexp);
+        if (res->res_job.where_use_regexp) {
+           sendit(sock, _("  --> RegexWhere=%s\n"), NPRT(res->res_job.RestoreWhere));
+        } else {
+           sendit(sock, _("  --> Where=%s\n"), NPRT(res->res_job.RestoreWhere));
+        }
       }
       if (res->res_job.RestoreBootstrap) {
          sendit(sock, _("  --> Bootstrap=%s\n"), NPRT(res->res_job.RestoreBootstrap));
index cb6eed17cd970822a2fe4a24d141298a14bdcf8d..e3c5b5029020143abeaeab908badddcee6ba728c 100644 (file)
@@ -51,7 +51,7 @@
 
 /* Commands sent to File daemon */
 static char restorecmd[]        = "restore replace=%c prelinks=%d where=%s\n";
-static char restorecmdR[] = "restore replace=%c prelinks=%d rwhere=%s\n";
+static char restorecmdR[] = "restore replace=%c prelinks=%d regexwhere=%s\n";
 static char storaddr[]   = "storage address=%s port=%d ssl=0\n";
 
 /* Responses received from File daemon */
index 3c2579a966c1a1c21911f4fba4fdd05738fa74f8..74154c3b6a34679a0419f0bf798f7e1d6f607b29 100644 (file)
@@ -118,7 +118,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
       where_use_regexp = true;
    }
 
-   i = find_arg_with_value(ua, "rwhere");
+   i = find_arg_with_value(ua, "regexwhere");
    if (i >= 0) {
       where_use_regexp = true;
       rx.where = ua->argv[i];
@@ -239,7 +239,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
           " %swhere=\"%s\" files=%d catalog=\"%s\"",
           job->name(), rx.ClientName, rx.store?rx.store->name():"",
           escaped_bsr_name ? escaped_bsr_name : jcr->RestoreBootstrap,
-          where_use_regexp ? "r" : "",
+          where_use_regexp ? "regex" : "",
           escaped_where_name ? escaped_where_name : rx.where,
           rx.selected_files, ua->catalog->name());
    } else {
@@ -404,7 +404,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
       "add_prefix",   /* 16 */
       "add_suffix",   /* 17 */
       "where_use_regexp",/* 18 */
-      "rwhere",       /* 19 like where + where_use_regexp */
+      "regexwhere",   /* 19 like where + where_use_regexp */
       NULL
    };
 
index 914b82661701f458220ae41f661ab89d251888a0..eb776e428f1b9dad2d81bd5ab67017586f9fa00a 100644 (file)
@@ -89,7 +89,7 @@ int run_cmd(UAContext *ua, const char *cmd)
       "level",                        /* 5 */
       "storage",                      /* 6 */
       "sd",                           /* 7 */
-      "rwhere",                       /* 8 where string as a bregexp */
+      "regexwhere",                   /* 8 where string as a bregexp */
       "where",                        /* 9 */
       "bootstrap",                    /* 10 */
       "replace",                      /* 11 */
@@ -191,10 +191,10 @@ int run_cmd(UAContext *ua, const char *cmd)
                store_name = ua->argv[i];
                kw_ok = true;
                break;
-            case 8: /* rwhere */
+            case 8: /* regexwhere */
             case 9: /* where */
                /* TODO: this is ugly ... */
-               where_use_regexp = (j == 9)?false:true; /* rwhere or where ? */
+               where_use_regexp = (j == 9)?false:true;/*regexwhere or where ?*/
 
                if (where) {
                   ua->send_msg(_("Where specified twice.\n"));
@@ -848,7 +848,7 @@ try_again_reg:
       
       if (rwhere && rwhere[0] != '\0') {
         regs = get_bregexps(rwhere);
-        ua->send_msg(_("rwhere=%s\n"), NPRT(rwhere));
+        ua->send_msg(_("regexwhere=%s\n"), NPRT(rwhere));
       } else {
         int len = bregexp_get_build_where_size(strip_prefix, add_prefix, add_suffix);
         regexp = (char *) bmalloc (len * sizeof(char));
@@ -1079,7 +1079,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *veri
          ua->send_msg(_("Run Restore job\n"
                         "JobName:    %s\n"
                         "Bootstrap:  %s\n"
-                        "%s     %s\n"             /* Where or RWhere */
+                        "%s %s\n"             /* Where or RegexWhere */
                         "Replace:    %s\n"
                         "FileSet:    %s\n"
                         "Client:     %s\n"
@@ -1089,7 +1089,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *veri
                         "Priority:   %d\n"),
               job->name(),
               NPRT(jcr->RestoreBootstrap),
-              jcr->where_use_regexp?"RWhere:":"Where: ",
+              jcr->where_use_regexp?"RegexWhere:":"Where:     ",
               jcr->where?jcr->where:NPRT(job->RestoreWhere),
               replace,
               jcr->fileset->name(),
@@ -1103,7 +1103,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *veri
          ua->send_msg(_("Run Restore job\n"
                        "JobName:    %s\n"
                        "Bootstrap:  %s\n"
-                       "%s     %s\n"              /* Where or RWhere */
+                       "%s %s\n"             /* Where or RegexWhere */
                        "Replace:    %s\n"
                        "Client:     %s\n"
                        "Storage:    %s\n"
@@ -1113,7 +1113,7 @@ static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *veri
                        "Priority:   %d\n"),
               job->name(),
               NPRT(jcr->RestoreBootstrap),
-              jcr->where_use_regexp?"RWhere:":"Where: ",
+              jcr->where_use_regexp?"RegexWhere:":"Where:     ",
               jcr->where?jcr->where:NPRT(job->RestoreWhere),
               replace,
               jcr->client->name(),
index eb0af2470fba1f1aeeb31f4cf113c0a24d0169f3..096f587a1e47e3d2c2eedb11eea86000fe33f585 100644 (file)
@@ -115,7 +115,7 @@ static char storaddr[]    = "storage address=%s port=%d ssl=%d";
 static char sessioncmd[]  = "session %127s %ld %ld %ld %ld %ld %ld\n";
 static char restorecmd[]  = "restore replace=%c prelinks=%d where=%s\n";
 static char restorecmd1[] = "restore replace=%c prelinks=%d where=\n";
-static char restorecmdR[] = "restore replace=%c prelinks=%d rwhere=%s\n";
+static char restorecmdR[] = "restore replace=%c prelinks=%d regexwhere=%s\n";
 static char verifycmd[]   = "verify level=%30s";
 static char estimatecmd[] = "estimate listing=%d";
 static char runbefore[]   = "RunBeforeJob %s";