1 Index: src/dird/dird_conf.c
2 ===================================================================
3 --- src/dird/dird_conf.c (révision 6192)
4 +++ src/dird/dird_conf.c (copie de travail)
7 /* We build RunScripts items here */
8 static RUNSCRIPT res_runscript;
9 +static alist *res_runscript_cmd;
10 +static alist *res_runscript_type;
12 /* Store a runscript->when in a bit field */
13 static void store_runscript_when(LEX *lc, RES_ITEM *item, int index, int pass)
14 @@ -1731,7 +1733,10 @@
15 lex_get_token(lc, T_STRING);
18 - ((RUNSCRIPT*)item->value)->set_command(lc->str, item->code);
19 + POOLMEM *c = get_pool_memory(PM_FNAME);
20 + pm_strcpy(c, lc->str);
21 + res_runscript_cmd->prepend(c);
22 + res_runscript_type->prepend((void*) item->code);
28 static void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
33 alist **runscripts = (alist **)(item->value) ;
35 Dmsg1(200, "store_runscript: begin store_runscript pass=%i\n", pass);
36 @@ -1846,6 +1852,11 @@
37 scan_err1(lc, _("Expecting open brace. Got %s"), lc->str);
41 + res_runscript_cmd = New(alist(10, not_owned_by_alist));
42 + res_runscript_type = New(alist(10, not_owned_by_alist));
45 while ((token = lex_get_token(lc, T_SKIP_EOL)) != T_EOF) {
48 @@ -1873,26 +1884,26 @@
52 - if (res_runscript.command == NULL) {
53 - scan_err2(lc, _("%s item is required in %s resource, but not found.\n"),
54 - "command", "runscript");
57 /* run on client by default */
58 if (res_runscript.target == NULL) {
59 res_runscript.set_target("%c");
62 - RUNSCRIPT *script = new_runscript();
63 - memcpy(script, &res_runscript, sizeof(RUNSCRIPT));
64 - script->set_job_code_callback(job_code_callback_filesetname);
66 if (*runscripts == NULL) {
67 - *runscripts = New(alist(10, not_owned_by_alist));
68 + *runscripts = New(alist(10, not_owned_by_alist));
71 - (*runscripts)->append(script);
73 + while ((c=(char*)res_runscript_cmd->pop()) != NULL) {
74 + t = (int) res_runscript_type->pop();
75 + RUNSCRIPT *script = new_runscript();
76 + memcpy(script, &res_runscript, sizeof(RUNSCRIPT));
77 + script->set_job_code_callback(job_code_callback_filesetname);
78 + script->command = c;
79 + script->cmd_type = t;
81 + (*runscripts)->append(script);
84 + delete res_runscript_type;
85 + delete res_runscript_cmd;