From: Eric Bollengier Date: Tue, 24 Apr 2007 16:56:21 +0000 (+0000) Subject: ebl use RegexWhere instead of where_use_regexp in job conf X-Git-Tag: Release-7.0.0~6509 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=20fe9d1a9dc20db25320f125b813e557b4e1f7ef;p=bacula%2Fbacula ebl use RegexWhere instead of where_use_regexp in job conf git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4619 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index f5feb2ba4e..c1b81bca15 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -271,7 +271,7 @@ RES_ITEM job_items[] = { {"run", store_alist_str, ITEM(res_job.run_cmds), 0, 0, 0}, /* Root of where to restore files */ {"where", store_dir, ITEM(res_job.RestoreWhere), 0, 0, 0}, - {"whereuseregexp", store_bool, ITEM(res_job.where_use_regexp), 0, 0, 0}, + {"regexwhere", store_str, ITEM(res_job.RegexWhere), 0, 0, 0}, {"stripprefix", store_str, ITEM(res_job.strip_prefix), 0, 0, 0}, {"addprefix", store_str, ITEM(res_job.add_prefix), 0, 0, 0}, {"addsuffix", store_str, ITEM(res_job.add_suffix), 0, 0, 0}, @@ -1154,6 +1154,9 @@ void free_resource(RES *sres, int type) if (res->res_job.RestoreWhere) { free(res->res_job.RestoreWhere); } + if (res->res_job.RegexWhere) { + free(res->res_job.RegexWhere); + } if (res->res_job.strip_prefix) { free(res->res_job.strip_prefix); } @@ -1319,6 +1322,7 @@ void save_resource(int type, RES_ITEM *items, int pass) res->res_job.jobdefs = res_all.res_job.jobdefs; res->res_job.run_cmds = res_all.res_job.run_cmds; res->res_job.RunScripts = res_all.res_job.RunScripts; + if (res->res_job.strip_prefix || res->res_job.add_suffix || res->res_job.add_prefix) @@ -1338,6 +1342,15 @@ void save_resource(int type, RES_ITEM *items, int pass) /* TODO: test bregexp */ } + + if (res->res_job.RegexWhere) { + if (res->res_job.RestoreWhere) { + free(res->res_job.RestoreWhere); + } + res->res_job.RestoreWhere = bstrdup(res->res_job.RegexWhere); + res->res_job.where_use_regexp = true; + } + break; case R_COUNTER: if ((res = (URES *)GetResWithName(R_COUNTER, res_all.res_counter.hdr.name)) == NULL) { diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index 2ba9f5afcc..1719b1b527 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -359,6 +359,7 @@ public: int Priority; /* Job priority */ int RestoreJobId; /* What -- JobId to restore */ char *RestoreWhere; /* Where on disk to restore -- directory */ + char *RegexWhere; /* RegexWhere option */ char *strip_prefix; /* remove prefix from filename */ char *add_prefix; /* add prefix to filename */ char *add_suffix; /* add suffix to filename -- .old */