*
* 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},
(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;
/* 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)
*
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;