* Version $Id$
*/
/*
- Copyright (C) 2003-2006 Kern Sibbald
+ Bacula® - The Network Backup Solution
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as amended with additional clauses defined in the
- file LICENSE in the main source directory.
+ Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- the file LICENSE for additional details.
+ 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
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
- */
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
#include "bacula.h"
#include "dird.h"
#ifndef HAVE_REGEX_H
-#include "lib/regex.h"
+#include "lib/bregex.h"
#else
#include <regex.h>
#endif
static void store_regex(LEX *lc, RES_ITEM *item, int index, int pass);
static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
static void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass);
static void options_res(LEX *lc, RES_ITEM *item, int index, int pass);
* then move it to allocated memory when the resource
* scan is complete.
*/
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+ extern URES res_all;
+}
+#else
extern URES res_all;
+#endif
extern int res_all_size;
/* We build the current new Include and Exclude items here */
{"fstype", store_fstype, {0}, 0, 0, 0},
{"hfsplussupport", store_opts, {0}, 0, 0, 0},
{"noatime", store_opts, {0}, 0, 0, 0},
+ {"enhancedwild", store_opts, {0}, 0, 0, 0},
+ {"drivetype", store_drivetype, {0}, 0, 0, 0},
{NULL, NULL, {0}, 0, 0, 0}
};
INC_KW_ACL,
INC_KW_IGNORECASE,
INC_KW_HFSPLUS,
- INC_KW_NOATIME
+ INC_KW_NOATIME,
+ INC_KW_ENHANCEDWILD
};
/*
{"ignorecase", INC_KW_IGNORECASE},
{"hfsplussupport", INC_KW_HFSPLUS},
{"noatime", INC_KW_NOATIME},
+ {"enhancedwild", INC_KW_ENHANCEDWILD},
{NULL, 0}
};
{"no", INC_KW_HFSPLUS, "0"},
{"yes", INC_KW_NOATIME, "K"},
{"no", INC_KW_NOATIME, "0"},
+ {"yes", INC_KW_ENHANCEDWILD, "K"},
+ {"no", INC_KW_ENHANCEDWILD, "0"},
{NULL, 0, 0}
};
*/
} else {
for (i=0; FS_options[i].name; i++) {
- if (strcasecmp(lc->str, FS_options[i].name) == 0 && FS_options[i].keyword == keyword) {
+ if (FS_options[i].keyword == keyword && strcasecmp(lc->str, FS_options[i].name) == 0) {
/* NOTE! maximum 2 letters here or increase option[3] */
option[0] = FS_options[i].option[0];
option[1] = FS_options[i].option[1];
res_incexe.current_opts->wilddir.append(bstrdup(lc->str));
newsize = res_incexe.current_opts->wilddir.size();
} else if (item->code == 2) {
- type = "wildfile";
- res_incexe.current_opts->wildfile.append(bstrdup(lc->str));
- newsize = res_incexe.current_opts->wildfile.size();
+ if (strpbrk(lc->str, "/\\") != NULL) {
+ type = "wildfile";
+ res_incexe.current_opts->wildfile.append(bstrdup(lc->str));
+ newsize = res_incexe.current_opts->wildfile.size();
+ } else {
+ type = "wildbase";
+ res_incexe.current_opts->wildbase.append(bstrdup(lc->str));
+ newsize = res_incexe.current_opts->wildbase.size();
+ }
} else {
type = "wild";
res_incexe.current_opts->wild.append(bstrdup(lc->str));
scan_to_eol(lc);
}
+/* Store drivetype info */
+static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ int token;
+
+ token = lex_get_token(lc, T_SKIP_EOL);
+ if (pass == 1) {
+ /* Pickup drivetype string */
+ switch (token) {
+ case T_IDENTIFIER:
+ case T_UNQUOTED_STRING:
+ case T_QUOTED_STRING:
+ res_incexe.current_opts->drivetype.append(bstrdup(lc->str));
+ Dmsg3(900, "set drivetype %p size=%d %s\n",
+ res_incexe.current_opts, res_incexe.current_opts->drivetype.size(), lc->str);
+ break;
+ default:
+ scan_err1(lc, _("Expected an drivetype string, got: %s\n"), lc->str);
+ }
+ }
+ scan_to_eol(lc);
+}
+
/*
* Store Filename info. Note, for minor efficiency reasons, we
* always increase the name buffer by 10 items because we expect
fo->wild.init(1, true);
fo->wilddir.init(1, true);
fo->wildfile.init(1, true);
+ fo->wildbase.init(1, true);
fo->base.init(1, true);
fo->fstype.init(1, true);
+ fo->drivetype.init(1, true);
res_incexe.current_opts = fo;
if (res_incexe.num_opts == 0) {
res_incexe.opts_list = (FOPTS **)malloc(sizeof(FOPTS *));