]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / lib / parse_conf.c
index 1e8b2be9edbbb60b64fa8928971c4756b1b5bacc..5e1ca4b1b72c5e1864c88e0ba47ea333a0ce2a83 100755 (executable)
@@ -136,7 +136,7 @@ struct s_kw {
  *
  *   tape label      label code = token
  */
-static s_kw tapelabels[] = {
+struct s_kw tapelabels[] = {
    {"bacula",        B_BACULA_LABEL},
    {"ansi",          B_ANSI_LABEL},
    {"ibm",           B_IBM_LABEL},
@@ -191,10 +191,8 @@ void init_resource(int type, RES_ITEM *items, int pass)
             (items[i].flags & ITEM_DEFAULT) ? "yes" : "no",
             items[i].default_value);
       if (items[i].flags & ITEM_DEFAULT && items[i].default_value != 0) {
-         if (items[i].handler == store_bit) {
+         if (items[i].handler == store_yesno) {
             *(int *)(items[i].value) |= items[i].code;
-         } else if (items[i].handler == store_bool) {
-            *(bool *)(items[i].value) = items[i].default_value;
          } else if (items[i].handler == store_pint ||
                     items[i].handler == store_int) {
             *(int *)(items[i].value) = items[i].default_value;
@@ -690,36 +688,20 @@ void store_time(LEX *lc, RES_ITEM *item, int index, int pass)
 
 
 /* Store a yes/no in a bit field */
-void store_bit(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_yesno(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    lex_get_token(lc, T_NAME);
-   if (strcasecmp(lc->str, "yes") == 0 || strcasecmp(lc->str, "true") == 0) {
+   if (strcasecmp(lc->str, "yes") == 0) {
       *(int *)(item->value) |= item->code;
-   } else if (strcasecmp(lc->str, "no") == 0 || strcasecmp(lc->str, "false") == 0) {
+   } else if (strcasecmp(lc->str, "no") == 0) {
       *(int *)(item->value) &= ~(item->code);
    } else {
-      scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */
+      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);
 }
 
-/* Store a bool in a bit field */
-void store_bool(LEX *lc, RES_ITEM *item, int index, int pass)
-{
-   lex_get_token(lc, T_NAME);
-   if (strcasecmp(lc->str, "yes") == 0 || strcasecmp(lc->str, "true") == 0) {
-      *(bool *)(item->value) = true;
-   } else if (strcasecmp(lc->str, "no") == 0 || strcasecmp(lc->str, "false") == 0) {
-      *(bool *)(item->value) = false;
-   } else {
-      scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */
-   }
-   scan_to_eol(lc);
-   set_bit(index, res_all.hdr.item_present);
-}
-
-
 /*
  * Store Tape Label Type (Bacula, ANSI, IBM)
  *
@@ -858,6 +840,9 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
                level--;
                state = p_none;
                Dmsg0(900, "T_EOB => define new resource\n");
+               if (res_all.hdr.name == NULL) {
+                  scan_err0(lc, _("Name not specified for resource"));
+               }
                save_resource(res_type, items, pass);  /* save resource */
                break;