From: Eric Bollengier Date: Tue, 11 Aug 2009 08:15:01 +0000 (+0200) Subject: cleanups X-Git-Tag: Release-5.0.0~333^2~13^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dcca1b9dab64782a6007facce20fe3a20de9b2c2;p=bacula%2Fbacula cleanups --- diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 50b8b4ac1f..6d7e9fe90e 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -1033,7 +1033,11 @@ void status_slots(UAContext *ua, STORE *store_r) int i=1; /* output format */ const char *slot_api_empty_format="%i||||||||\n"; + + /* Slot|RealSlot|Volume|Bytes|Status|MediaType|Pool|LastW|Expire */ const char *slot_api_full_format="%i|%i|%s|%s|%s|%s|%s|%s|%s\n"; + + /* Slot | Volume | Status | MediaType | Pool */ const char *slot_hformat=" %4i%c| %16s | %9s | %20s | %18s |\n"; if (!open_client_db(ua)) { @@ -1085,12 +1089,13 @@ void status_slots(UAContext *ua, STORE *store_r) if (!vl->VolName) { Dmsg1(100, "No VolName for Slot=%d.\n", vl->Slot); - if (!ua->api) { + if (ua->api) { + ua->send_msg(slot_api_empty_format, vl->Slot); + + } else { ua->send_msg(slot_hformat, vl->Slot, '*', "?", "?", "?", "?"); - } else { - ua->send_msg(slot_api_empty_format, vl->Slot); } continue; } @@ -1098,11 +1103,12 @@ void status_slots(UAContext *ua, STORE *store_r) /* Hope that slots are ordered */ for (; i < vl->Slot; i++) { if (slot_list[i]) { - if (!ua->api) { + if (ua->api) { + ua->send_msg(slot_api_empty_format, i); + + } else { ua->send_msg(slot_hformat, i, ' ', "", "", "", ""); - } else { - ua->send_msg(slot_api_empty_format, i); } slot_list[i]=0; } @@ -1118,29 +1124,30 @@ void status_slots(UAContext *ua, STORE *store_r) strcpy(pr.Name, "?"); } - if (!ua->api) { - /* Print information */ - ua->send_msg(slot_hformat, - vl->Slot, ((vl->Slot==mr.Slot)?' ':'*'), - mr.VolumeName, mr.VolStatus, mr.MediaType, pr.Name); - } else { + if (ua->api) { ua->send_msg(slot_api_full_format, vl->Slot, mr.Slot, mr.VolumeName, edit_uint64(mr.VolBytes, ed1), mr.VolStatus, mr.MediaType, pr.Name, edit_uint64(mr.LastWritten, ed2), edit_uint64(mr.LastWritten+mr.VolRetention, ed3)); + } else { + /* Print information */ + ua->send_msg(slot_hformat, + vl->Slot, ((vl->Slot==mr.Slot)?' ':'*'), + mr.VolumeName, mr.VolStatus, mr.MediaType, pr.Name); } db_unlock(ua->db); continue; } else { /* TODO: get information from catalog */ - if (!ua->api) { + if (ua->api) { + ua->send_msg(slot_api_empty_format, vl->Slot); + + } else { ua->send_msg(slot_hformat, vl->Slot, '*', mr.VolumeName, "?", "?", "?"); - } else { - ua->send_msg(slot_api_empty_format, vl->Slot); } } db_unlock(ua->db); @@ -1151,10 +1158,11 @@ void status_slots(UAContext *ua, STORE *store_r) for (; i <= max_slots; i++) { if (slot_list[i]) { if (!ua->api) { + ua->send_msg(slot_api_empty_format, i); + + } else { ua->send_msg(slot_hformat, i, ' ', "", "", "", ""); - } else { - ua->send_msg(slot_api_empty_format, i); } slot_list[i]=0; }