From: Eric Bollengier Date: Sun, 22 Apr 2007 19:49:30 +0000 (+0000) Subject: ebl use regexwhere instead of rwhere X-Git-Tag: Release-7.0.0~6528 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c79d06d8304233a175e63093d2fb8f4903b7ff2d;p=bacula%2Fbacula ebl use regexwhere instead of rwhere git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4600 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/breg.c b/bacula/patches/testing/breg.c index 8c53e6a93b..6c9a4ef560 100644 --- a/bacula/patches/testing/breg.c +++ b/bacula/patches/testing/breg.c @@ -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, ®s); +#else int rc = re_search(&preg, (BREGEX_CAST char*) fname, flen, 0, flen, ®s); +#endif if (rc < 0) { Dmsg0(500, "bregexp: regex mismatch\n"); diff --git a/bacula/patches/testing/breg.h b/bacula/patches/testing/breg.h index 9c1e50a8c7..fa639f17a8 100644 --- a/bacula/patches/testing/breg.h +++ b/bacula/patches/testing/breg.h @@ -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 */ diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 022dff20ef..f5feb2ba4e 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -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)); diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index cb6eed17cd..e3c5b50290 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -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 */ diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 3c2579a966..74154c3b6a 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -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 }; diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 914b826617..eb776e428f 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -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(), diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index eb0af2470f..096f587a1e 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -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";