+ res = GetResWithName(item->code, lc->str);
+ if (res == NULL) {
+ scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"),
+ lc->str, lc->line_no, lc->line);
+ }
+ if (*(item->value)) {
+ scan_err3(lc, _("Attempt to redefine resource \"%s\" referenced on line %d : %s\n"),
+ item->name, lc->line_no, lc->line);
+ }
+ *(item->value) = (char *)res;
+ }
+ scan_to_eol(lc);
+ set_bit(index, res_all.hdr.item_present);
+}
+
+/*
+ * Store a resource pointer in an alist. default_value indicates how many
+ * times this routine can be called -- i.e. how many alists
+ * there are.
+ * If we are in pass 2, do a lookup of the
+ * resource.
+ */
+void store_alist_res(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ RES *res;
+ int count = item->default_value;
+ int i = 0;
+ alist *list;
+
+ if (pass == 2) {
+ if (count == 0) { /* always store in item->value */
+ i = 0;
+ if ((item->value)[i] == NULL) {
+ list = New(alist(10, not_owned_by_alist));
+ } else {
+ list = (alist *)(item->value)[i];
+ }
+ } else {
+ /* Find empty place to store this directive */
+ while ((item->value)[i] != NULL && i++ < count) { }
+ if (i >= count) {
+ scan_err4(lc, _("Too many %s directives. Max. is %d. line %d: %s\n"),
+ lc->str, count, lc->line_no, lc->line);
+ }
+ list = New(alist(10, not_owned_by_alist));
+ }
+
+ for (;;) {
+ lex_get_token(lc, T_NAME); /* scan next item */
+ res = GetResWithName(item->code, lc->str);
+ if (res == NULL) {
+ scan_err3(lc, _("Could not find config Resource \"%s\" referenced on line %d : %s\n"),
+ item->name, lc->line_no, lc->line);
+ }
+ Dmsg5(900, "Append %p to alist %p size=%d i=%d %s\n",
+ res, list, list->size(), i, item->name);
+ list->append(res);
+ (item->value)[i] = (char *)list;
+ if (lc->ch != ',') { /* if no other item follows */
+ break; /* get out */
+ }
+ lex_get_token(lc, T_ALL); /* eat comma */
+ }
+ }
+ scan_to_eol(lc);
+ set_bit(index, res_all.hdr.item_present);
+}
+
+
+/*
+ * Store a string in an alist.
+ */
+void store_alist_str(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ alist *list;
+
+ if (pass == 2) {
+ if (*(item->value) == NULL) {
+ list = New(alist(10, owned_by_alist));
+ } else {
+ list = (alist *)(*(item->value));
+ }
+
+ lex_get_token(lc, T_STRING); /* scan next item */
+ Dmsg4(900, "Append %s to alist %p size=%d %s\n",
+ lc->str, list, list->size(), item->name);
+ list->append(bstrdup(lc->str));
+ *(item->value) = (char *)list;
+ }
+ scan_to_eol(lc);
+ set_bit(index, res_all.hdr.item_present);
+}
+
+
+
+/*
+ * Store default values for Resource from xxxDefs
+ * If we are in pass 2, do a lookup of the
+ * resource and store everything not explicitly set
+ * in main resource.
+ *
+ * Note, here item points to the main resource (e.g. Job, not
+ * the jobdefs, which we look up).
+ */
+void store_defs(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ RES *res;
+
+ lex_get_token(lc, T_NAME);
+ if (pass == 2) {
+ Dmsg2(900, "Code=%d name=%s\n", item->code, lc->str);