- * Manipulation routines for BREGEXP list
- *
- * Eric Bollengier, March 2007
- *
- * Version $Id$
- *
- */
-/*
- Bacula\81Â\81® - The Network Backup Solution
+ Bacula® - The Network Backup Solution
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Z\81Ã\81¼rich,
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zuerich,
- int rc = regexec(&preg, fname, RE_NREGS, regs, 0);
+ int rc = regexec(&preg, fname, BREG_NREGS, regs, 0);
success = true;
Dmsg2(500, "bregexp: len = %i, result_len = %i\n", len, strlen(result));
success = true;
Dmsg2(500, "bregexp: len = %i, result_len = %i\n", len, strlen(result));
Dmsg0(100, "bregexp: error in substitution\n");
return return_fname(fname, flen);
}
Dmsg0(100, "bregexp: error in substitution\n");
return return_fname(fname, flen);
}
for (p = psubst++; *p ; p = psubst++) {
/* match $1 \1 back references */
if ((*p == '$' || *p == '\\') && ('0' <= *psubst && *psubst <= '9')) {
for (p = psubst++; *p ; p = psubst++) {
/* match $1 \1 back references */
if ((*p == '$' || *p == '\\') && ('0' <= *psubst && *psubst <= '9')) {
for (p = psubst++; *p ; p = psubst++) {
/* match $1 \1 back references */
if ((*p == '$' || *p == '\\') && ('0' <= *psubst && *psubst <= '9')) {
for (p = psubst++; *p ; p = psubst++) {
/* match $1 \1 back references */
if ((*p == '$' || *p == '\\') && ('0' <= *psubst && *psubst <= '9')) {
- /* have a back reference ? */
- if (regs[no].rm_so >= 0 && regs[no].rm_eo >= 0) {
- len = regs[no].rm_eo - regs[no].rm_so;
- bstrncpy(result + i, fname + regs[no].rm_so, len + 1);
- i += len ;
- }
+ /* have a back reference ? */
+ if (regs[no].rm_so >= 0 && regs[no].rm_eo >= 0) {
+ len = regs[no].rm_eo - regs[no].rm_so;
+ bstrncpy(result + i, fname + regs[no].rm_so, len + 1);
+ i += len ;
+ }
-static char regexp_sep = '!';
-static char *str_strip_prefix = "!%s!!i";
-static char *str_add_prefix = "!^!%s!";
-static char *str_add_suffix = "!([^/])$!$1%s!";
+static const char regexp_sep = '!';
+static const char *str_strip_prefix = "!%s!!i";
+static const char *str_add_prefix = "!^!%s!";
+static const char *str_add_suffix = "!([^/])$!$1%s!";
- (add_prefix?strlen(add_prefix)+strlen(str_add_prefix) :0) +
- (add_suffix?strlen(add_suffix)+strlen(str_add_suffix) :0) )
+ (add_prefix?strlen(add_prefix)+strlen(str_add_prefix) :0) +
+ (add_suffix?strlen(add_suffix)+strlen(str_add_suffix) :0) )
if (strip_prefix) {
len += bsnprintf(dest, str_size - len, str_strip_prefix,
if (strip_prefix) {
len += bsnprintf(dest, str_size - len, str_strip_prefix,
}
if (add_suffix) {
if (len) dest[len++] = ',';
len += bsnprintf(dest + len, str_size - len, str_add_suffix,
}
if (add_suffix) {
if (len) dest[len++] = ',';
len += bsnprintf(dest + len, str_size - len, str_add_suffix,
}
if (add_prefix) {
if (len) dest[len++] = ',';
len += bsnprintf(dest + len, str_size - len, str_add_prefix,
}
if (add_prefix) {
if (len) dest[len++] = ',';
len += bsnprintf(dest + len, str_size - len, str_add_prefix,