static void print_findex(UAContext *ua, RBSR_FINDEX *fi)
{
- bsendmsg(ua, "fi=0x%lx\n", fi);
+ ua->send_msg("fi=0x%lx\n", fi);
for ( ; fi; fi=fi->next) {
if (fi->findex == fi->findex2) {
- bsendmsg(ua, "FileIndex=%d\n", fi->findex);
+ ua->send_msg("FileIndex=%d\n", fi->findex);
Dmsg1(1000, "FileIndex=%d\n", fi->findex);
} else {
- bsendmsg(ua, "FileIndex=%d-%d\n", fi->findex, fi->findex2);
+ ua->send_msg("FileIndex=%d-%d\n", fi->findex, fi->findex2);
Dmsg2(1000, "FileIndex=%d-%d\n", fi->findex, fi->findex2);
}
}
memset(&jr, 0, sizeof(jr));
jr.JobId = bsr->JobId;
if (!db_get_job_record(ua->jcr, ua->db, &jr)) {
- bsendmsg(ua, _("Unable to get Job record. ERR=%s\n"), db_strerror(ua->db));
+ ua->error_msg(_("Unable to get Job record. ERR=%s\n"), db_strerror(ua->db));
return false;
}
bsr->VolSessionId = jr.VolSessionId;
bsr->VolSessionTime = jr.VolSessionTime;
if ((bsr->VolCount=db_get_job_volume_parameters(ua->jcr, ua->db, bsr->JobId,
&(bsr->VolParams))) == 0) {
- bsendmsg(ua, _("Unable to get Job Volume Parameters. ERR=%s\n"), db_strerror(ua->db));
+ ua->error_msg(_("Unable to get Job Volume Parameters. ERR=%s\n"), db_strerror(ua->db));
if (bsr->VolParams) {
free(bsr->VolParams);
bsr->VolParams = NULL;
fd = fopen(fname.c_str(), "w+b");
if (!fd) {
berrno be;
- bsendmsg(ua, _("Unable to create bootstrap file %s. ERR=%s\n"),
+ ua->error_msg(_("Unable to create bootstrap file %s. ERR=%s\n"),
fname.c_str(), be.strerror());
goto bail_out;
}
err = ferror(fd);
fclose(fd);
if (count == 0) {
- bsendmsg(ua, _("No files found to restore/migrate. No bootstrap file written.\n"));
+ ua->info_msg(_("No files found to restore/migrate. No bootstrap file written.\n"));
goto bail_out;
}
if (err) {
- bsendmsg(ua, _("Error writing bsr file.\n"));
+ ua->error_msg(_("Error writing bsr file.\n"));
count = 0;
goto bail_out;
}
- bsendmsg(ua, _("Bootstrap records written to %s\n"), fname.c_str());
+ ua->send_msg(_("Bootstrap records written to %s\n"), fname.c_str());
/* Tell the user what he will need to mount */
- bsendmsg(ua, "\n");
- bsendmsg(ua, _("The job will require the following\n"
+ ua->send_msg("\n");
+ ua->send_msg(_("The job will require the following\n"
" Volume(s) Storage(s) SD Device(s)\n"
"===========================================================================\n"));
/* Create Unique list of Volumes using prompt list */
}
}
for (int i=0; i < ua->num_prompts; i++) {
- bsendmsg(ua, " %s\n", ua->prompt[i]);
+ ua->send_msg(" %s\n", ua->prompt[i]);
free(ua->prompt[i]);
}
if (ua->num_prompts == 0) {
- bsendmsg(ua, _("No Volumes found to restore.\n"));
+ ua->send_msg(_("No Volumes found to restore.\n"));
count = 0;
}
ua->num_prompts = 0;
- bsendmsg(ua, "\n");
+ ua->send_msg("\n");
bail_out:
return count;
{
for ( ; bsr; bsr=bsr->next) {
for (int i=0; i < bsr->VolCount; i++) {
- bsendmsg(ua, "Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
- bsendmsg(ua, "MediaType\"%s\"\n", bsr->VolParams[i].MediaType);
- bsendmsg(ua, "VolSessionId=%u\n", bsr->VolSessionId);
- bsendmsg(ua, "VolSessionTime=%u\n", bsr->VolSessionTime);
- bsendmsg(ua, "VolFile=%u-%u\n", bsr->VolParams[i].StartFile,
+ ua->send_msg("Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
+ ua->send_msg("MediaType\"%s\"\n", bsr->VolParams[i].MediaType);
+ ua->send_msg("VolSessionId=%u\n", bsr->VolSessionId);
+ ua->send_msg("VolSessionTime=%u\n", bsr->VolSessionTime);
+ ua->send_msg("VolFile=%u-%u\n", bsr->VolParams[i].StartFile,
bsr->VolParams[i].EndFile);
- bsendmsg(ua, "VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock,
+ ua->send_msg("VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock,
bsr->VolParams[i].EndBlock);
print_findex(ua, bsr->fi);
}
case JS_WaitPriority:
case JS_WaitMaxJobs:
case JS_WaitStartTime:
- bsendmsg(ua, _("JobId %s, Job %s marked to be canceled.\n"),
+ ua->info_msg(_("JobId %s, Job %s marked to be canceled.\n"),
edit_uint64(jcr->JobId, ed1), jcr->Job);
jobq_remove(&job_queue, jcr); /* attempt to remove it from queue */
return true;
if (jcr->file_bsock) {
ua->jcr->client = jcr->client;
if (!connect_to_file_daemon(ua->jcr, 10, FDConnectTimeout, 1)) {
- bsendmsg(ua, _("Failed to connect to File daemon.\n"));
+ ua->error_msg(_("Failed to connect to File daemon.\n"));
return 0;
}
Dmsg0(200, "Connected to file daemon\n");
fd = ua->jcr->file_bsock;
bnet_fsend(fd, "cancel Job=%s\n", jcr->Job);
while (bnet_recv(fd) >= 0) {
- bsendmsg(ua, "%s", fd->msg);
+ ua->send_msg("%s", fd->msg);
}
bnet_sig(fd, BNET_TERMINATE);
bnet_close(fd);
}
if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
- bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
+ ua->error_msg(_("Failed to connect to Storage daemon.\n"));
return false;
}
Dmsg0(200, "Connected to storage daemon\n");
sd = ua->jcr->store_bsock;
- bnet_fsend(sd, "cancel Job=%s\n", jcr->Job);
- while (bnet_recv(sd) >= 0) {
- bsendmsg(ua, "%s", sd->msg);
+ sd->fsend("cancel Job=%s\n", jcr->Job);
+ while (sd->recv() >= 0) {
+ ua->send_msg("%s", sd->msg);
}
- bnet_sig(sd, BNET_TERMINATE);
- bnet_close(sd);
+ sd->signal(BNET_TERMINATE);
+ sd->close();
ua->jcr->store_bsock = NULL;
}
}
-/*
- *
- * Bacula Director -- Tape labeling commands
- *
- * Kern Sibbald, April MMIII
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2003-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2003-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Bacula Director -- Tape labeling commands
+ *
+ * Kern Sibbald, April MMIII
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "dird.h"
max_slots = get_num_slots_from_SD(ua);
Dmsg1(100, "max_slots=%d\n", max_slots);
if (max_slots <= 0) {
- bsendmsg(ua, _("No slots in changer to scan.\n"));
+ ua->warning_msg(_("No slots in changer to scan.\n"));
return;
}
slot_list = (char *)malloc(max_slots+1);
vol_list = get_vol_list_from_SD(ua, scan);
if (!vol_list) {
- bsendmsg(ua, _("No Volumes found to label, or no barcodes.\n"));
+ ua->warning_msg(_("No Volumes found to label, or no barcodes.\n"));
goto bail_out;
}
/* Walk through the list updating the media records */
for (vl=vol_list; vl; vl=vl->next) {
if (vl->Slot > max_slots) {
- bsendmsg(ua, _("Slot %d greater than max %d ignored.\n"),
+ ua->warning_msg(_("Slot %d greater than max %d ignored.\n"),
vl->Slot, max_slots);
continue;
}
db_unlock(ua->db);
if (!vl->VolName) {
Dmsg1(000, "No VolName for Slot=%d setting InChanger to zero.\n", vl->Slot);
- bsendmsg(ua, _("No VolName for Slot=%d InChanger set to zero.\n"), vl->Slot);
+ ua->info_msg(_("No VolName for Slot=%d InChanger set to zero.\n"), vl->Slot);
continue;
}
memset(&mr, 0, sizeof(mr));
mr.Enabled = Enabled;
}
if (!db_update_media_record(ua->jcr, ua->db, &mr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
} else {
- bsendmsg(ua, _(
+ ua->info_msg(_(
"Catalog record for Volume \"%s\" updated to reference slot %d.\n"),
mr.VolumeName, mr.Slot);
}
} else {
- bsendmsg(ua, _("Catalog record for Volume \"%s\" is up to date.\n"),
+ ua->info_msg(_("Catalog record for Volume \"%s\" is up to date.\n"),
mr.VolumeName);
}
db_unlock(ua->db);
continue;
} else {
- bsendmsg(ua, _("Volume \"%s\" not found in catalog. Slot=%d InChanger set to zero.\n"),
+ ua->warning_msg(_("Volume \"%s\" not found in catalog. Slot=%d InChanger set to zero.\n"),
mr.VolumeName, vl->Slot);
}
db_unlock(ua->db);
if (db_get_media_record(ua->jcr, ua->db, &omr)) {
goto checkVol;
}
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
/* No keyword or Vol not found, ask user to select */
if (!select_media_dbr(ua, &omr)) {
/* Require Volume to be Purged or Recycled */
checkVol:
if (strcmp(omr.VolStatus, "Purged") != 0 && strcmp(omr.VolStatus, "Recycle") != 0) {
- bsendmsg(ua, _("Volume \"%s\" has VolStatus %s. It must be Purged or Recycled before relabeling.\n"),
+ ua->error_msg(_("Volume \"%s\" has VolStatus %s. It must be Purged or Recycled before relabeling.\n"),
omr.VolumeName, omr.VolStatus);
return 1;
}
/* If VolBytes are zero the Volume is not labeled */
if (db_get_media_record(ua->jcr, ua->db, &mr)) {
if (mr.VolBytes != 0) {
- bsendmsg(ua, _("Media record for new Volume \"%s\" already exists.\n"),
+ ua->error_msg(_("Media record for new Volume \"%s\" already exists.\n"),
mr.VolumeName);
continue;
}
if (relabel) {
/* Delete the old media record */
if (!db_delete_media_record(ua->jcr, ua->db, &omr)) {
- bsendmsg(ua, _("Delete of Volume \"%s\" failed. ERR=%s"),
+ ua->error_msg(_("Delete of Volume \"%s\" failed. ERR=%s"),
omr.VolumeName, db_strerror(ua->db));
} else {
- bsendmsg(ua, _("Old volume \"%s\" deleted from catalog.\n"),
+ ua->info_msg(_("Old volume \"%s\" deleted from catalog.\n"),
omr.VolumeName);
/* Update the number of Volumes in the pool */
pr.NumVols--;
if (!db_update_pool_record(ua->jcr, ua->db, &pr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
}
}
if (ua->automount) {
bstrncpy(dev_name, store.store->dev_name(), sizeof(dev_name));
- bsendmsg(ua, _("Requesting to mount %s ...\n"), dev_name);
+ ua->info_msg(_("Requesting to mount %s ...\n"), dev_name);
bash_spaces(dev_name);
bnet_fsend(sd, "mount %s drive=%d", dev_name, drive);
unbash_spaces(dev_name);
while (bnet_recv(sd) >= 0) {
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
/* Here we can get
* 3001 OK mount. Device=xxx or
* 3001 Mounted Volume vvvv
}
}
if (print_reminder) {
- bsendmsg(ua, _("Do not forget to mount the drive!!!\n"));
+ ua->info_msg(_("Do not forget to mount the drive!!!\n"));
}
close_sd_bsock(ua);
max_slots = get_num_slots_from_SD(ua);
if (max_slots <= 0) {
- bsendmsg(ua, _("No slots in changer to scan.\n"));
+ ua->warning_msg(_("No slots in changer to scan.\n"));
return;
}
slot_list = (char *)malloc(max_slots+1);
vol_list = get_vol_list_from_SD(ua, false /*no scan*/);
if (!vol_list) {
- bsendmsg(ua, _("No Volumes found to label, or no barcodes.\n"));
+ ua->warning_msg(_("No Volumes found to label, or no barcodes.\n"));
goto bail_out;
}
/* Display list of Volumes and ask if he really wants to proceed */
- bsendmsg(ua, _("The following Volumes will be labeled:\n"
+ ua->send_msg(_("The following Volumes will be labeled:\n"
"Slot Volume\n"
"==============\n"));
for (vl=vol_list; vl; vl=vl->next) {
if (!vl->VolName || !slot_list[vl->Slot]) {
continue;
}
- bsendmsg(ua, "%4d %s\n", vl->Slot, vl->VolName);
+ ua->send_msg("%4d %s\n", vl->Slot, vl->VolName);
}
if (!get_yesno(ua, _("Do you want to continue? (yes|no): ")) ||
(ua->pint32_val == 0)) {
media_record_exists = false;
if (db_get_media_record(ua->jcr, ua->db, &mr)) {
if (mr.VolBytes != 0) {
- bsendmsg(ua, _("Media record for Slot %d Volume \"%s\" already exists.\n"),
+ ua->warning_msg(_("Media record for Slot %d Volume \"%s\" already exists.\n"),
vl->Slot, mr.VolumeName);
mr.Slot = vl->Slot;
mr.InChanger = 1;
mr.StorageId = store->StorageId;
if (!db_update_media_record(ua->jcr, ua->db, &mr)) {
- bsendmsg(ua, _("Error setting InChanger: ERR=%s"), db_strerror(ua->db));
+ ua->error_msg(_("Error setting InChanger: ERR=%s"), db_strerror(ua->db));
}
continue;
}
mr.MediaType[0] = 0;
mr.StorageId = store->StorageId;
if (!db_update_media_record(ua->jcr, ua->db, &mr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
} else { /* create the media record */
if (pr.MaxVols > 0 && pr.NumVols >= pr.MaxVols) {
- bsendmsg(ua, _("Maximum pool Volumes=%d reached.\n"), pr.MaxVols);
+ ua->error_msg(_("Maximum pool Volumes=%d reached.\n"), pr.MaxVols);
goto bail_out;
}
set_pool_dbr_defaults_in_media_dbr(&mr, &pr);
bstrncpy(mr.VolStatus, "Cleaning", sizeof(mr.VolStatus));
mr.MediaType[0] = 0;
if (db_create_media_record(ua->jcr, ua->db, &mr)) {
- bsendmsg(ua, _("Catalog record for cleaning tape \"%s\" successfully created.\n"),
+ ua->send_msg(_("Catalog record for cleaning tape \"%s\" successfully created.\n"),
mr.VolumeName);
pr.NumVols++; /* this is a bit suspect */
if (!db_update_pool_record(ua->jcr, ua->db, &pr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
} else {
- bsendmsg(ua, _("Catalog error on cleaning tape: %s"), db_strerror(ua->db));
+ ua->error_msg(_("Catalog error on cleaning tape: %s"), db_strerror(ua->db));
}
}
continue; /* done, go handle next volume */
continue;
}
if (ua) {
- bsendmsg(ua, _("Illegal character \"%c\" in a volume name.\n"), *p);
+ ua->error_msg(_("Illegal character \"%c\" in a volume name.\n"), *p);
}
return 0;
}
len = strlen(name);
if (len >= MAX_NAME_LENGTH) {
if (ua) {
- bsendmsg(ua, _("Volume name too long.\n"));
+ ua->error_msg(_("Volume name too long.\n"));
}
return 0;
}
if (len == 0) {
if (ua) {
- bsendmsg(ua, _("Volume name must be at least one character long.\n"));
+ ua->error_msg(_("Volume name must be at least one character long.\n"));
}
return 0;
}
"MediaType=%s Slot=%d drive=%d",
dev_name, omr->VolumeName, mr->VolumeName, pr->Name,
mr->MediaType, mr->Slot, drive);
- bsendmsg(ua, _("Sending relabel command from \"%s\" to \"%s\" ...\n"),
+ ua->send_msg(_("Sending relabel command from \"%s\" to \"%s\" ...\n"),
omr->VolumeName, mr->VolumeName);
} else {
bnet_fsend(sd, "label %s VolumeName=%s PoolName=%s MediaType=%s "
"Slot=%d drive=%d",
dev_name, mr->VolumeName, pr->Name, mr->MediaType,
mr->Slot, drive);
- bsendmsg(ua, _("Sending label command for Volume \"%s\" Slot %d ...\n"),
+ ua->send_msg(_("Sending label command for Volume \"%s\" Slot %d ...\n"),
mr->VolumeName, mr->Slot);
Dmsg6(100, "label %s VolumeName=%s PoolName=%s MediaType=%s Slot=%d drive=%d\n",
dev_name, mr->VolumeName, pr->Name, mr->MediaType, mr->Slot, drive);
while (bnet_recv(sd) >= 0) {
int dvd;
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu DVD=%d ", &VolBytes,
&dvd) == 2) {
is_dvd = dvd;
mr->InChanger = 1;
mr->StorageId = ua->jcr->wstore->StorageId;
if (!db_update_media_record(ua->jcr, ua->db, mr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
ok = false;
}
} else { /* create the media record */
mr->StorageId = ua->jcr->wstore->StorageId;
mr->Enabled = 1;
if (db_create_media_record(ua->jcr, ua->db, mr)) {
- bsendmsg(ua, _("Catalog record for Volume \"%s\", Slot %d successfully created.\n"),
+ ua->info_msg(_("Catalog record for Volume \"%s\", Slot %d successfully created.\n"),
mr->VolumeName, mr->Slot);
/* Update number of volumes in pool */
pr->NumVols++;
if (!db_update_pool_record(ua->jcr, ua->db, pr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
} else {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
ok = false;
}
}
} else {
- bsendmsg(ua, _("Label command failed for Volume %s.\n"), mr->VolumeName);
+ ua->error_msg(_("Label command failed for Volume %s.\n"), mr->VolumeName);
}
return ok;
}
STORE *store = ua->jcr->wstore;
if (!ua->jcr->store_bsock) {
- bsendmsg(ua, _("Connecting to Storage daemon %s at %s:%d ...\n"),
+ ua->send_msg(_("Connecting to Storage daemon %s at %s:%d ...\n"),
store->name(), store->address, store->SDport);
if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
- bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
+ ua->error_msg(_("Failed to connect to Storage daemon.\n"));
return NULL;
}
}
int rtn_slot;
if (!(sd=open_sd_bsock(ua))) {
- bsendmsg(ua, _("Could not open SD socket.\n"));
+ ua->error_msg(_("Could not open SD socket.\n"));
return NULL;
}
bstrncpy(dev_name, store->dev_name(), sizeof(dev_name));
/* Get Volume name in this Slot */
while (bnet_recv(sd) >= 0) {
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
Dmsg1(100, "Got: %s", sd->msg);
if (strncmp(sd->msg, NT_("3001 Volume="), 12) == 0) {
VolName = (char *)malloc(sd->msglen);
if (sd->msg[0] == '3' && B_ISDIGIT(sd->msg[1]) &&
B_ISDIGIT(sd->msg[2]) && B_ISDIGIT(sd->msg[3]) &&
sd->msg[4] == ' ') {
- bsendmsg(ua, "%s\n", sd->msg); /* pass them on to user */
+ ua->send_msg("%s\n", sd->msg); /* pass them on to user */
continue;
}
if (Slot <= 0) {
p--;
*p = ':';
- bsendmsg(ua, _("Invalid Slot number: %s\n"), sd->msg);
+ ua->error_msg(_("Invalid Slot number: %s\n"), sd->msg);
continue;
}
} else {
if (!is_an_integer(sd->msg) || (Slot=atoi(sd->msg)) <= 0) {
p--;
*p = ':';
- bsendmsg(ua, _("Invalid Slot number: %s\n"), sd->msg);
+ ua->error_msg(_("Invalid Slot number: %s\n"), sd->msg);
continue;
}
} else {
if (!is_volume_name_legal(ua, p)) {
p--;
*p = ':';
- bsendmsg(ua, _("Invalid Volume name: %s\n"), sd->msg);
+ ua->error_msg(_("Invalid Volume name: %s\n"), sd->msg);
continue;
}
}
if (sscanf(sd->msg, "slots=%d\n", &slots) == 1) {
break;
} else {
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
}
}
close_sd_bsock(ua);
- bsendmsg(ua, _("Device \"%s\" has %d slots.\n"), store->dev_name(), slots);
+ ua->send_msg(_("Device \"%s\" has %d slots.\n"), store->dev_name(), slots);
return slots;
}
if (sscanf(sd->msg, NT_("drives=%d\n"), &drives) == 1) {
break;
} else {
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
}
}
close_sd_bsock(ua);
/* Find Pool resource */
ua->jcr->pool = (POOL *)GetResWithName(R_POOL, pr->Name);
if (!ua->jcr->pool) {
- bsendmsg(ua, _("Pool \"%s\" resource not found for volume \"%s\"!\n"),
+ ua->error_msg(_("Pool \"%s\" resource not found for volume \"%s\"!\n"),
pr->Name, mr->VolumeName);
return false;
}
ua->auto_display_messages = false;
break;
default:
- bsendmsg(ua, _("ON or OFF keyword missing.\n"));
+ ua->error_msg(_("ON or OFF keyword missing.\n"));
break;
}
return 1;
ua->jcr->gui = ua->gui = false;
break;
default:
- bsendmsg(ua, _("ON or OFF keyword missing.\n"));
+ ua->error_msg(_("ON or OFF keyword missing.\n"));
break;
}
return 1;
}
break;
case -2:
- bsendmsg(ua, _("Keywords for the show command are:\n"));
+ ua->send_msg(_("Keywords for the show command are:\n"));
for (j=0; reses[j].res_name; j++) {
- bsendmsg(ua, "%s\n", _(reses[j].res_name));
+ ua->error_msg("%s\n", _(reses[j].res_name));
}
goto bail_out;
case -3:
- bsendmsg(ua, _("%s resource %s not found.\n"), res_name, ua->argv[i]);
+ ua->error_msg(_("%s resource %s not found.\n"), res_name, ua->argv[i]);
goto bail_out;
case 0:
- bsendmsg(ua, _("Resource %s not found\n"), res_name);
+ ua->error_msg(_("Resource %s not found\n"), res_name);
goto bail_out;
default:
dump_resource(recurse?type:-type, res, bsendmsg, ua);
Dmsg1(20, "list: %s\n", cmd);
if (!ua->db) {
- bsendmsg(ua, _("Hey! DB is NULL\n"));
+ ua->error_msg(_("Hey! DB is NULL\n"));
}
/* Scan arguments looking for things to do */
}
VolumeName = get_pool_memory(PM_FNAME);
n = db_get_job_volume_names(ua->jcr, ua->db, jobid, &VolumeName);
- bsendmsg(ua, _("Jobid %d used %d Volume(s): %s\n"), jobid, n, VolumeName);
+ ua->send_msg(_("Jobid %d used %d Volume(s): %s\n"), jobid, n, VolumeName);
free_pool_memory(VolumeName);
done = true;
}
for (i=1; i<ua->argc; i++) {
if (strcasecmp(ua->argk[i], NT_("pool")) == 0) {
if (!get_pool_dbr(ua, &pr)) {
- bsendmsg(ua, _("No Pool specified.\n"));
+ ua->error_msg(_("No Pool specified.\n"));
return 1;
}
mr.PoolId = pr.PoolId;
/* List Volumes in all pools */
if (!db_get_pool_ids(ua->jcr, ua->db, &num_pools, &ids)) {
- bsendmsg(ua, _("Error obtaining pool ids. ERR=%s\n"),
+ ua->error_msg(_("Error obtaining pool ids. ERR=%s\n"),
db_strerror(ua->db));
return 1;
}
for (i=0; i < num_pools; i++) {
pr.PoolId = ids[i];
if (db_get_pool_record(ua->jcr, ua->db, &pr)) {
- bsendmsg(ua, _("Pool: %s\n"), pr.Name);
+ ua->send_msg(_("Pool: %s\n"), pr.Name);
}
mr.PoolId = ids[i];
db_list_media_records(ua->jcr, ua->db, &mr, prtit, ua, llist);
if (j >= 0) {
n = atoi(ua->argv[j]);
if ((n < 0) || (n > 50)) {
- bsendmsg(ua, _("Ignoring invalid value for days. Max is 50.\n"));
+ ua->warning_msg(_("Ignoring invalid value for days. Max is 50.\n"));
n = 1;
}
}
|| strcasecmp(ua->argk[i], NT_("days")) == 0) {
/* Ignore it */
} else {
- bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i]));
+ ua->error_msg(_("Unknown list keyword: %s\n"), NPRT(ua->argk[i]));
}
}
return 1;
get_job_storage(&store, job, run);
mr.StorageId = store.store->StorageId;
if (!find_next_volume_for_append(jcr, &mr, 1, fnv_no_create_vol, fnv_prune)) {
- bsendmsg(ua, _("Could not find next Volume for Job %s (%s, %s).\n"),
+ ua->error_msg(_("Could not find next Volume for Job %s (%s, %s).\n"),
job->hdr.name, pr.Name, level_to_str(run->level));
} else {
- bsendmsg(ua,
+ ua->send_msg(
_("The next Volume to be used by Job \"%s\" (%s, %s) will be %s\n"),
job->hdr.name, pr.Name, level_to_str(run->level), mr.VolumeName);
found = true;
}
}
if (!found) {
- bsendmsg(ua, _("Could not find next Volume for Job %s.\n"),
+ ua->error_msg(_("Could not find next Volume for Job %s.\n"),
job->hdr.name);
return false;
}
return false;
}
if (mr.Enabled == 2) {
- bsendmsg(ua, _("Cannot prune Volume \"%s\" because it is archived.\n"),
+ ua->error_msg(_("Cannot prune Volume \"%s\" because it is archived.\n"),
mr.VolumeName);
+ return false;
}
if (!confirm_retention(ua, &mr.VolRetention, "Volume")) {
return false;
(uint32_t)period, query.c_str());
cnt.count = 0;
if (!db_sql_query(ua->db, query.c_str(), del_count_handler, (void *)&cnt)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
Dmsg0(050, "Count failed\n");
goto bail_out;
}
if (cnt.count == 0) {
if (ua->verbose) {
- bsendmsg(ua, _("No Files found to prune.\n"));
+ ua->warning_msg(_("No Files found to prune.\n"));
}
goto bail_out;
}
purge_files_from_job_list(ua, del);
edit_uint64_with_commas(del.num_del, ed1);
- bsendmsg(ua, _("Pruned Files from %s Jobs for client %s from catalog.\n"),
+ ua->info_msg(_("Pruned Files from %s Jobs for client %s from catalog.\n"),
ed1, client->name());
bail_out:
/* Create temp tables and indicies */
for (i=0; create_deltabs[i]; i++) {
if (!db_sql_query(ua->db, create_deltabs[i], NULL, (void *)NULL)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
Dmsg0(050, "create DelTables table failed\n");
return false;
}
edit_int64(cr.ClientId, ed2));
if (!db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL)) {
if (ua->verbose) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
Dmsg0(050, "insert delcand failed\n");
goto bail_out;
Dmsg1(150, "Query=%s\n", query.c_str());
if (!db_sql_query(ua->db, query.c_str(), job_delete_handler, (void *)&del)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
purge_job_list_from_catalog(ua, del);
if (del.num_del > 0) {
- bsendmsg(ua, _("Pruned %d %s for client %s from catalog.\n"), del.num_del,
+ ua->info_msg(_("Pruned %d %s for client %s from catalog.\n"), del.num_del,
del.num_del==1?_("Job"):_("Jobs"), client->name());
} else if (ua->verbose) {
- bsendmsg(ua, _("No Jobs found to prune.\n"));
+ ua->info_msg(_("No Jobs found to prune.\n"));
}
bail_out:
Dmsg1(050, "Query=%s\n", query.c_str());
if (!db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)del)) {
if (ua->verbose) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
}
Dmsg0(050, "Count failed\n");
goto bail_out;
purge_jobs_from_volume(ua, &mr);
}
*ua->argk[i] = 0; /* zap keyword already seen */
- bsendmsg(ua, "\n");
+ ua->send_msg("\n");
}
return 1;
default:
goto bail_out;
}
if ((fd=fopen(query_file, "rb")) == NULL) {
- bsendmsg(ua, _("Could not open %s: ERR=%s\n"), query_file,
+ ua->error_msg(_("Could not open %s: ERR=%s\n"), query_file,
strerror(errno));
goto bail_out;
}
}
}
if (i != item) {
- bsendmsg(ua, _("Could not find query.\n"));
+ ua->error_msg(_("Could not find query.\n"));
goto bail_out;
}
query[0] = 0;
len = strlen(line);
if (line[0] == '*') { /* prompt */
if (nprompt >= 9) {
- bsendmsg(ua, _("Too many prompts in query, max is 9.\n"));
+ ua->error_msg(_("Too many prompts in query, max is 9.\n"));
} else {
line[len++] = ' ';
line[len] = 0;
if (query[0] == '!') {
db_list_sql_query(ua->jcr, ua->db, query+1, prtit, ua, 0, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1, HORZ_LIST)) {
- bsendmsg(ua, "%s\n", query);
+ ua->send_msg("%s\n", query);
}
query[0] = 0;
}
if (query[0] == '!') {
db_list_sql_query(ua->jcr, ua->db, query+1, prtit, ua, 0, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1, HORZ_LIST)) {
- bsendmsg(ua, "%s\n", query);
+ ua->error_msg("%s\n", query);
}
}
*o++ = *p++;
}
} else {
- bsendmsg(ua, _("Warning prompt %d missing.\n"), n+1);
+ ua->error_msg(_("Warning prompt %d missing.\n"), n+1);
}
q += 2;
break;
}
*query.c_str() = 0;
- bsendmsg(ua, _("Entering SQL query mode.\n"
+ ua->send_msg(_("Entering SQL query mode.\n"
"Terminate each query with a semicolon.\n"
"Terminate query mode with a blank line.\n"));
msg = _("Enter SQL query: ");
msg = _("Add to SQL query: ");
}
}
- bsendmsg(ua, _("End query mode.\n"));
+ ua->send_msg(_("End query mode.\n"));
return 1;
}
int yes_in_arg = find_arg(ua, NT_("yes"));
for ( ;; ) {
- bsendmsg(ua, _("The current %s retention period is: %s\n"),
+ ua->info_msg(_("The current %s retention period is: %s\n"),
msg, edit_utime(*ret, ed1, sizeof(ed1)));
if (yes_in_arg != -1) {
return 1;
return 0;
}
if (!duration_to_utime(ua->cmd, ret)) {
- bsendmsg(ua, _("Invalid period.\n"));
+ ua->error_msg(_("Invalid period.\n"));
continue;
}
continue;
catalog = (CAT *)GetNextRes(R_CATALOG, NULL);
UnlockRes();
if (!catalog) {
- bsendmsg(ua, _("Could not find a Catalog resource\n"));
+ ua->error_msg(_("Could not find a Catalog resource\n"));
return NULL;
} else if (!acl_access_ok(ua, Catalog_ACL, catalog->name())) {
- bsendmsg(ua, _("You must specify a \"use <catalog-name>\" command before continuing.\n"));
+ ua->error_msg(_("You must specify a \"use <catalog-name>\" command before continuing.\n"));
return NULL;
}
return catalog;
if (client) {
return client;
}
- bsendmsg(ua, _("Error: Client resource %s does not exist.\n"), ua->argv[i]);
+ ua->error_msg(_("Error: Client resource %s does not exist.\n"), ua->argv[i]);
break;
}
}
if (db_get_client_record(ua->jcr, ua->db, cr)) {
return 1;
}
- bsendmsg(ua, _("Could not find Client %s: ERR=%s"), cr->Name, db_strerror(ua->db));
+ ua->error_msg(_("Could not find Client %s: ERR=%s"), cr->Name, db_strerror(ua->db));
}
for (i=1; i<ua->argc; i++) {
if ((strcasecmp(ua->argk[i], NT_("client")) == 0 ||
}
bstrncpy(cr->Name, ua->argv[i], sizeof(cr->Name));
if (!db_get_client_record(ua->jcr, ua->db, cr)) {
- bsendmsg(ua, _("Could not find Client \"%s\": ERR=%s"), ua->argv[i],
+ ua->error_msg(_("Could not find Client \"%s\": ERR=%s"), ua->argv[i],
db_strerror(ua->db));
cr->ClientId = 0;
break;
cr->ClientId = 0;
if (!db_get_client_ids(ua->jcr, ua->db, &num_clients, &ids)) {
- bsendmsg(ua, _("Error obtaining client ids. ERR=%s\n"), db_strerror(ua->db));
+ ua->error_msg(_("Error obtaining client ids. ERR=%s\n"), db_strerror(ua->db));
return 0;
}
if (num_clients <= 0) {
- bsendmsg(ua, _("No clients defined. You must run a job before using this command.\n"));
+ ua->error_msg(_("No clients defined. You must run a job before using this command.\n"));
return 0;
}
bstrncpy(ocr.Name, name, sizeof(ocr.Name));
if (!db_get_client_record(ua->jcr, ua->db, &ocr)) {
- bsendmsg(ua, _("Could not find Client \"%s\": ERR=%s"), name, db_strerror(ua->db));
+ ua->error_msg(_("Could not find Client \"%s\": ERR=%s"), name, db_strerror(ua->db));
return 0;
}
memcpy(cr, &ocr, sizeof(ocr));
acl_access_ok(ua, Pool_ACL, pr->Name)) {
return true;
}
- bsendmsg(ua, _("Could not find Pool \"%s\": ERR=%s"), pr->Name, db_strerror(ua->db));
+ ua->error_msg(_("Could not find Pool \"%s\": ERR=%s"), pr->Name, db_strerror(ua->db));
}
if (!select_pool_dbr(ua, pr, argk)) { /* try once more */
return false;
acl_access_ok(ua, Pool_ACL, ua->argv[i])) {
bstrncpy(pr->Name, ua->argv[i], sizeof(pr->Name));
if (!db_get_pool_record(ua->jcr, ua->db, pr)) {
- bsendmsg(ua, _("Could not find Pool \"%s\": ERR=%s"), ua->argv[i],
+ ua->error_msg(_("Could not find Pool \"%s\": ERR=%s"), ua->argv[i],
db_strerror(ua->db));
pr->PoolId = 0;
break;
pr->PoolId = 0;
if (!db_get_pool_ids(ua->jcr, ua->db, &num_pools, &ids)) {
- bsendmsg(ua, _("Error obtaining pool ids. ERR=%s\n"), db_strerror(ua->db));
+ ua->error_msg(_("Error obtaining pool ids. ERR=%s\n"), db_strerror(ua->db));
return 0;
}
if (num_pools <= 0) {
- bsendmsg(ua, _("No pools defined. Use the \"create\" command to create one.\n"));
+ ua->error_msg(_("No pools defined. Use the \"create\" command to create one.\n"));
return false;
}
bstrncpy(opr.Name, name, sizeof(opr.Name));
if (!db_get_pool_record(ua->jcr, ua->db, &opr)) {
- bsendmsg(ua, _("Could not find Pool \"%s\": ERR=%s"), name, db_strerror(ua->db));
+ ua->error_msg(_("Could not find Pool \"%s\": ERR=%s"), name, db_strerror(ua->db));
return false;
}
memcpy(pr, &opr, sizeof(opr));
memset(pr, 0, sizeof(POOL_DBR));
pr->PoolId = mr->PoolId;
if (!db_get_pool_record(ua->jcr, ua->db, pr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
return 0;
}
if (!acl_access_ok(ua, Pool_ACL, pr->Name)) {
- bsendmsg(ua, _("No access to Pool \"%s\"\n"), pr->Name);
+ ua->error_msg(_("No access to Pool \"%s\"\n"), pr->Name);
return 0;
}
return 1;
}
if (!db_get_media_record(ua->jcr, ua->db, mr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
return 0;
}
return 1;
if (pool) {
return pool;
}
- bsendmsg(ua, _("Error: Pool resource \"%s\" does not exist.\n"), ua->argv[i]);
+ ua->error_msg(_("Error: Pool resource \"%s\" does not exist.\n"), ua->argv[i]);
}
return select_pool_resource(ua);
}
}
jr->JobId = ua->int64_val;
if (!db_get_job_record(ua->jcr, ua->db, jr)) {
- bsendmsg(ua, "%s", db_strerror(ua->db));
+ ua->error_msg("%s", db_strerror(ua->db));
return 0;
}
return jr->JobId;
continue;
}
if (!db_get_job_record(ua->jcr, ua->db, jr)) {
- bsendmsg(ua, _("Could not find Job \"%s\": ERR=%s"), ua->argv[i],
+ ua->error_msg(_("Could not find Job \"%s\": ERR=%s"), ua->argv[i],
db_strerror(ua->db));
jr->JobId = 0;
break;
if (prompt) {
bstrncpy(prompt, ua->prompt[1], max_prompt);
}
- bsendmsg(ua, _("Automatically selected %s: %s\n"), automsg, ua->prompt[1]);
+ ua->send_msg(_("Automatically selected %s: %s\n"), automsg, ua->prompt[1]);
goto done;
}
/* If running non-interactive, bail out */
if (ua->batch) {
- bsendmsg(ua, _("Cannot select %s in batch mode.\n"), automsg);
+ ua->send_msg(_("Cannot select %s in batch mode.\n"), automsg);
item = -1;
goto done;
}
if (ua->api) user->signal(BNET_START_SELECT);
- bsendmsg(ua, ua->prompt[0]);
+ ua->send_msg(ua->prompt[0]);
for (i=1; i < ua->num_prompts; i++) {
if (ua->api) {
- bsendmsg(ua, "%s", ua->prompt[i]);
+ ua->send_msg("%s", ua->prompt[i]);
} else {
- bsendmsg(ua, "%6d: %s\n", i, ua->prompt[i]);
+ ua->send_msg("%6d: %s\n", i, ua->prompt[i]);
}
}
if (ua->api) user->signal(BNET_END_SELECT);
for ( ;; ) {
/* First item is the prompt string, not the items */
if (ua->num_prompts == 1) {
- bsendmsg(ua, _("Selection list for \"%s\" is empty!\n"), automsg);
+ ua->error_msg(_("Selection list for \"%s\" is empty!\n"), automsg);
item = -1; /* list is empty ! */
break;
}
if (ua->num_prompts == 2) {
item = 1;
- bsendmsg(ua, _("Automatically selected: %s\n"), ua->prompt[1]);
+ ua->send_msg(_("Automatically selected: %s\n"), ua->prompt[1]);
if (prompt) {
bstrncpy(prompt, ua->prompt[1], max_prompt);
}
if (ua->api) user->signal(BNET_SELECT_INPUT);
if (!get_pint(ua, pmsg)) {
item = -1; /* error */
- bsendmsg(ua, _("Selection aborted, nothing done.\n"));
+ ua->info_msg(_("Selection aborted, nothing done.\n"));
break;
}
item = ua->pint32_val;
if (item < 1 || item >= ua->num_prompts) {
- bsendmsg(ua, _("Please enter a number between 1 and %d\n"), ua->num_prompts-1);
+ ua->warning_msg(_("Please enter a number between 1 and %d\n"), ua->num_prompts-1);
continue;
}
if (prompt) {
}
/* Default argument is storage */
if (store_name) {
- bsendmsg(ua, _("Storage name given twice.\n"));
+ ua->error_msg(_("Storage name given twice.\n"));
return NULL;
}
store_name = ua->argk[i];
} else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0) {
jobid = str_to_int64(ua->argv[i]);
if (jobid <= 0) {
- bsendmsg(ua, _("Expecting jobid=nn command, got: %s\n"), ua->argk[i]);
+ ua->error_msg(_("Expecting jobid=nn command, got: %s\n"), ua->argk[i]);
return NULL;
}
if (!(jcr=get_jcr_by_id(jobid))) {
- bsendmsg(ua, _("JobId %s is not running.\n"), edit_int64(jobid, ed1));
+ ua->error_msg(_("JobId %s is not running.\n"), edit_int64(jobid, ed1));
return NULL;
}
store = jcr->wstore;
} else if (strcasecmp(ua->argk[i], NT_("job")) == 0 ||
strcasecmp(ua->argk[i], NT_("jobname")) == 0) {
if (!ua->argv[i]) {
- bsendmsg(ua, _("Expecting job=xxx, got: %s.\n"), ua->argk[i]);
+ ua->error_msg(_("Expecting job=xxx, got: %s.\n"), ua->argk[i]);
return NULL;
}
if (!(jcr=get_jcr_by_partial_name(ua->argv[i]))) {
- bsendmsg(ua, _("Job \"%s\" is not running.\n"), ua->argv[i]);
+ ua->error_msg(_("Job \"%s\" is not running.\n"), ua->argv[i]);
return NULL;
}
store = jcr->wstore;
break;
} else if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0) {
if (!ua->argv[i]) {
- bsendmsg(ua, _("Expecting ujobid=xxx, got: %s.\n"), ua->argk[i]);
+ ua->error_msg(_("Expecting ujobid=xxx, got: %s.\n"), ua->argk[i]);
return NULL;
}
if (!(jcr=get_jcr_by_full_name(ua->argv[i]))) {
- bsendmsg(ua, _("Job \"%s\" is not running.\n"), ua->argv[i]);
+ ua->error_msg(_("Job \"%s\" is not running.\n"), ua->argv[i]);
return NULL;
}
store = jcr->wstore;
if (!store && store_name && store_name[0] != 0) {
store = (STORE *)GetResWithName(R_STORAGE, store_name);
if (!store) {
- bsendmsg(ua, _("Storage resource \"%s\": not found\n"), store_name);
+ ua->error_msg(_("Storage resource \"%s\": not found\n"), store_name);
}
}
if (store && !acl_access_ok(ua, Storage_ACL, store->name())) {
Dmsg1(20, "status:%s:\n", cmd);
if ((ua->argc != 3) || (strcasecmp(ua->argk[1], "dir"))) {
- bsendmsg(ua, "1900 Bad .status command, missing arguments.\n");
+ ua->send_msg("1900 Bad .status command, missing arguments.\n");
return false;
}
if (strcasecmp(ua->argk[2], "current") == 0) {
- bsendmsg(ua, OKqstatus, ua->argk[2]);
+ ua->send_msg(OKqstatus, ua->argk[2]);
foreach_jcr(njcr) {
if (njcr->JobId != 0 && acl_access_ok(ua, Job_ACL, njcr->job->name())) {
- bsendmsg(ua, DotStatusJob, edit_int64(njcr->JobId, ed1),
+ ua->send_msg(DotStatusJob, edit_int64(njcr->JobId, ed1),
njcr->JobStatus, njcr->JobErrors);
}
}
endeach_jcr(njcr);
} else if (strcasecmp(ua->argk[2], "last") == 0) {
- bsendmsg(ua, OKqstatus, ua->argk[2]);
+ ua->send_msg(OKqstatus, ua->argk[2]);
if ((last_jobs) && (last_jobs->size() > 0)) {
job = (s_last_job*)last_jobs->last();
if (acl_access_ok(ua, Job_ACL, job->Job)) {
- bsendmsg(ua, DotStatusJob, edit_int64(job->JobId, ed1),
+ ua->send_msg(DotStatusJob, edit_int64(job->JobId, ed1),
job->JobStatus, job->Errors);
}
}
} else {
- bsendmsg(ua, "1900 Bad .status command, wrong argument.\n");
+ ua->send_msg("1900 Bad .status command, wrong argument.\n");
return false;
}
char dt[MAX_TIME_LENGTH];
char b1[35], b2[35], b3[35], b4[35];
- bsendmsg(ua, _("%s Version: %s (%s) %s %s %s\n"), my_name, VERSION, BDATE,
+ ua->send_msg(_("%s Version: %s (%s) %s %s %s\n"), my_name, VERSION, BDATE,
HOST_OS, DISTNAME, DISTVER);
bstrftime_nc(dt, sizeof(dt), daemon_start_time);
if (num_jobs_run == 1) {
- bsendmsg(ua, _("Daemon started %s, 1 Job run since started.\n"), dt);
+ ua->send_msg(_("Daemon started %s, 1 Job run since started.\n"), dt);
}
else {
- bsendmsg(ua, _("Daemon started %s, %d Jobs run since started.\n"),
+ ua->send_msg(_("Daemon started %s, %d Jobs run since started.\n"),
dt, num_jobs_run);
}
- bsendmsg(ua, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
+ ua->send_msg(_(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
edit_uint64_with_commas(sm_bytes, b1),
edit_uint64_with_commas(sm_max_bytes, b2),
edit_uint64_with_commas(sm_buffers, b3),
* List terminated jobs
*/
list_terminated_jobs(ua);
- bsendmsg(ua, _("====\n"));
+ ua->send_msg(_("====\n"));
}
static void do_storage_status(UAContext *ua, STORE *store)
pm_strcpy(lstore.store_source, _("unknown source"));
set_wstorage(ua->jcr, &lstore);
/* Try connecting for up to 15 seconds */
- bsendmsg(ua, _("Connecting to Storage daemon %s at %s:%d\n"),
+ ua->send_msg(_("Connecting to Storage daemon %s at %s:%d\n"),
store->name(), store->address, store->SDport);
if (!connect_to_storage_daemon(ua->jcr, 1, 15, 0)) {
- bsendmsg(ua, _("\nFailed to connect to Storage daemon %s.\n====\n"),
+ ua->send_msg(_("\nFailed to connect to Storage daemon %s.\n====\n"),
store->name());
if (ua->jcr->store_bsock) {
bnet_close(ua->jcr->store_bsock);
sd = ua->jcr->store_bsock;
bnet_fsend(sd, "status");
while (bnet_recv(sd) >= 0) {
- bsendmsg(ua, "%s", sd->msg);
+ ua->send_msg("%s", sd->msg);
}
bnet_sig(sd, BNET_TERMINATE);
bnet_close(sd);
ua->jcr->sd_auth_key = bstrdup("dummy");
/* Try to connect for 15 seconds */
- bsendmsg(ua, _("Connecting to Client %s at %s:%d\n"),
+ ua->send_msg(_("Connecting to Client %s at %s:%d\n"),
client->name(), client->address, client->FDport);
if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) {
- bsendmsg(ua, _("Failed to connect to Client %s.\n====\n"),
+ ua->send_msg(_("Failed to connect to Client %s.\n====\n"),
client->name());
if (ua->jcr->file_bsock) {
bnet_close(ua->jcr->file_bsock);
fd = ua->jcr->file_bsock;
bnet_fsend(fd, "status");
while (bnet_recv(fd) >= 0) {
- bsendmsg(ua, "%s", fd->msg);
+ ua->send_msg("%s", fd->msg);
}
bnet_sig(fd, BNET_TERMINATE);
bnet_close(fd);
static void prt_runhdr(UAContext *ua)
{
- bsendmsg(ua, _("\nScheduled Jobs:\n"));
- bsendmsg(ua, _("Level Type Pri Scheduled Name Volume\n"));
- bsendmsg(ua, _("===================================================================================\n"));
+ ua->send_msg(_("\nScheduled Jobs:\n"));
+ ua->send_msg(_("Level Type Pri Scheduled Name Volume\n"));
+ ua->send_msg(_("===================================================================================\n"));
}
/* Scheduling packet */
level_ptr = level_to_str(sp->level);
break;
}
- bsendmsg(ua, _("%-14s %-8s %3d %-18s %-18s %s\n"),
+ ua->send_msg(_("%-14s %-8s %3d %-18s %-18s %s\n"),
level_ptr, job_type_to_str(sp->job->JobType), sp->priority, dt,
sp->job->name(), mr.VolumeName);
if (close_db) {
if (i >= 0) {
days = atoi(ua->argv[i]);
if ((days < 0) || (days > 50)) {
- bsendmsg(ua, _("Ignoring invalid value for days. Max is 50.\n"));
+ ua->send_msg(_("Ignoring invalid value for days. Max is 50.\n"));
days = 1;
}
}
prt_runtime(ua, sp);
}
if (num_jobs == 0) {
- bsendmsg(ua, _("No Scheduled Jobs.\n"));
+ ua->send_msg(_("No Scheduled Jobs.\n"));
}
- bsendmsg(ua, _("====\n"));
+ ua->send_msg(_("====\n"));
Dmsg0(200, "Leave list_sched_jobs_runs()\n");
}
bool pool_mem = false;
Dmsg0(200, "enter list_run_jobs()\n");
- bsendmsg(ua, _("\nRunning Jobs:\n"));
+ ua->send_msg(_("\nRunning Jobs:\n"));
foreach_jcr(jcr) {
if (jcr->JobId == 0) { /* this is us */
/* this is a console or other control job. We only show console
*/
if (jcr->JobType == JT_CONSOLE) {
bstrftime_nc(dt, sizeof(dt), jcr->start_time);
- bsendmsg(ua, _("Console connected at %s\n"), dt);
+ ua->send_msg(_("Console connected at %s\n"), dt);
}
continue;
}
if (njobs == 0) {
/* Note the following message is used in regress -- don't change */
- bsendmsg(ua, _("No Jobs running.\n====\n"));
+ ua->send_msg(_("No Jobs running.\n====\n"));
Dmsg0(200, "leave list_run_jobs()\n");
return;
}
njobs = 0;
- bsendmsg(ua, _(" JobId Level Name Status\n"));
- bsendmsg(ua, _("======================================================================\n"));
+ ua->send_msg(_(" JobId Level Name Status\n"));
+ ua->send_msg(_("======================================================================\n"));
foreach_jcr(jcr) {
if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->name())) {
continue;
break;
}
- bsendmsg(ua, _("%6d %-6s %-20s %s\n"),
+ ua->send_msg(_("%6d %-6s %-20s %s\n"),
jcr->JobId,
level,
jcr->Job,
}
}
endeach_jcr(jcr);
- bsendmsg(ua, _("====\n"));
+ ua->send_msg(_("====\n"));
Dmsg0(200, "leave list_run_jobs()\n");
}
char level[10];
if (last_jobs->empty()) {
- bsendmsg(ua, _("No Terminated Jobs.\n"));
+ ua->send_msg(_("No Terminated Jobs.\n"));
return;
}
lock_last_jobs_list();
struct s_last_job *je;
- bsendmsg(ua, _("\nTerminated Jobs:\n"));
- bsendmsg(ua, _(" JobId Level Files Bytes Status Finished Name \n"));
- bsendmsg(ua, _("====================================================================\n"));
+ ua->send_msg(_("\nTerminated Jobs:\n"));
+ ua->send_msg(_(" JobId Level Files Bytes Status Finished Name \n"));
+ ua->send_msg(_("====================================================================\n"));
foreach_dlist(je, last_jobs) {
char JobName[MAX_NAME_LENGTH];
const char *termstat;
termstat = _("Other");
break;
}
- bsendmsg(ua, _("%6d %-6s %8s %10s %-7s %-8s %s\n"),
+ ua->send_msg(_("%6d %-6s %8s %10s %-7s %-8s %s\n"),
je->JobId,
level,
edit_uint64_with_commas(je->JobFiles, b1),
termstat,
dt, JobName);
}
- bsendmsg(ua, _("\n"));
+ ua->send_msg(_("\n"));
unlock_last_jobs_list();
}
ua->api = tree->ua->api; /* keep API flag too */
BSOCK *user = ua->UA_sock;
- bsendmsg(tree->ua, _(
+ ua->send_msg(_(
"\nYou are now entering file selection mode where you add (mark) and\n"
"remove (unmark) files to be restored. No files are initially added, unless\n"
"you used the \"all\" keyword on the command line.\n"
*/
tree->node = (TREE_NODE *)tree->root;
tree_getpath(tree->node, cwd, sizeof(cwd));
- bsendmsg(tree->ua, _("cwd is: %s\n"), cwd);
+ ua->send_msg(_("cwd is: %s\n"), cwd);
for ( ;; ) {
int found, len, i;
if (!get_cmd(ua, "$ ")) {
if (ua->api) user->signal(BNET_CMD_BEGIN);
parse_args_only(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
if (ua->argc == 0) {
- bsendmsg(tree->ua, _("Invalid command. Enter \"done\" to exit.\n"));
+ ua->warning_msg(_("Invalid command. Enter \"done\" to exit.\n"));
if (ua->api) user->signal(BNET_CMD_FAILED);
continue;
}
break;
}
if (!found) {
- bsendmsg(tree->ua, _("Invalid command. Enter \"done\" to exit.\n"));
+ ua->warning_msg(_("Invalid command. Enter \"done\" to exit.\n"));
if (ua->api) user->signal(BNET_CMD_FAILED);
continue;
}
if (node->inserted) {
tree->FileCount++;
if (tree->DeltaCount > 0 && (tree->FileCount-tree->LastCount) > tree->DeltaCount) {
- bsendmsg(tree->ua, "+");
+ tree->ua->send_msg("+");
tree->LastCount = tree->FileCount;
}
}
General:
02May07
+kes Convert all other Dir files to use ne ua class message
+ routines for bat.
kes Tentative fix for missing digest signature in bug 807.
kes Correct handle problem in new win32_ftruncate routine.
kes Convert ua_purge.c and ua_update.c to use new ua class