static void update_volinchanger(UAContext *ua, char *val, MEDIA_DBR *mr) { int InChanger; char ed1[50]; POOL_MEM query(PM_MESSAGE); if (!is_yesno(val, &InChanger)) { ua->error_msg(_("Invalid value. It must be yes or no.\n")); return; } Mmsg(query, "UPDATE Media SET InChanger=%d WHERE MediaId=%s", InChanger, edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { ua->error_msg("%s", db_strerror(ua->db)); } else { ua->info_msg(_("New InChanger flag is: %s\n"), InChanger==1?_("yes"):_("no")); } }
static void update_volrecycle(UAContext *ua, char *val, MEDIA_DBR *mr) { int recycle; char ed1[50]; POOL_MEM query(PM_MESSAGE); if (!is_yesno(val, &recycle)) { ua->error_msg(_("Invalid value. It must be yes or no.\n")); return; } Mmsg(query, "UPDATE Media SET Recycle=%d WHERE MediaId=%s", recycle, edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str())) { ua->error_msg("%s", db_strerror(ua->db)); } else { ua->info_msg(_("New Recycle flag is: %s\n"), recycle==1?_("yes"):_("no")); } }
/* * Confirm a retention period */ bool confirm_retention(UAContext *ua, utime_t *ret, const char *msg) { bool retval; char ed1[100]; int yes_in_arg; yes_in_arg = find_arg(ua, NT_("yes")); for ( ;; ) { ua->info_msg(_("The current %s retention period is: %s\n"), msg, edit_utime(*ret, ed1, sizeof(ed1))); if (yes_in_arg != -1) { return true; } if (!get_cmd(ua, _("Continue? (yes/mod/no): "))) { return false; } if (bstrcasecmp(ua->cmd, _("mod"))) { if (!get_cmd(ua, _("Enter new retention period: "))) { return false; } if (!duration_to_utime(ua->cmd, ret)) { ua->error_msg(_("Invalid period.\n")); continue; } continue; } if (is_yesno(ua->cmd, &retval)) { return retval; } } return true; }