From dcca1b9dab64782a6007facce20fe3a20de9b2c2 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 11 Aug 2009 10:15:01 +0200 Subject: [PATCH] cleanups --- bacula/src/dird/ua_label.c | 42 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) 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; } -- 2.39.5