/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
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.
+ License as published by the Free Software Foundation and included
+ 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
extern RES_TABLE resources[];
extern RES **res_head;
+/*
+ * Define the Union of all the common resource structure definitions.
+ */
+union URES {
+ MSGS res_msgs;
+ RES hdr;
+};
+
#if defined(_MSC_VER)
// work around visual studio name mangling preventing external linkage since res_all
// is declared as a different type when instantiated.
-extern "C" CURES res_all;
+extern "C" URES res_all;
#else
-extern CURES res_all;
+extern URES res_all;
#endif
extern int res_all_size;
* Initialize the static structure to zeros, then
* apply all the default values.
*/
-void init_resource(int type, RES_ITEM *items, int pass)
+static void init_resource(int type, RES_ITEM *items, int pass)
{
int i;
int rindex = type - r_first;
- static bool first = true;
- int errstat;
-
- if (first && (errstat=rwl_init(&res_lock)) != 0) {
- berrno be;
- Emsg1(M_ABORT, 0, _("Unable to initialize resource lock. ERR=%s\n"),
- be.bstrerror(errstat));
- }
- first = false;
- memset(&res_all, 0, res_all_size);
+ memset((char *)&res_all, 0, res_all_size);
res_all.hdr.rcode = type;
res_all.hdr.refcnt = 1;
free_pool_memory(dest);
Dmsg0(900, "done with dest codes\n");
break;
+
case MD_FILE: /* file */
case MD_APPEND: /* append */
dest = get_pool_memory(PM_MESSAGE);
enum parse_state state = p_none;
RES_ITEM *items = NULL;
int level = 0;
+ static bool first = true;
+ int errstat;
+
+ if (first && (errstat=rwl_init(&res_lock)) != 0) {
+ berrno be;
+ Emsg1(M_ABORT, 0, _("Unable to initialize resource lock. ERR=%s\n"),
+ be.bstrerror(errstat));
+ }
+ first = false;
char *full_path = (char *)alloca(MAX_PATH + 1);
}
lex_set_error_handler_error_type(lc, err_type) ;
while ((token=lex_get_token(lc, T_ALL)) != T_EOF) {
- Dmsg1(900, "parse got token=%s\n", lex_tok_to_str(token));
+ Dmsg3(900, "parse state=%d pass=%d got token=%s\n", state, pass,
+ lex_tok_to_str(token));
switch (state) {
case p_none:
if (token == T_EOL) {
}
for (i=0; resources[i].name; i++) {
if (strcasecmp(resources[i].name, lc->str) == 0) {
- state = p_resource;
items = resources[i].items;
+ if (!items) {
+ break;
+ }
+ state = p_resource;
res_type = resources[i].rcode;
init_resource(res_type, items, pass);
break;