]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.c
Remove delete of CVS files
[bacula/bacula] / bacula / src / lib / parse_conf.c
index 41177e10479a36d0b293e535e1089f74386a477c..18a103a65e5e4632ab52585e237824a5ac1f3abb 100755 (executable)
@@ -37,7 +37,7 @@
 
    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 ammended with additional clauses defined in the
+   version 2 as amended with additional clauses defined in the
    file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
@@ -185,6 +185,7 @@ void init_resource(int type, RES_ITEM *items, int pass)
    res_all.hdr.rcode = type;
    res_all.hdr.refcnt = 1;
 
+   /* Set defaults in each item */
    for (i=0; items[i].name; i++) {
       Dmsg3(900, "Item=%s def=%s defval=%d\n", items[i].name,
             (items[i].flags & ITEM_DEFAULT) ? "yes" : "no",
@@ -568,17 +569,6 @@ void store_defs(LEX *lc, RES_ITEM *item, int index, int pass)
         scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"),
            lc->str, lc->line_no, lc->line);
      }
-     /* for each item not set, we copy the field from res */
-#ifdef xxx
-     for (int i=0; item->name;; i++, item++) {
-        if (bit_is_set(i, res->item_present)) {
-           Dmsg2(900, "Item %d is present in %s\n", i, res->name);
-        } else {
-           Dmsg2(900, "Item %d is not present in %s\n", i, res->name);
-        }
-     }
-     /* ***FIXME **** add code */
-#endif
    }
    scan_to_eol(lc);
 }
@@ -629,9 +619,10 @@ void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
    case T_UNQUOTED_STRING:
       bstrncpy(bsize, lc->str, sizeof(bsize));  /* save first part */
       /* if terminated by space, scan and get modifier */
-      if (lc->ch == ' ') {
+      while (lc->ch == ' ') {
          token = lex_get_token(lc, T_ALL);
          switch (token) {
+         case T_NUMBER:
          case T_IDENTIFIER:
          case T_UNQUOTED_STRING:
             bstrncat(bsize, lc->str, sizeof(bsize));
@@ -647,7 +638,9 @@ void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
       scan_err1(lc, _("expected a size, got: %s"), lc->str);
       break;
    }
-   scan_to_eol(lc);
+   if (token != T_EOL) {
+      scan_to_eol(lc);
+   }
    set_bit(index, res_all.hdr.item_present);
    Dmsg0(900, "Leave store_size\n");
 }
@@ -668,9 +661,10 @@ void store_time(LEX *lc, RES_ITEM *item, int index, int pass)
    case T_UNQUOTED_STRING:
       bstrncpy(period, lc->str, sizeof(period));  /* get first part */
       /* if terminated by space, scan and get modifier */
-      if (lc->ch == ' ') {
+      while (lc->ch == ' ') {
          token = lex_get_token(lc, T_ALL);
          switch (token) {
+         case T_NUMBER:
          case T_IDENTIFIER:
          case T_UNQUOTED_STRING:
             bstrncat(period, lc->str, sizeof(period));
@@ -702,7 +696,7 @@ void store_yesno(LEX *lc, RES_ITEM *item, int index, int pass)
    } else if (strcasecmp(lc->str, "no") == 0) {
       *(int *)(item->value) &= ~(item->code);
    } else {
-      scan_err1(lc, _("Expect a YES or NO, got: %s"), lc->str);
+      scan_err3(lc, _("Expect a %s or %s, got: %s"), "YES", "NO", lc->str); /* YES and NO must not be translated */
    }
    scan_to_eol(lc);
    set_bit(index, res_all.hdr.item_present);
@@ -726,7 +720,7 @@ void store_label(LEX *lc, RES_ITEM *item, int index, int pass)
       }
    }
    if (i != 0) {
-      scan_err1(lc, "Expected a Tape Label keyword, got: %s", lc->str);
+      scan_err1(lc, _("Expected a Tape Label keyword, got: %s"), lc->str);
    }
    scan_to_eol(lc);
    set_bit(index, res_all.hdr.item_present);
@@ -826,7 +820,7 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
                            return 0;
                         }
                      }
-                     Dmsg1(900, "calling handler for %s\n", items[i].name);
+                     Dmsg1(800, "calling handler for %s\n", items[i].name);
                      /* Call item handler */
                      items[i].handler(lc, &items[i], i, pass);
                      i = -1;