]> git.sur5r.net Git - bacula/bacula/commitdiff
Put resources on a pointer
authorKern Sibbald <kern@sibbald.com>
Mon, 21 Jun 2004 13:18:41 +0000 (13:18 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 21 Jun 2004 13:18:41 +0000 (13:18 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1435 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/console/console_conf.c
bacula/src/dird/dird.c
bacula/src/dird/dird_conf.c
bacula/src/dird/ua_output.c
bacula/src/filed/filed_conf.c
bacula/src/gnome2-console/console_conf.c
bacula/src/lib/lex.c
bacula/src/lib/parse_conf.c
bacula/src/lib/parse_conf.h
bacula/src/stored/stored_conf.c
bacula/src/wx-console/console_conf.c

index 5893a4f9689cddc3231713770fdbeb5334b7804a..89c31d0705d3f05bbcc057b43470056bfd44ab85 100644 (file)
@@ -101,9 +101,9 @@ static RES_ITEM dir_items[] = {
  * It must have one item for each of the resources.
  */
 RES_TABLE resources[] = {
-   {"console",       cons_items,  R_CONSOLE,   NULL},
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {NULL,           NULL,        0,           NULL}
+   {"console",       cons_items,  R_CONSOLE},        
+   {"director",      dir_items,   R_DIRECTOR},
+   {NULL,           NULL,        0}
 };
 
 
@@ -256,11 +256,11 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-        resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+        res_head[rindex] = (RES *)res; /* store first entry */
       } else {
         RES *next;
-        for (next=resources[rindex].res_head; next->next; next=next->next) {
+        for (next=res_head[rindex]; next->next; next=next->next) {
            if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
               Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
index 2e368e4027209dbc6caccd53f11a9738999d7f96..c119440985667687fa9041f476c44a730105bab2 100644 (file)
@@ -63,6 +63,7 @@ int SDConnectTimeout;
 /* Globals Imported */
 extern int r_first, r_last;          /* first and last resources */
 extern RES_TABLE resources[];
+extern RES **res_head;
 extern RES_ITEM job_items[];
 extern URES res_all;
 
@@ -426,7 +427,7 @@ void reload_config(int sig)
       int num = r_last - r_first + 1;
       RES **res_tab = reload_table[table].res_table;
       for (int i=0; i<num; i++) {
-        resources[i].res_head = res_tab[i];
+        res_head[i] = res_tab[i];
       }
       table = rtable;                /* release new, bad, saved table below */
       if (njobs != 0) {
index 91e48879503cce4ab4bd8bd5364c4476622fe46b..fa8d41568fa53379f5b1f98a9106d2d52b4f4d5f 100644 (file)
@@ -8,14 +8,14 @@
  *   1. The generic lexical scanner in lib/lex.c and lib/lex.h
  *
  *   2. The generic config  scanner in lib/parse_config.c and 
- *      lib/parse_config.h.
- *      These files contain the parser code, some utility
- *      routines, and the common store routines (name, int,
- *      string).
+ *     lib/parse_config.h.
+ *     These files contain the parser code, some utility
+ *     routines, and the common store routines (name, int,
+ *     string).
  *
  *   3. The daemon specific file, which contains the Resource
- *      definitions as well as any specific store routines
- *      for the resource records.
+ *     definitions as well as any specific store routines
+ *     for the resource records.
  *
  *     Kern Sibbald, January MM
  *
@@ -83,7 +83,7 @@ int  res_all_size = sizeof(res_all);
 /* 
  *    Director Resource
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM dir_items[] = {
    {"name",        store_name,     ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
@@ -107,7 +107,7 @@ static RES_ITEM dir_items[] = {
 /* 
  *    Console Resource
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM con_items[] = {
    {"name",        store_name,     ITEM(res_con.hdr.name), 0, ITEM_REQUIRED, 0},
@@ -130,7 +130,7 @@ static RES_ITEM con_items[] = {
 /* 
  *    Client or File daemon resource
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 
 static RES_ITEM cli_items[] = {
@@ -152,7 +152,7 @@ static RES_ITEM cli_items[] = {
 
 /* Storage daemon resource
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM store_items[] = {
    {"name",        store_name,     ITEM(res_store.hdr.name),   0, ITEM_REQUIRED, 0},
@@ -175,7 +175,7 @@ static RES_ITEM store_items[] = {
 /* 
  *    Catalog Resource Directives
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM cat_items[] = {
    {"name",     store_name,     ITEM(res_cat.hdr.name),    0, ITEM_REQUIRED, 0},
@@ -195,7 +195,7 @@ static RES_ITEM cat_items[] = {
 /* 
  *    Job Resource Directives
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 RES_ITEM job_items[] = {
    {"name",      store_name,    ITEM(res_job.hdr.name), 0, ITEM_REQUIRED, 0},
@@ -242,20 +242,20 @@ RES_ITEM job_items[] = {
 
 /* FileSet resource
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM fs_items[] = {
    {"name",        store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0},
    {"description", store_str,  ITEM(res_fs.hdr.desc), 0, 0, 0},
    {"include",     store_inc,  NULL,                  0, ITEM_NO_EQUALS, 0},
    {"exclude",     store_inc,  NULL,                  1, ITEM_NO_EQUALS, 0},
-   {NULL,          NULL,       NULL,                  0, 0, 0} 
+   {NULL,         NULL,       NULL,                  0, 0, 0} 
 };
 
 /* Schedule -- see run_conf.c */
 /* Schedule
  *
- *   name          handler     value                 code flags    default_value
+ *   name         handler     value                 code flags    default_value
  */
 static RES_ITEM sch_items[] = {
    {"name",     store_name,  ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0},
@@ -266,7 +266,7 @@ static RES_ITEM sch_items[] = {
 
 /* Pool resource
  *
- *   name             handler     value                        code flags default_value
+ *   name            handler     value                        code flags default_value
  */
 static RES_ITEM pool_items[] = {
    {"name",            store_name,    ITEM(res_pool.hdr.name),      0, ITEM_REQUIRED, 0},
@@ -294,7 +294,7 @@ static RES_ITEM pool_items[] = {
 
 /* 
  * Counter Resource
- *   name             handler     value                        code flags default_value
+ *   name            handler     value                        code flags default_value
  */
 static RES_ITEM counter_items[] = {
    {"name",            store_name,    ITEM(res_counter.hdr.name),        0, ITEM_REQUIRED, 0},
@@ -317,28 +317,28 @@ extern RES_ITEM msgs_items[];
  *  NOTE!!! keep it in the same order as the R_codes
  *    or eliminate all resources[rindex].name
  *
- *  name             items        rcode        res_head
+ *  name            items        rcode        res_head
  */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {"client",        cli_items,   R_CLIENT,    NULL},
-   {"job",           job_items,   R_JOB,       NULL},
-   {"storage",       store_items, R_STORAGE,   NULL},
-   {"catalog",       cat_items,   R_CATALOG,   NULL},
-   {"schedule",      sch_items,   R_SCHEDULE,  NULL},
-   {"fileset",       fs_items,    R_FILESET,   NULL},
-   {"pool",          pool_items,  R_POOL,      NULL},
-   {"messages",      msgs_items,  R_MSGS,      NULL},
-   {"counter",       counter_items, R_COUNTER, NULL},
-   {"console",       con_items,   R_CONSOLE,   NULL},
-   {"jobdefs",       job_items,   R_JOBDEFS,   NULL},
-   {NULL,            NULL,        0,           NULL}
+   {"director",      dir_items,   R_DIRECTOR},
+   {"client",        cli_items,   R_CLIENT},
+   {"job",           job_items,   R_JOB},
+   {"storage",       store_items, R_STORAGE},
+   {"catalog",       cat_items,   R_CATALOG},
+   {"schedule",      sch_items,   R_SCHEDULE},
+   {"fileset",       fs_items,    R_FILESET},
+   {"pool",          pool_items,  R_POOL},
+   {"messages",      msgs_items,  R_MSGS},
+   {"counter",       counter_items, R_COUNTER},
+   {"console",       con_items,   R_CONSOLE},
+   {"jobdefs",       job_items,   R_JOBDEFS},
+   {NULL,           NULL,        0}
 };
 
 
 /* Keywords (RHS) permitted in Job Level records   
  *
- *   level_name      level              job_type
+ *   level_name      level             job_type
  */
 struct s_jl joblevels[] = {
    {"Full",          L_FULL,            JT_BACKUP},
@@ -353,19 +353,19 @@ struct s_jl joblevels[] = {
    {"Data",          L_VERIFY_DATA,     JT_VERIFY},
    {" ",             L_NONE,            JT_ADMIN},
    {" ",             L_NONE,            JT_RESTORE},
-   {NULL,            0,                          0}
+   {NULL,           0,                          0}
 };
 
 /* Keywords (RHS) permitted in Job type records   
  *
- *   type_name       job_type
+ *   type_name      job_type
  */
 struct s_jt jobtypes[] = {
    {"backup",        JT_BACKUP},
    {"admin",         JT_ADMIN},
    {"verify",        JT_VERIFY},
    {"restore",       JT_RESTORE},
-   {NULL,            0}
+   {NULL,           0}
 };
 
 #ifdef old_deprecated_code
@@ -375,7 +375,7 @@ static struct s_kw BakVerFields[] = {
    {"client",        'C'},
    {"fileset",       'F'},
    {"level",         'L'}, 
-   {NULL,            0}
+   {NULL,           0}
 };
 
 /* Keywords (RHS) permitted in Restore records */
@@ -386,7 +386,7 @@ static struct s_kw RestoreFields[] = {
    {"where",         'W'},            /* root of restore */
    {"replace",       'R'},            /* replacement options */
    {"bootstrap",     'B'},            /* bootstrap file */
-   {NULL,              0}
+   {NULL,             0}
 };
 #endif
 
@@ -396,7 +396,7 @@ struct s_kw ReplaceOptions[] = {
    {"ifnewer",        REPLACE_IFNEWER},
    {"ifolder",        REPLACE_IFOLDER},
    {"never",          REPLACE_NEVER},
-   {NULL,               0}
+   {NULL,              0}
 };
 
 const char *level_to_str(int level)
@@ -408,8 +408,8 @@ const char *level_to_str(int level)
    bsnprintf(level_no, sizeof(level_no), "%d", level);    /* default if not found */
    for (i=0; joblevels[i].level_name; i++) {
       if (level == joblevels[i].level) {
-         str = joblevels[i].level_name;
-         break;
+        str = joblevels[i].level_name;
+        break;
       }
    }
    return str;
@@ -426,93 +426,93 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       sendit(sock, "No %s resource defined\n", res_to_str(type));
       return;
    }
-   if (type < 0) {                    /* no recursion */
+   if (type < 0) {                   /* no recursion */
       type = - type;
       recurse = false;
    }
    switch (type) {
    case R_DIRECTOR:
       sendit(sock, "Director: name=%s MaxJobs=%d FDtimeout=%s SDtimeout=%s\n", 
-         reshdr->name, res->res_dir.MaxConcurrentJobs, 
-         edit_uint64(res->res_dir.FDConnectTimeout, ed1),
-         edit_uint64(res->res_dir.SDConnectTimeout, ed2));
+        reshdr->name, res->res_dir.MaxConcurrentJobs, 
+        edit_uint64(res->res_dir.FDConnectTimeout, ed1),
+        edit_uint64(res->res_dir.SDConnectTimeout, ed2));
       if (res->res_dir.query_file) {
          sendit(sock, "   query_file=%s\n", res->res_dir.query_file);
       }
       if (res->res_dir.messages) {
          sendit(sock, "  --> ");
-         dump_resource(-R_MSGS, (RES *)res->res_dir.messages, sendit, sock);
+        dump_resource(-R_MSGS, (RES *)res->res_dir.messages, sendit, sock);
       }
       break;
    case R_CONSOLE:
       sendit(sock, "Console: name=%s SSL=%d\n", 
-         res->res_con.hdr.name, res->res_con.enable_ssl);
+        res->res_con.hdr.name, res->res_con.enable_ssl);
       break;
    case R_COUNTER:
       if (res->res_counter.WrapCounter) {
          sendit(sock, "Counter: name=%s min=%d max=%d cur=%d wrapcntr=%s\n",
-            res->res_counter.hdr.name, res->res_counter.MinValue, 
-            res->res_counter.MaxValue, res->res_counter.CurrentValue,
-            res->res_counter.WrapCounter->hdr.name);
+           res->res_counter.hdr.name, res->res_counter.MinValue, 
+           res->res_counter.MaxValue, res->res_counter.CurrentValue,
+           res->res_counter.WrapCounter->hdr.name);
       } else {
          sendit(sock, "Counter: name=%s min=%d max=%d\n",
-            res->res_counter.hdr.name, res->res_counter.MinValue, 
-            res->res_counter.MaxValue);
+           res->res_counter.hdr.name, res->res_counter.MinValue, 
+           res->res_counter.MaxValue);
       }
       if (res->res_counter.Catalog) {
          sendit(sock, "  --> ");
-         dump_resource(-R_CATALOG, (RES *)res->res_counter.Catalog, sendit, sock);
+        dump_resource(-R_CATALOG, (RES *)res->res_counter.Catalog, sendit, sock);
       }
       break;
 
    case R_CLIENT:
       sendit(sock, "Client: name=%s address=%s FDport=%d MaxJobs=%u\n",
-         res->res_client.hdr.name, res->res_client.address, res->res_client.FDport,
-         res->res_client.MaxConcurrentJobs);
+        res->res_client.hdr.name, res->res_client.address, res->res_client.FDport,
+        res->res_client.MaxConcurrentJobs);
       sendit(sock, "      JobRetention=%s FileRetention=%s AutoPrune=%d\n",
-         edit_utime(res->res_client.JobRetention, ed1), 
-         edit_utime(res->res_client.FileRetention, ed2),
-         res->res_client.AutoPrune);
+        edit_utime(res->res_client.JobRetention, ed1), 
+        edit_utime(res->res_client.FileRetention, ed2),
+        res->res_client.AutoPrune);
       if (res->res_client.catalog) {
          sendit(sock, "  --> ");
-         dump_resource(-R_CATALOG, (RES *)res->res_client.catalog, sendit, sock);
+        dump_resource(-R_CATALOG, (RES *)res->res_client.catalog, sendit, sock);
       }
       break;
    case R_STORAGE:
       sendit(sock, "Storage: name=%s address=%s SDport=%d MaxJobs=%u\n\
       DeviceName=%s MediaType=%s\n",
-         res->res_store.hdr.name, res->res_store.address, res->res_store.SDport,
-         res->res_store.MaxConcurrentJobs,
-         res->res_store.dev_name, res->res_store.media_type);
+        res->res_store.hdr.name, res->res_store.address, res->res_store.SDport,
+        res->res_store.MaxConcurrentJobs,
+        res->res_store.dev_name, res->res_store.media_type);
       break;
    case R_CATALOG:
       sendit(sock, "Catalog: name=%s address=%s DBport=%d db_name=%s\n\
       db_user=%s\n",
-         res->res_cat.hdr.name, NPRT(res->res_cat.db_address),
-         res->res_cat.db_port, res->res_cat.db_name, NPRT(res->res_cat.db_user));
+        res->res_cat.hdr.name, NPRT(res->res_cat.db_address),
+        res->res_cat.db_port, res->res_cat.db_name, NPRT(res->res_cat.db_user));
       break;
    case R_JOB:
    case R_JOBDEFS:
       sendit(sock, "%s: name=%s JobType=%d level=%s Priority=%d MaxJobs=%u\n", 
          type == R_JOB ? "Job" : "JobDefs",
-         res->res_job.hdr.name, res->res_job.JobType, 
-         level_to_str(res->res_job.level), res->res_job.Priority,
-         res->res_job.MaxConcurrentJobs);
+        res->res_job.hdr.name, res->res_job.JobType, 
+        level_to_str(res->res_job.level), res->res_job.Priority,
+        res->res_job.MaxConcurrentJobs);
       sendit(sock, "     Resched=%d Times=%d Interval=%s Spool=%d\n",
-          res->res_job.RescheduleOnError, res->res_job.RescheduleTimes,
-          edit_uint64_with_commas(res->res_job.RescheduleInterval, ed1),
-          res->res_job.spool_data);
+         res->res_job.RescheduleOnError, res->res_job.RescheduleTimes,
+         edit_uint64_with_commas(res->res_job.RescheduleInterval, ed1),
+         res->res_job.spool_data);
       if (res->res_job.client) {
          sendit(sock, "  --> ");
-         dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock);
+        dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock);
       }
       if (res->res_job.fileset) {
          sendit(sock, "  --> ");
-         dump_resource(-R_FILESET, (RES *)res->res_job.fileset, sendit, sock);
+        dump_resource(-R_FILESET, (RES *)res->res_job.fileset, sendit, sock);
       }
       if (res->res_job.schedule) {
          sendit(sock, "  --> ");
-         dump_resource(-R_SCHEDULE, (RES *)res->res_job.schedule, sendit, sock);
+        dump_resource(-R_SCHEDULE, (RES *)res->res_job.schedule, sendit, sock);
       }
       if (res->res_job.RestoreWhere) {
          sendit(sock, "  --> Where=%s\n", NPRT(res->res_job.RestoreWhere));
@@ -534,32 +534,32 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       }
       if (res->res_job.storage) {
          sendit(sock, "  --> ");
-         dump_resource(-R_STORAGE, (RES *)res->res_job.storage, sendit, sock);
+        dump_resource(-R_STORAGE, (RES *)res->res_job.storage, sendit, sock);
       }
       if (res->res_job.pool) {
          sendit(sock, "  --> ");
-         dump_resource(-R_POOL, (RES *)res->res_job.pool, sendit, sock);
+        dump_resource(-R_POOL, (RES *)res->res_job.pool, sendit, sock);
       }
       if (res->res_job.full_pool) {
          sendit(sock, "  --> ");
-         dump_resource(-R_POOL, (RES *)res->res_job.full_pool, sendit, sock);
+        dump_resource(-R_POOL, (RES *)res->res_job.full_pool, sendit, sock);
       }
       if (res->res_job.inc_pool) {
          sendit(sock, "  --> ");
-         dump_resource(-R_POOL, (RES *)res->res_job.inc_pool, sendit, sock);
+        dump_resource(-R_POOL, (RES *)res->res_job.inc_pool, sendit, sock);
       }
       if (res->res_job.dif_pool) {
          sendit(sock, "  --> ");
-         dump_resource(-R_POOL, (RES *)res->res_job.dif_pool, sendit, sock);
+        dump_resource(-R_POOL, (RES *)res->res_job.dif_pool, sendit, sock);
       }
       if (res->res_job.verify_job) {
          sendit(sock, "  --> ");
-         dump_resource(-type, (RES *)res->res_job.verify_job, sendit, sock);
+        dump_resource(-type, (RES *)res->res_job.verify_job, sendit, sock);
       }
       break;
       if (res->res_job.messages) {
          sendit(sock, "  --> ");
-         dump_resource(-R_MSGS, (RES *)res->res_job.messages, sendit, sock);
+        dump_resource(-R_MSGS, (RES *)res->res_job.messages, sendit, sock);
       }
       break;
    case R_FILESET:
@@ -567,145 +567,145 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
       int i, j, k;
       sendit(sock, "FileSet: name=%s\n", res->res_fs.hdr.name);
       for (i=0; i<res->res_fs.num_includes; i++) {
-         INCEXE *incexe = res->res_fs.include_items[i];
-         for (j=0; j<incexe->num_opts; j++) {
-            FOPTS *fo = incexe->opts_list[j];
+        INCEXE *incexe = res->res_fs.include_items[i];
+        for (j=0; j<incexe->num_opts; j++) {
+           FOPTS *fo = incexe->opts_list[j];
             sendit(sock, "      O %s\n", fo->opts);
-            for (k=0; k<fo->regex.size(); k++) {
+           for (k=0; k<fo->regex.size(); k++) {
                sendit(sock, "      R %s\n", fo->regex.get(k));
-            }
-            for (k=0; k<fo->wild.size(); k++) {
+           }
+           for (k=0; k<fo->wild.size(); k++) {
                sendit(sock, "      W %s\n", fo->wild.get(k));
-            }
-            for (k=0; k<fo->base.size(); k++) {
+           }
+           for (k=0; k<fo->base.size(); k++) {
                sendit(sock, "      B %s\n", fo->base.get(k));
-            }
+           }
             sendit(sock, "      N\n");
-         }
-         for (j=0; j<incexe->name_list.size(); j++) {
+        }
+        for (j=0; j<incexe->name_list.size(); j++) {
             sendit(sock, "      I %s\n", incexe->name_list.get(j));
-         }
-         if (incexe->name_list.size()) {
+        }
+        if (incexe->name_list.size()) {
             sendit(sock, "      N\n");
-         }
+        }
       }
-         
+        
       for (i=0; i<res->res_fs.num_excludes; i++) {
-         INCEXE *incexe = res->res_fs.exclude_items[i];
-         for (j=0; j<incexe->name_list.size(); j++) {
+        INCEXE *incexe = res->res_fs.exclude_items[i];
+        for (j=0; j<incexe->name_list.size(); j++) {
             sendit(sock, "      E %s\n", incexe->name_list.get(j));
-         }
-         if (incexe->name_list.size()) {
+        }
+        if (incexe->name_list.size()) {
             sendit(sock, "      N\n");
-         }
+        }
       }
       break;
    }
    case R_SCHEDULE:
       if (res->res_sch.run) {
-         int i;
-         RUN *run = res->res_sch.run;
-         char buf[1000], num[30];
+        int i;
+        RUN *run = res->res_sch.run;
+        char buf[1000], num[30];
          sendit(sock, "Schedule: name=%s\n", res->res_sch.hdr.name);
-         if (!run) {
-            break;
-         }
+        if (!run) {
+           break;
+        }
 next_run:
          sendit(sock, "  --> Run Level=%s\n", level_to_str(run->level));
          bstrncpy(buf, "      hour=", sizeof(buf));
-         for (i=0; i<24; i++) {
-            if (bit_is_set(i, run->hour)) {
+        for (i=0; i<24; i++) {
+           if (bit_is_set(i, run->hour)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          bstrncpy(buf, "      mday=", sizeof(buf));
-         for (i=0; i<31; i++) {
-            if (bit_is_set(i, run->mday)) {
+        for (i=0; i<31; i++) {
+           if (bit_is_set(i, run->mday)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          bstrncpy(buf, "      month=", sizeof(buf));
-         for (i=0; i<12; i++) {
-            if (bit_is_set(i, run->month)) {
+        for (i=0; i<12; i++) {
+           if (bit_is_set(i, run->month)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          bstrncpy(buf, "      wday=", sizeof(buf));
-         for (i=0; i<7; i++) {
-            if (bit_is_set(i, run->wday)) {
+        for (i=0; i<7; i++) {
+           if (bit_is_set(i, run->wday)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          bstrncpy(buf, "      wom=", sizeof(buf));
-         for (i=0; i<5; i++) {
-            if (bit_is_set(i, run->wom)) {
+        for (i=0; i<5; i++) {
+           if (bit_is_set(i, run->wom)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          bstrncpy(buf, "      woy=", sizeof(buf));
-         for (i=0; i<54; i++) {
-            if (bit_is_set(i, run->woy)) {
+        for (i=0; i<54; i++) {
+           if (bit_is_set(i, run->woy)) {
                bsnprintf(num, sizeof(num), "%d ", i);
-               bstrncat(buf, num, sizeof(buf));
-            }
-         }
+              bstrncat(buf, num, sizeof(buf));
+           }
+        }
          bstrncat(buf, "\n", sizeof(buf));
-         sendit(sock, buf);
+        sendit(sock, buf);
          sendit(sock, "      mins=%d\n", run->minute);
-         if (run->pool) {
+        if (run->pool) {
             sendit(sock, "     --> ");
-            dump_resource(-R_POOL, (RES *)run->pool, sendit, sock);
-         }
-         if (run->storage) {
+           dump_resource(-R_POOL, (RES *)run->pool, sendit, sock);
+        }
+        if (run->storage) {
             sendit(sock, "     --> ");
-            dump_resource(-R_STORAGE, (RES *)run->storage, sendit, sock);
-         }
-         if (run->msgs) {
+           dump_resource(-R_STORAGE, (RES *)run->storage, sendit, sock);
+        }
+        if (run->msgs) {
             sendit(sock, "     --> ");
-            dump_resource(-R_MSGS, (RES *)run->msgs, sendit, sock);
-         }
-         /* If another Run record is chained in, go print it */
-         if (run->next) {
-            run = run->next;
-            goto next_run;
-         }
+           dump_resource(-R_MSGS, (RES *)run->msgs, sendit, sock);
+        }
+        /* If another Run record is chained in, go print it */
+        if (run->next) {
+           run = run->next;
+           goto next_run;
+        }
       } else {
          sendit(sock, "Schedule: name=%s\n", res->res_sch.hdr.name);
       }
       break;
    case R_POOL:
       sendit(sock, "Pool: name=%s PoolType=%s\n", res->res_pool.hdr.name,
-              res->res_pool.pool_type);
+             res->res_pool.pool_type);
       sendit(sock, "      use_cat=%d use_once=%d acpt_any=%d cat_files=%d\n",
-              res->res_pool.use_catalog, res->res_pool.use_volume_once,
-              res->res_pool.accept_any_volume, res->res_pool.catalog_files);
+             res->res_pool.use_catalog, res->res_pool.use_volume_once,
+             res->res_pool.accept_any_volume, res->res_pool.catalog_files);
       sendit(sock, "      max_vols=%d auto_prune=%d VolRetention=%s\n",
-              res->res_pool.max_volumes, res->res_pool.AutoPrune,
-              edit_utime(res->res_pool.VolRetention, ed1));
+             res->res_pool.max_volumes, res->res_pool.AutoPrune,
+             edit_utime(res->res_pool.VolRetention, ed1));
       sendit(sock, "      VolUse=%s recycle=%d LabelFormat=%s\n", 
-              edit_utime(res->res_pool.VolUseDuration, ed1),
-              res->res_pool.Recycle,
-              NPRT(res->res_pool.label_format));
+             edit_utime(res->res_pool.VolUseDuration, ed1),
+             res->res_pool.Recycle,
+             NPRT(res->res_pool.label_format));
       sendit(sock, "      CleaningPrefix=%s\n",
-              NPRT(res->res_pool.cleaning_prefix));
+             NPRT(res->res_pool.cleaning_prefix));
       sendit(sock, "      recyleOldest=%d MaxVolJobs=%d MaxVolFiles=%d\n",
-              res->res_pool.purge_oldest_volume, 
-              res->res_pool.MaxVolJobs, res->res_pool.MaxVolFiles);
+             res->res_pool.purge_oldest_volume, 
+             res->res_pool.MaxVolJobs, res->res_pool.MaxVolFiles);
       break;
    case R_MSGS:
       sendit(sock, "Messages: name=%s\n", res->res_msgs.hdr.name);
@@ -752,7 +752,7 @@ static void free_incexe(INCEXE *incexe)
 void free_resource(RES *sres, int type)
 {
    int num;
-   RES *nres;                         /* next resource if linked */
+   RES *nres;                        /* next resource if linked */
    URES *res = (URES *)sres;
 
    if (res == NULL)
@@ -770,147 +770,147 @@ void free_resource(RES *sres, int type)
    switch (type) {
    case R_DIRECTOR:
       if (res->res_dir.working_directory) {
-         free(res->res_dir.working_directory);
+        free(res->res_dir.working_directory);
       }
       if (res->res_dir.pid_directory) {
-         free(res->res_dir.pid_directory);
+        free(res->res_dir.pid_directory);
       }
       if (res->res_dir.subsys_directory) {
-         free(res->res_dir.subsys_directory);
+        free(res->res_dir.subsys_directory);
       }
       if (res->res_dir.password) {
-         free(res->res_dir.password);
+        free(res->res_dir.password);
       }
       if (res->res_dir.query_file) {
-         free(res->res_dir.query_file);
+        free(res->res_dir.query_file);
       }
       if (res->res_dir.DIRaddr) {
-         free(res->res_dir.DIRaddr);
+        free(res->res_dir.DIRaddr);
       }
       break;
    case R_COUNTER:
        break;
    case R_CONSOLE:
       if (res->res_con.password) {
-         free(res->res_con.password);
+        free(res->res_con.password);
       }
       for (int i=0; i<Num_ACL; i++) {
-         if (res->res_con.ACL_lists[i]) {
-            delete res->res_con.ACL_lists[i];
-            res->res_con.ACL_lists[i] = NULL;
-         }
+        if (res->res_con.ACL_lists[i]) {
+           delete res->res_con.ACL_lists[i];
+           res->res_con.ACL_lists[i] = NULL;
+        }
       }
       break;
    case R_CLIENT:
       if (res->res_client.address) {
-         free(res->res_client.address);
+        free(res->res_client.address);
       }
       if (res->res_client.password) {
-         free(res->res_client.password);
+        free(res->res_client.password);
       }
       break;
    case R_STORAGE:
       if (res->res_store.address) {
-         free(res->res_store.address);
+        free(res->res_store.address);
       }
       if (res->res_store.password) {
-         free(res->res_store.password);
+        free(res->res_store.password);
       }
       if (res->res_store.media_type) {
-         free(res->res_store.media_type);
+        free(res->res_store.media_type);
       }
       if (res->res_store.dev_name) {
-         free(res->res_store.dev_name);
+        free(res->res_store.dev_name);
       }
       break;
    case R_CATALOG:
       if (res->res_cat.db_address) {
-         free(res->res_cat.db_address);
+        free(res->res_cat.db_address);
       }
       if (res->res_cat.db_socket) {
-         free(res->res_cat.db_socket);
+        free(res->res_cat.db_socket);
       }
       if (res->res_cat.db_user) {
-         free(res->res_cat.db_user);
+        free(res->res_cat.db_user);
       }
       if (res->res_cat.db_name) {
-         free(res->res_cat.db_name);
+        free(res->res_cat.db_name);
       }
       if (res->res_cat.db_password) {
-         free(res->res_cat.db_password);
+        free(res->res_cat.db_password);
       }
       break;
    case R_FILESET:
       if ((num=res->res_fs.num_includes)) {
-         while (--num >= 0) {   
-            free_incexe(res->res_fs.include_items[num]);
-         }
-         free(res->res_fs.include_items);
+        while (--num >= 0) {   
+           free_incexe(res->res_fs.include_items[num]);
+        }
+        free(res->res_fs.include_items);
       }
       res->res_fs.num_includes = 0;
       if ((num=res->res_fs.num_excludes)) {
-         while (--num >= 0) {   
-            free_incexe(res->res_fs.exclude_items[num]);
-         }
-         free(res->res_fs.exclude_items);
+        while (--num >= 0) {   
+           free_incexe(res->res_fs.exclude_items[num]);
+        }
+        free(res->res_fs.exclude_items);
       }
       res->res_fs.num_excludes = 0;
       break;
    case R_POOL:
       if (res->res_pool.pool_type) {
-         free(res->res_pool.pool_type);
+        free(res->res_pool.pool_type);
       }
       if (res->res_pool.label_format) {
-         free(res->res_pool.label_format);
+        free(res->res_pool.label_format);
       }
       if (res->res_pool.cleaning_prefix) {
-         free(res->res_pool.cleaning_prefix);
+        free(res->res_pool.cleaning_prefix);
       }
       break;
    case R_SCHEDULE:
       if (res->res_sch.run) {
-         RUN *nrun, *next;
-         nrun = res->res_sch.run;
-         while (nrun) {
-            next = nrun->next;
-            free(nrun);
-            nrun = next;
-         }
+        RUN *nrun, *next;
+        nrun = res->res_sch.run;
+        while (nrun) {
+           next = nrun->next;
+           free(nrun);
+           nrun = next;
+        }
       }
       break;
    case R_JOB:
    case R_JOBDEFS:
       if (res->res_job.RestoreWhere) {
-         free(res->res_job.RestoreWhere);
+        free(res->res_job.RestoreWhere);
       }
       if (res->res_job.RestoreBootstrap) {
-         free(res->res_job.RestoreBootstrap);
+        free(res->res_job.RestoreBootstrap);
       }
       if (res->res_job.WriteBootstrap) {
-         free(res->res_job.WriteBootstrap);
+        free(res->res_job.WriteBootstrap);
       }
       if (res->res_job.RunBeforeJob) {
-         free(res->res_job.RunBeforeJob);
+        free(res->res_job.RunBeforeJob);
       }
       if (res->res_job.RunAfterJob) {
-         free(res->res_job.RunAfterJob);
+        free(res->res_job.RunAfterJob);
       }
       if (res->res_job.RunAfterFailedJob) {
-         free(res->res_job.RunAfterFailedJob);
+        free(res->res_job.RunAfterFailedJob);
       }
       if (res->res_job.ClientRunBeforeJob) {
-         free(res->res_job.ClientRunBeforeJob);
+        free(res->res_job.ClientRunBeforeJob);
       }
       if (res->res_job.ClientRunAfterJob) {
-         free(res->res_job.ClientRunAfterJob);
+        free(res->res_job.ClientRunAfterJob);
       }
       break;
    case R_MSGS:
       if (res->res_msgs.mail_cmd) {
-         free(res->res_msgs.mail_cmd);
+        free(res->res_msgs.mail_cmd);
       }
       if (res->res_msgs.operator_cmd) {
-         free(res->res_msgs.operator_cmd);
+        free(res->res_msgs.operator_cmd);
       }
       free_msgs_res((MSGS *)res);  /* free message resource */
       res = NULL;
@@ -946,16 +946,16 @@ void save_resource(int type, RES_ITEM *items, int pass)
        * Ensure that all required items are present
        */
       for (i=0; items[i].name; i++) {
-         if (items[i].flags & ITEM_REQUIRED) {
-               if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {  
+        if (items[i].flags & ITEM_REQUIRED) {
+              if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {  
                   Emsg2(M_ERROR_TERM, 0, "%s item is required in %s resource, but not found.\n",
-                    items[i].name, resources[rindex]);
-                }
-         }
-         /* If this triggers, take a look at lib/parse_conf.h */
-         if (i >= MAX_RES_ITEMS) {
+                   items[i].name, resources[rindex]);
+               }
+        }
+        /* If this triggers, take a look at lib/parse_conf.h */
+        if (i >= MAX_RES_ITEMS) {
             Emsg1(M_ERROR_TERM, 0, "Too many items in %s resource\n", resources[rindex]);
-         }
+        }
       }
    }
 
@@ -974,74 +974,74 @@ void save_resource(int type, RES_ITEM *items, int pass)
       case R_POOL:
       case R_MSGS:
       case R_FILESET:
-         break;
+        break;
 
       /* Resources containing another resource */
       case R_DIRECTOR:
-         if ((res = (URES *)GetResWithName(R_DIRECTOR, res_all.res_dir.hdr.name)) == NULL) {
+        if ((res = (URES *)GetResWithName(R_DIRECTOR, res_all.res_dir.hdr.name)) == NULL) {
             Emsg1(M_ERROR_TERM, 0, "Cannot find Director resource %s\n", res_all.res_dir.hdr.name);
-         }
-         res->res_dir.messages = res_all.res_dir.messages;
-         break;
+        }
+        res->res_dir.messages = res_all.res_dir.messages;
+        break;
       case R_JOB:
       case R_JOBDEFS:
-         if ((res = (URES *)GetResWithName(type, res_all.res_dir.hdr.name)) == NULL) {
+        if ((res = (URES *)GetResWithName(type, res_all.res_dir.hdr.name)) == NULL) {
             Emsg1(M_ERROR_TERM, 0, "Cannot find Job resource %s\n", 
-                  res_all.res_dir.hdr.name);
-         }
-         res->res_job.messages   = res_all.res_job.messages;
-         res->res_job.schedule   = res_all.res_job.schedule;
-         res->res_job.client     = res_all.res_job.client;
-         res->res_job.fileset    = res_all.res_job.fileset;
-         res->res_job.storage    = res_all.res_job.storage;
-         res->res_job.pool       = res_all.res_job.pool;
-         res->res_job.full_pool  = res_all.res_job.full_pool;
-         res->res_job.inc_pool   = res_all.res_job.inc_pool;
-         res->res_job.dif_pool   = res_all.res_job.dif_pool;
-         res->res_job.verify_job = res_all.res_job.verify_job;
-         res->res_job.jobdefs    = res_all.res_job.jobdefs;
-         break;
+                 res_all.res_dir.hdr.name);
+        }
+        res->res_job.messages   = res_all.res_job.messages;
+        res->res_job.schedule   = res_all.res_job.schedule;
+        res->res_job.client     = res_all.res_job.client;
+        res->res_job.fileset    = res_all.res_job.fileset;
+        res->res_job.storage    = res_all.res_job.storage;
+        res->res_job.pool       = res_all.res_job.pool;
+        res->res_job.full_pool  = res_all.res_job.full_pool;
+        res->res_job.inc_pool   = res_all.res_job.inc_pool;
+        res->res_job.dif_pool   = res_all.res_job.dif_pool;
+        res->res_job.verify_job = res_all.res_job.verify_job;
+        res->res_job.jobdefs    = res_all.res_job.jobdefs;
+        break;
       case R_COUNTER:
-         if ((res = (URES *)GetResWithName(R_COUNTER, res_all.res_counter.hdr.name)) == NULL) {
+        if ((res = (URES *)GetResWithName(R_COUNTER, res_all.res_counter.hdr.name)) == NULL) {
             Emsg1(M_ERROR_TERM, 0, "Cannot find Counter resource %s\n", res_all.res_counter.hdr.name);
-         }
-         res->res_counter.Catalog = res_all.res_counter.Catalog;
-         res->res_counter.WrapCounter = res_all.res_counter.WrapCounter;
-         break;
+        }
+        res->res_counter.Catalog = res_all.res_counter.Catalog;
+        res->res_counter.WrapCounter = res_all.res_counter.WrapCounter;
+        break;
 
       case R_CLIENT:
-         if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_client.hdr.name)) == NULL) {
+        if ((res = (URES *)GetResWithName(R_CLIENT, res_all.res_client.hdr.name)) == NULL) {
             Emsg1(M_ERROR_TERM, 0, "Cannot find Client resource %s\n", res_all.res_client.hdr.name);
-         }
-         res->res_client.catalog = res_all.res_client.catalog;
-         break;
+        }
+        res->res_client.catalog = res_all.res_client.catalog;
+        break;
       case R_SCHEDULE:
-         /*
-          * Schedule is a bit different in that it contains a RUN record
+        /*
+         * Schedule is a bit different in that it contains a RUN record
           * chain which isn't a "named" resource. This chain was linked
-          * in by run_conf.c during pass 2, so here we jam the pointer 
-          * into the Schedule resource.                         
-          */
-         if ((res = (URES *)GetResWithName(R_SCHEDULE, res_all.res_client.hdr.name)) == NULL) {
+         * in by run_conf.c during pass 2, so here we jam the pointer 
+         * into the Schedule resource.                         
+         */
+        if ((res = (URES *)GetResWithName(R_SCHEDULE, res_all.res_client.hdr.name)) == NULL) {
             Emsg1(M_ERROR_TERM, 0, "Cannot find Schedule resource %s\n", res_all.res_client.hdr.name);
-         }
-         res->res_sch.run = res_all.res_sch.run;
-         break;
+        }
+        res->res_sch.run = res_all.res_sch.run;
+        break;
       default:
          Emsg1(M_ERROR, 0, "Unknown resource type %d in save_resource.\n", type);
-         error = 1;
-         break;
+        error = 1;
+        break;
       }
       /* Note, the resource name was already saved during pass 1,
        * so here, we can just release it.
        */
       if (res_all.res_dir.hdr.name) {
-         free(res_all.res_dir.hdr.name);
-         res_all.res_dir.hdr.name = NULL;
+        free(res_all.res_dir.hdr.name);
+        res_all.res_dir.hdr.name = NULL;
       }
       if (res_all.res_dir.hdr.desc) {
-         free(res_all.res_dir.hdr.desc);
-         res_all.res_dir.hdr.desc = NULL;
+        free(res_all.res_dir.hdr.desc);
+        res_all.res_dir.hdr.desc = NULL;
       }
       return;
    }
@@ -1094,23 +1094,23 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-         resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+        res_head[rindex] = (RES *)res; /* store first entry */
          Dmsg3(900, "Inserting first %s res: %s index=%d\n", res_to_str(type),
-               res->res_dir.hdr.name, rindex);
+              res->res_dir.hdr.name, rindex);
       } else {
-         RES *next;
-         /* Add new res to end of chain */
-         for (next=resources[rindex].res_head; next->next; next=next->next) {
-            if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
-               Emsg2(M_ERROR_TERM, 0,
+        RES *next;
+        /* Add new res to end of chain */
+        for (next=res_head[rindex]; next->next; next=next->next) {
+           if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
+              Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
-                  resources[rindex].name, res->res_dir.hdr.name);
-            }
-         }
-         next->next = (RES *)res;
+                 resources[rindex].name, res->res_dir.hdr.name);
+           }
+        }
+        next->next = (RES *)res;
          Dmsg4(900, "Inserting %s res: %s index=%d pass=%d\n", res_to_str(type),
-               res->res_dir.hdr.name, rindex, pass);
+              res->res_dir.hdr.name, rindex, pass);
       }
    }
 }
@@ -1127,9 +1127,9 @@ void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass)
    /* Store the type both pass 1 and pass 2 */
    for (i=0; jobtypes[i].type_name; i++) {
       if (strcasecmp(lc->str, jobtypes[i].type_name) == 0) {
-         *(int *)(item->value) = jobtypes[i].job_type;
-         i = 0;
-         break;
+        *(int *)(item->value) = jobtypes[i].job_type;
+        i = 0;
+        break;
       }
    }
    if (i != 0) {
@@ -1151,9 +1151,9 @@ void store_level(LEX *lc, RES_ITEM *item, int index, int pass)
    /* Store the level pass 2 so that type is defined */
    for (i=0; joblevels[i].level_name; i++) {
       if (strcasecmp(lc->str, joblevels[i].level_name) == 0) {
-         *(int *)(item->value) = joblevels[i].level;
-         i = 0;
-         break;
+        *(int *)(item->value) = joblevels[i].level;
+        i = 0;
+        break;
       }
    }
    if (i != 0) {
@@ -1170,9 +1170,9 @@ void store_replace(LEX *lc, RES_ITEM *item, int index, int pass)
    /* Scan Replacement options */
    for (i=0; ReplaceOptions[i].name; i++) {
       if (strcasecmp(lc->str, ReplaceOptions[i].name) == 0) {
-         *(int *)(item->value) = ReplaceOptions[i].token;
-         i = 0;
-         break;
+        *(int *)(item->value) = ReplaceOptions[i].token;
+        i = 0;
+        break;
       }
    }
    if (i != 0) {
@@ -1193,16 +1193,16 @@ void store_acl(LEX *lc, RES_ITEM *item, int index, int pass)
    for (;;) {
       token = lex_get_token(lc, T_NAME);
       if (pass == 1) {
-         if (((alist **)item->value)[item->code] == NULL) {   
-            ((alist **)item->value)[item->code] = new alist(10, owned_by_alist);
+        if (((alist **)item->value)[item->code] == NULL) {   
+           ((alist **)item->value)[item->code] = new alist(10, owned_by_alist);
 //          Dmsg1(900, "Defined new ACL alist at %d\n", item->code);
-         }
-         ((alist **)item->value)[item->code]->append(bstrdup(lc->str));
+        }
+        ((alist **)item->value)[item->code]->append(bstrdup(lc->str));
 //       Dmsg2(900, "Appended to %d %s\n", item->code, lc->str);
       }
       token = lex_get_token(lc, T_ALL);
       if (token == T_COMMA) {
-         continue;                    /* get another ACL */
+        continue;                    /* get another ACL */
       }
       break;
    }
@@ -1238,59 +1238,59 @@ static void store_backup(LEX *lc, RES_ITEM *item, int index, int pass)
       }
       Dmsg1(900, "Got keyword: %s\n", lc->str);
       for (i=0; BakVerFields[i].name; i++) {
-         if (strcasecmp(lc->str, BakVerFields[i].name) == 0) {
-            found = true;
-            if (lex_get_token(lc, T_ALL) != T_EQUALS) {
+        if (strcasecmp(lc->str, BakVerFields[i].name) == 0) {
+           found = true;
+           if (lex_get_token(lc, T_ALL) != T_EQUALS) {
                scan_err1(lc, "Expected an equals, got: %s", lc->str);
-            }
-            token = lex_get_token(lc, T_NAME);
+           }
+           token = lex_get_token(lc, T_NAME);
             Dmsg1(900, "Got value: %s\n", lc->str);
-            switch (BakVerFields[i].token) {
+           switch (BakVerFields[i].token) {
             case 'C':
-               /* Find Client Resource */
-               if (pass == 2) {
-                  res = GetResWithName(R_CLIENT, lc->str);
-                  if (res == NULL) {
+              /* Find Client Resource */
+              if (pass == 2) {
+                 res = GetResWithName(R_CLIENT, lc->str);
+                 if (res == NULL) {
                      scan_err1(lc, "Could not find specified Client Resource: %s",
-                                lc->str);
-                  }
-                  res_all.res_job.client = (CLIENT *)res;
-               }
-               break;
+                               lc->str);
+                 }
+                 res_all.res_job.client = (CLIENT *)res;
+              }
+              break;
             case 'F':
-               /* Find FileSet Resource */
-               if (pass == 2) {
-                  res = GetResWithName(R_FILESET, lc->str);
-                  if (res == NULL) {
+              /* Find FileSet Resource */
+              if (pass == 2) {
+                 res = GetResWithName(R_FILESET, lc->str);
+                 if (res == NULL) {
                      scan_err1(lc, "Could not find specified FileSet Resource: %s\n",
-                                 lc->str);
-                  }
-                  res_all.res_job.fileset = (FILESET *)res;
-               }
-               break;
+                                lc->str);
+                 }
+                 res_all.res_job.fileset = (FILESET *)res;
+              }
+              break;
             case 'L':
-               /* Get level */
-               for (i=0; joblevels[i].level_name; i++) {
-                  if (joblevels[i].job_type == item->code && 
-                       strcasecmp(lc->str, joblevels[i].level_name) == 0) {
-                     ((JOB *)(item->value))->level = joblevels[i].level;
-                     i = 0;
-                     break;
-                  }
-               }
-               if (i != 0) {
+              /* Get level */
+              for (i=0; joblevels[i].level_name; i++) {
+                 if (joblevels[i].job_type == item->code && 
+                      strcasecmp(lc->str, joblevels[i].level_name) == 0) {
+                    ((JOB *)(item->value))->level = joblevels[i].level;
+                    i = 0;
+                    break;
+                 }
+              }
+              if (i != 0) {
                   scan_err1(lc, "Expected a Job Level keyword, got: %s", lc->str);
-               }
-               break;
-            } /* end switch */
-            break;
-         } /* end if strcmp() */
+              }
+              break;
+           } /* end switch */
+           break;
+        } /* end if strcmp() */
       } /* end for */
       if (!found) {
          scan_err1(lc, "%s not a valid Backup/verify keyword", lc->str);
       }
    } /* end while */
-   lc->options = options;             /* reset original options */
+   lc->options = options;            /* reset original options */
    set_bit(index, res_all.hdr.item_present);
 }
 
@@ -1319,92 +1319,92 @@ static void store_restore(LEX *lc, RES_ITEM *item, int index, int pass)
       }
       for (i=0; RestoreFields[i].name; i++) {
          Dmsg1(900, "Restore kw=%s\n", lc->str);
-         if (strcasecmp(lc->str, RestoreFields[i].name) == 0) {
-            found = true;
-            if (lex_get_token(lc, T_ALL) != T_EQUALS) {
+        if (strcasecmp(lc->str, RestoreFields[i].name) == 0) {
+           found = true;
+           if (lex_get_token(lc, T_ALL) != T_EQUALS) {
                scan_err1(lc, "Expected an equals, got: %s", lc->str);
-            }
-            token = lex_get_token(lc, T_ALL);
+           }
+           token = lex_get_token(lc, T_ALL);
             Dmsg1(900, "Restore value=%s\n", lc->str);
-            switch (RestoreFields[i].token) {
+           switch (RestoreFields[i].token) {
             case 'B':
-               /* Bootstrap */
-               if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
+              /* Bootstrap */
+              if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
                   scan_err1(lc, "Expected a Restore bootstrap file, got: %s", lc->str);
-               }
-               if (pass == 1) {
-                  res_all.res_job.RestoreBootstrap = bstrdup(lc->str);
-               }
-               break;
+              }
+              if (pass == 1) {
+                 res_all.res_job.RestoreBootstrap = bstrdup(lc->str);
+              }
+              break;
             case 'C':
-               /* Find Client Resource */
-               if (pass == 2) {
-                  res = GetResWithName(R_CLIENT, lc->str);
-                  if (res == NULL) {
+              /* Find Client Resource */
+              if (pass == 2) {
+                 res = GetResWithName(R_CLIENT, lc->str);
+                 if (res == NULL) {
                      scan_err1(lc, "Could not find specified Client Resource: %s",
-                                lc->str);
-                  }
-                  res_all.res_job.client = (CLIENT *)res;
-               }
-               break;
+                               lc->str);
+                 }
+                 res_all.res_job.client = (CLIENT *)res;
+              }
+              break;
             case 'F':
-               /* Find FileSet Resource */
-               if (pass == 2) {
-                  res = GetResWithName(R_FILESET, lc->str);
-                  if (res == NULL) {
+              /* Find FileSet Resource */
+              if (pass == 2) {
+                 res = GetResWithName(R_FILESET, lc->str);
+                 if (res == NULL) {
                      scan_err1(lc, "Could not find specified FileSet Resource: %s\n",
-                                 lc->str);
-                  }
-                  res_all.res_job.fileset = (FILESET *)res;
-               }
-               break;
+                                lc->str);
+                 }
+                 res_all.res_job.fileset = (FILESET *)res;
+              }
+              break;
             case 'J':
-               /* JobId */
-               if (token != T_NUMBER) {
+              /* JobId */
+              if (token != T_NUMBER) {
                   scan_err1(lc, "expected an integer number, got: %s", lc->str);
-               }
-               errno = 0;
-               res_all.res_job.RestoreJobId = strtol(lc->str, NULL, 0);
+              }
+              errno = 0;
+              res_all.res_job.RestoreJobId = strtol(lc->str, NULL, 0);
                Dmsg1(900, "RestorJobId=%d\n", res_all.res_job.RestoreJobId);
-               if (errno != 0) {
+              if (errno != 0) {
                   scan_err1(lc, "expected an integer number, got: %s", lc->str);
-               }
-               break;
+              }
+              break;
             case 'W':
-               /* Where */
-               if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
+              /* Where */
+              if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
                   scan_err1(lc, "Expected a Restore root directory, got: %s", lc->str);
-               }
-               if (pass == 1) {
-                  res_all.res_job.RestoreWhere = bstrdup(lc->str);
-               }
-               break;
+              }
+              if (pass == 1) {
+                 res_all.res_job.RestoreWhere = bstrdup(lc->str);
+              }
+              break;
             case 'R':
-               /* Replacement options */
-               if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
+              /* Replacement options */
+              if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
                   scan_err1(lc, "Expected a keyword name, got: %s", lc->str);
-               }
-               /* Fix to scan Replacement options */
-               for (i=0; ReplaceOptions[i].name; i++) {
-                  if (strcasecmp(lc->str, ReplaceOptions[i].name) == 0) {
-                      ((JOB *)(item->value))->replace = ReplaceOptions[i].token;
-                     i = 0;
-                     break;
-                  }
-               }
-               if (i != 0) {
+              }
+              /* Fix to scan Replacement options */
+              for (i=0; ReplaceOptions[i].name; i++) {
+                 if (strcasecmp(lc->str, ReplaceOptions[i].name) == 0) {
+                     ((JOB *)(item->value))->replace = ReplaceOptions[i].token;
+                    i = 0;
+                    break;
+                 }
+              }
+              if (i != 0) {
                   scan_err1(lc, "Expected a Restore replacement option, got: %s", lc->str);
-               }
-               break;
-            } /* end switch */
-            break;
-         } /* end if strcmp() */
+              }
+              break;
+           } /* end switch */
+           break;
+        } /* end if strcmp() */
       } /* end for */
       if (!found) {
          scan_err1(lc, "%s not a valid Restore keyword", lc->str);
       }
    } /* end while */
-   lc->options = options;             /* reset original options */
+   lc->options = options;            /* reset original options */
    set_bit(index, res_all.hdr.item_present);
 }
 #endif
index dc5f2081f6aaa74575cdbe69f8a7ee23e40c2ebf..69df08e6b31955dce07c4166bbc3a2e27e0c564b 100644 (file)
@@ -37,6 +37,7 @@
 extern int r_first;
 extern int r_last;
 extern RES_TABLE resources[];
+extern RES **res_head;
 extern int console_msg_pending;
 extern FILE *con_fd;
 extern brwlock_t con_lock;
@@ -145,7 +146,8 @@ int show_cmd(UAContext *ua, const char *cmd)
            if (strncasecmp(res_name, _(reses[j].res_name), len) == 0) {
               type = reses[j].type;
               if (type > 0) {
-                 res = resources[type-r_first].res_head;
+                 res = res_head[type-r_first];
+//               res = resources[type-r_first].res_head;
               } else {
                  res = NULL;
               }
@@ -172,7 +174,8 @@ int show_cmd(UAContext *ua, const char *cmd)
       switch (type) {
       case -1:                          /* all */
         for (j=r_first; j<=r_last; j++) {
-           dump_resource(j, resources[j-r_first].res_head, bsendmsg, ua);     
+           dump_resource(j, res_head[j-r_first], bsendmsg, ua);     
+//         dump_resource(j, resources[j-r_first].res_head, bsendmsg, ua);     
         }
         break;
       case -2:
index cc032d78dfa61cb33cbe318278afcf636e05f8d7..c4c62fe620296b90ef942953bebd459713dc0baf 100644 (file)
@@ -114,11 +114,11 @@ extern RES_ITEM msgs_items[];
  * It must have one item for each of the resources.
  */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {"filedaemon",    cli_items,   R_CLIENT,    NULL},
-   {"client",        cli_items,   R_CLIENT,    NULL}, /* alias for filedaemon */
-   {"messages",      msgs_items,  R_MSGS,      NULL},
-   {NULL,           NULL,        0,           NULL}
+   {"director",      dir_items,   R_DIRECTOR},
+   {"filedaemon",    cli_items,   R_CLIENT},
+   {"client",        cli_items,   R_CLIENT},     /* alias for filedaemon */
+   {"messages",      msgs_items,  R_MSGS},
+   {NULL,           NULL,        0}
 };
 
 
@@ -309,12 +309,12 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-        resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+        res_head[rindex] = (RES *)res; /* store first entry */
       } else {
         RES *next;
         /* Add new res to end of chain */
-        for (next=resources[rindex].res_head; next->next; next=next->next) {
+        for (next=res_head[rindex]; next->next; next=next->next) {
            if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
               Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
index e2c0da44b29a37bef8e4e99029bcd5b0bccde1c8..1e0b3daffc2e8e6416cb385a18be35a2eedf980e 100644 (file)
@@ -99,10 +99,10 @@ static RES_ITEM con_font_items[] = {
  * It must have one item for each of the resources.
  */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {"console",       con_items,   R_CONSOLE,   NULL},
-   {"consolefont",   con_font_items, R_CONSOLE_FONT,   NULL},
-   {NULL,           NULL,        0,           NULL}
+   {"director",      dir_items,   R_DIRECTOR},
+   {"console",       con_items,   R_CONSOLE},
+   {"consolefont",   con_font_items, R_CONSOLE_FONT},
+   {NULL,           NULL,        0}
 };
 
 
@@ -267,12 +267,12 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-        resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+        res_head[rindex] = (RES *)res; /* store first entry */
       } else {
         RES *next;
         /* Add new res to end of chain */
-        for (next=resources[rindex].res_head; next->next; next=next->next) {
+        for (next=res_head[rindex]; next->next; next=next->next) {
            if (strcmp(next->name, res->dir_res.hdr.name) == 0) {
               Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
index ead6a9ebdf708de5b981d8cb85b5c2bf7280fde0..d2a47e2eb2cbace8b6f8e8639db9a0718652cc4f 100644 (file)
@@ -38,10 +38,10 @@ extern int debug_level;
  */
 void scan_to_eol(LEX *lc)
 {
-   Dmsg0(900, "start scan to eof\n");
+   Dmsg0(2000, "start scan to eof\n");
    while (lex_get_token(lc, T_ALL) != T_EOL)
       { }
-   Dmsg0(900, "done scan to eof\n");
+   Dmsg0(2000, "done scan to eof\n");
 }
 
    
@@ -78,18 +78,18 @@ LEX *lex_close_file(LEX *lf)
 {
    LEX *of;
 
-   Dmsg1(900, "Close lex file: %s\n", lf->fname);
+   Dmsg1(2000, "Close lex file: %s\n", lf->fname);
    if (lf == NULL) {
       Emsg0(M_ABORT, 0, "Close of NULL file\n");
    }
    of = lf->next;
    fclose(lf->fd);
-   Dmsg1(900, "Close cfg file %s\n", lf->fname);
+   Dmsg1(2000, "Close cfg file %s\n", lf->fname);
    free(lf->fname);
    if (of) {
       of->options = lf->options;      /* preserve options */
       memcpy(lf, of, sizeof(LEX));
-      Dmsg1(900, "Restart scan of cfg file %s\n", of->fname);
+      Dmsg1(2000, "Restart scan of cfg file %s\n", of->fname);
    } else {
       of = lf;
       lf = NULL;
@@ -122,7 +122,7 @@ LEX *lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error)
            fname, strerror(errno));
       return NULL; /* Never reached if exit_on_error == 1 */
    }
-   Dmsg1(900, "Open config file: %s\n", fname);
+   Dmsg1(2000, "Open config file: %s\n", fname);
    nf = (LEX *)malloc(sizeof(LEX));
    if (lf) {    
       memcpy(nf, lf, sizeof(LEX));
@@ -142,7 +142,7 @@ LEX *lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error)
    } else {
       lf->scan_error = s_err;
    }
-   Dmsg1(900, "Return lex=%x\n", lf);
+   Dmsg1(2000, "Return lex=%x\n", lf);
    return lf;
 }
 
@@ -174,7 +174,7 @@ int lex_get_char(LEX *lf)
    } else {
       lf->col_no++;
    }
-   Dmsg2(900, "lex_get_char: %c %d\n", lf->ch, lf->ch);
+   Dmsg2(2000, "lex_get_char: %c %d\n", lf->ch, lf->ch);
    return lf->ch;
 }
 
@@ -284,12 +284,12 @@ lex_get_token(LEX *lf, int expect)
    int token = T_NONE;
    int esc_next = FALSE;
 
-   Dmsg0(900, "enter lex_get_token\n");
+   Dmsg0(2000, "enter lex_get_token\n");
    while (token == T_NONE) {
       ch = lex_get_char(lf);
       switch (lf->state) {
       case lex_none:
-         Dmsg2(900, "Lex state lex_none ch=%d,%x\n", ch, ch);
+         Dmsg2(2000, "Lex state lex_none ch=%d,%x\n", ch, ch);
         if (B_ISSPACE(ch))  
            break;
         if (B_ISALPHA(ch)) {
@@ -305,11 +305,11 @@ lex_get_token(LEX *lf, int expect)
            begin_str(lf, ch);
            break;
         }
-         Dmsg0(900, "Enter lex_none switch\n");
+         Dmsg0(2000, "Enter lex_none switch\n");
         switch (ch) {
         case L_EOF:
            token = T_EOF;
-            Dmsg0(900, "got L_EOF set token=T_EOF\n");
+            Dmsg0(2000, "got L_EOF set token=T_EOF\n");
            break;
          case '#':
            lf->state = lex_comment;
@@ -338,7 +338,7 @@ lex_get_token(LEX *lf, int expect)
            token = T_EOL;      /* treat ; like EOL */
            break;
         case L_EOL:
-            Dmsg0(900, "got L_EOL set token=T_EOL\n");
+            Dmsg0(2000, "got L_EOL set token=T_EOL\n");
            token = T_EOL;
            break;
          case '@':
@@ -352,7 +352,7 @@ lex_get_token(LEX *lf, int expect)
         }
         break;
       case lex_comment:
-         Dmsg1(900, "Lex state lex_comment ch=%x\n", ch);
+         Dmsg1(2000, "Lex state lex_comment ch=%x\n", ch);
         if (ch == L_EOL) {
            lf->state = lex_none;
            token = T_EOL;
@@ -361,7 +361,7 @@ lex_get_token(LEX *lf, int expect)
         }
         break;
       case lex_number:
-         Dmsg2(900, "Lex state lex_number ch=%x %c\n", ch, ch);
+         Dmsg2(2000, "Lex state lex_number ch=%x %c\n", ch, ch);
         if (ch == L_EOF) {
            token = T_ERROR;
            break;
@@ -386,10 +386,10 @@ lex_get_token(LEX *lf, int expect)
            token = T_ERROR;
            break;
         }
-         Dmsg1(900, "Lex state lex_ip_addr ch=%x\n", ch);
+         Dmsg1(2000, "Lex state lex_ip_addr ch=%x\n", ch);
         break;
       case lex_string:
-         Dmsg1(900, "Lex state lex_string ch=%x\n", ch);
+         Dmsg1(2000, "Lex state lex_string ch=%x\n", ch);
         if (ch == L_EOF) {
            token = T_ERROR;
            break;
@@ -404,7 +404,7 @@ lex_get_token(LEX *lf, int expect)
         add_str(lf, ch);
         break;
       case lex_identifier:
-         Dmsg2(900, "Lex state lex_identifier ch=%x %c\n", ch, ch);
+         Dmsg2(2000, "Lex state lex_identifier ch=%x %c\n", ch, ch);
         if (B_ISALPHA(ch)) {
            add_str(lf, ch);
            break;
@@ -427,7 +427,7 @@ lex_get_token(LEX *lf, int expect)
         add_str(lf, ch);
         break;
       case lex_quoted_string:
-         Dmsg2(900, "Lex state lex_quoted_string ch=%x %c\n", ch, ch);
+         Dmsg2(2000, "Lex state lex_quoted_string ch=%x %c\n", ch, ch);
         if (ch == L_EOF) {
            token = T_ERROR;
            break;
@@ -462,17 +462,17 @@ lex_get_token(LEX *lf, int expect)
            lf->state = lex_none;
            lf = lex_open_file(lf, lf->str, NULL);
        if (lf == NULL) {
-         return T_ERROR;
+        return T_ERROR;
        }
            break;
         }
         add_str(lf, ch);
         break;
       }
-      Dmsg4(900, "ch=%d state=%s token=%s %c\n", ch, lex_state_to_str(lf->state),
+      Dmsg4(2000, "ch=%d state=%s token=%s %c\n", ch, lex_state_to_str(lf->state),
        lex_tok_to_str(token), ch);
    }
-   Dmsg2(900, "lex returning: line %d token: %s\n", lf->line_no, lex_tok_to_str(token));
+   Dmsg2(2000, "lex returning: line %d token: %s\n", lf->line_no, lex_tok_to_str(token));
    lf->token = token;
 
    /* 
@@ -526,7 +526,7 @@ lex_get_token(LEX *lf, int expect)
       break;
 
    case T_INT64:
-      Dmsg2(900, "int64=:%s: %f\n", lf->str, strtod(lf->str, NULL)); 
+      Dmsg2(2000, "int64=:%s: %f\n", lf->str, strtod(lf->str, NULL)); 
       if (token != T_NUMBER || !is_a_number(lf->str)) {
          scan_err2(lf, _("expected an integer number, got %s: %s"),
               lex_tok_to_str(token), lf->str);
index 711fe40602ba2ba3becd95d0fd39a5184dd57d7b..d29697d4b4584857e606df9629bb3a5e21194fef 100755 (executable)
@@ -65,6 +65,8 @@ extern int debug_level;
 extern int r_first;
 extern int r_last;
 extern RES_TABLE resources[];
+extern RES **res_head;
+
 #ifdef HAVE_WIN32
 // work around visual studio name manling preventing external linkage since res_all
 // is declared as a different type when instantiated.
@@ -635,7 +637,7 @@ GetResWithName(int rcode, char *name)
    int rindex = rcode - r_first;
 
    LockRes();
-   res = resources[rindex].res_head;
+   res = res_head[rindex];
    while (res) {
       if (strcmp(res->name, name) == 0) {
         break;
@@ -663,7 +665,7 @@ GetNextRes(int rcode, RES *res)
       Emsg0(M_ABORT, 0, "Resource chain not locked.\n");
    }
    if (res == NULL) {
-      nres = resources[rindex].res_head;
+      nres = res_head[rindex];
    } else {
       nres = res->next;
    }
@@ -802,7 +804,7 @@ parse_config(const char *cf, int exit_on_error)
       if (debug_level >= 900 && pass == 2) {
         int i;
         for (i=r_first; i<=r_last; i++) {
-           dump_resource(i, resources[i-r_first].res_head, prtmsg, NULL);
+           dump_resource(i, res_head[i-r_first], prtmsg, NULL);
         }
       }
       lc = lex_close_file(lc);
@@ -820,8 +822,8 @@ parse_config(const char *cf, int exit_on_error)
 void free_config_resources()
 {
    for (int i=r_first; i<=r_last; i++) {
-      free_resource(resources[i-r_first].res_head, i);
-      resources[i-r_first].res_head = NULL;
+      free_resource(res_head[i-r_first], i);
+      res_head[i-r_first] = NULL;
    }
 }
 
@@ -830,8 +832,8 @@ RES **save_config_resources()
    int num = r_last - r_first + 1;
    RES **res = (RES **)malloc(num*sizeof(RES *));
    for (int i=0; i<num; i++) {
-      res[i] = resources[i].res_head; 
-      resources[i].res_head = NULL;
+      res[i] = res_head[i];
+      res_head[i] = NULL;
    }
    return res;
 }
index 7e7e926d9fd252b44aead3fb351fc985a4b5bbbd..236369e956a65c81aa23b4f526507fd74774e5f8 100644 (file)
@@ -66,7 +66,6 @@ struct RES_TABLE {
    const char *name;                  /* resource name */
    RES_ITEM *items;                   /* list of resource keywords */
    int rcode;                         /* code if needed */
-   RES *res_head;                     /* where to store it */
 };
 
 /* Common Resource definitions */
index 79107c177200a47e0bcd9f0a957de60ddbfe6190..b0f604c1dc4d9e31eac3e1a8ba74c8f71314ecde 100644 (file)
@@ -132,11 +132,11 @@ extern RES_ITEM msgs_items[];
 
 /* This is the master resource definition */
 RES_TABLE resources[] = {
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {"storage",       store_items, R_STORAGE,   NULL},
-   {"device",        dev_items,   R_DEVICE,    NULL},
-   {"messages",      msgs_items,  R_MSGS,      NULL},
-   {NULL,           NULL,        0,           NULL}
+   {"director",      dir_items,   R_DIRECTOR},
+   {"storage",       store_items, R_STORAGE},
+   {"device",        dev_items,   R_DEVICE},
+   {"messages",      msgs_items,  R_MSGS},
+   {NULL,           NULL,        0}
 };
 
 
@@ -416,12 +416,12 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-        resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+        res_head[rindex] = (RES *)res; /* store first entry */
       } else {
         RES *next;
         /* Add new res to end of chain */
-        for (next=resources[rindex].res_head; next->next; next=next->next) {
+        for (next=res_head[rindex]; next->next; next=next->next) {
            if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
               Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"),
index cd0fe754facfb1093ba61b849f88f86ead111f00..6c78dbb9ec1f5713481f4a6a04c9f8fd4ae294ca 100644 (file)
@@ -101,9 +101,9 @@ static RES_ITEM dir_items[] = {
  * It must have one item for each of the resources.
  */
 RES_TABLE resources[] = {
-   {"console",       cons_items,  R_CONSOLE,   NULL},
-   {"director",      dir_items,   R_DIRECTOR,  NULL},
-   {NULL,       NULL,    0,         NULL}
+   {"console",       cons_items,  R_CONSOLE},
+   {"director",      dir_items,   R_DIRECTOR},
+   {NULL,       NULL,    0}
 };
 
 
@@ -256,11 +256,11 @@ void save_resource(int type, RES_ITEM *items, int pass)
    if (!error) {
       res = (URES *)malloc(size);
       memcpy(res, &res_all, size);
-      if (!resources[rindex].res_head) {
-    resources[rindex].res_head = (RES *)res; /* store first entry */
+      if (!res_head[rindex]) {
+    res_head[rindex] = (RES *)res; /* store first entry */
       } else {
     RES *next;
-    for (next=resources[rindex].res_head; next->next; next=next->next) {
+    for (next=res_head[rindex]; next->next; next=next->next) {
        if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
          Emsg2(M_ERROR_TERM, 0,
                   _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),