Skip to content

Commit

Permalink
Tweak layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 3e27bda commit 04d1d24
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
31 changes: 15 additions & 16 deletions src/filed/status.c
Expand Up @@ -72,10 +72,10 @@ static void output_status(STATUS_PKT *sp)

static void list_status_header(STATUS_PKT *sp)
{
POOL_MEM msg(PM_MESSAGE);
char b1[32], b2[32], b3[32], b4[32], b5[35];
int len;
char dt[MAX_TIME_LENGTH];
POOL_MEM msg(PM_MESSAGE);
char b1[32], b2[32], b3[32], b4[32], b5[35];
#if defined(HAVE_WIN32)
char buf[300];
#endif
Expand Down Expand Up @@ -158,13 +158,12 @@ static void list_status_header(STATUS_PKT *sp)

static void list_running_jobs_plain(STATUS_PKT *sp)
{
int sec, bps;
POOL_MEM msg(PM_MESSAGE);
char b1[32], b2[32], b3[32], b4[32];
int len;
bool found = false;
JCR *njcr;
char dt[MAX_TIME_LENGTH];
int len, sec, bps;
bool found = false;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[32], b2[32], b3[32], b4[32];

/*
* List running jobs
*/
Expand All @@ -177,6 +176,7 @@ static void list_running_jobs_plain(STATUS_PKT *sp)
vss = "VSS ";
}
#endif

foreach_jcr(njcr) {
bstrftime_nc(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
Expand Down Expand Up @@ -239,12 +239,11 @@ static void list_running_jobs_plain(STATUS_PKT *sp)

static void list_running_jobs_api(STATUS_PKT *sp)
{
int sec, bps;
POOL_MEM msg(PM_MESSAGE);
char b1[32], b2[32], b3[32], b4[32];
int len;
JCR *njcr;
char dt[MAX_TIME_LENGTH];
int len, sec, bps;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[32], b2[32], b3[32], b4[32];

/*
* List running jobs for Bat/Bweb (simple to parse)
*/
Expand All @@ -254,6 +253,7 @@ static void list_running_jobs_api(STATUS_PKT *sp)
vss = 1;
}
#endif

foreach_jcr(njcr) {
bstrutime(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
Expand Down Expand Up @@ -316,10 +316,9 @@ static void list_running_jobs(STATUS_PKT *sp)
static void list_terminated_jobs(STATUS_PKT *sp)
{
int len;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[30], b2[30];
char level[10];
struct s_last_job *je;
POOL_MEM msg(PM_MESSAGE);
char level[10], dt[MAX_TIME_LENGTH], b1[30], b2[30];

if (!sp->api) {
len = pm_strcpy(msg, _("\nTerminated Jobs:\n"));
Expand Down
36 changes: 19 additions & 17 deletions src/stored/status.c
Expand Up @@ -70,8 +70,8 @@ static const char *level_to_str(int level);
*/
static void output_status(JCR *jcr, STATUS_PKT *sp)
{
POOL_MEM msg(PM_MESSAGE);
int len;
POOL_MEM msg(PM_MESSAGE);

list_status_header(sp);

Expand Down Expand Up @@ -108,15 +108,16 @@ static void output_status(JCR *jcr, STATUS_PKT *sp)

list_spool_stats(sendit, (void *)sp);
if (!sp->api) {
len = pm_strcpy(msg, "====\n\n");
sendit(msg, len, sp);
}
}

static void list_resources(STATUS_PKT *sp)
{
#ifdef when_working
POOL_MEM msg(PM_MESSAGE);
int len;
POOL_MEM msg(PM_MESSAGE);

if (!sp->api) {
len = Mmsg(msg, _("\nSD Resources:\n"));
Expand Down Expand Up @@ -153,13 +154,13 @@ static find_device(char *devname)

static void list_devices(JCR *jcr, STATUS_PKT *sp)
{
int len;
int bpb;
DEVICE *dev;
DEVRES *device;
AUTOCHANGERRES *changer;
DEVICE *dev;
char b1[35], b2[35], b3[35];
POOL_MEM msg(PM_MESSAGE);
int len;
int bpb;
char b1[35], b2[35], b3[35];

if (!sp->api) {
len = Mmsg(msg, _("\nDevice status:\n"));
Expand Down Expand Up @@ -258,13 +259,13 @@ static void list_devices(JCR *jcr, STATUS_PKT *sp)

static void list_status_header(STATUS_PKT *sp)
{
int len;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH];
char b1[35], b2[35], b3[35], b4[35], b5[35];
POOL_MEM msg(PM_MESSAGE);
#if defined(HAVE_WIN32)
char buf[300];
#endif
int len;

len = Mmsg(msg, _("%s Version: %s (%s) %s %s %s\n"),
my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
Expand Down Expand Up @@ -363,8 +364,8 @@ static void trigger_device_status_hook(JCR *jcr,

static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp)
{
POOL_MEM msg(PM_MESSAGE);
int len;
POOL_MEM msg(PM_MESSAGE);

if (!dev) {
len = Mmsg(msg, _("No DEVICE structure.\n\n"));
Expand Down Expand Up @@ -520,15 +521,14 @@ static void send_device_status(DEVICE *dev, STATUS_PKT *sp)

static void list_running_jobs(STATUS_PKT *sp)
{
bool found = false;
int avebps, bps, sec;
JCR *jcr;
DCR *dcr, *rdcr;
bool found = false;
time_t now = time(NULL);
POOL_MEM msg(PM_MESSAGE);
int len, avebps, bps, sec;
char JobName[MAX_NAME_LENGTH];
char b1[50], b2[50], b3[50], b4[50];
int len;
POOL_MEM msg(PM_MESSAGE);
time_t now = time(NULL);

if (!sp->api) {
len = Mmsg(msg, _("\nRunning Jobs:\n"));
Expand Down Expand Up @@ -634,9 +634,9 @@ static void list_running_jobs(STATUS_PKT *sp)

static void list_jobs_waiting_on_reservation(STATUS_PKT *sp)
{
int len;
JCR *jcr;
POOL_MEM msg(PM_MESSAGE);
int len;

if (!sp->api) {
len = Mmsg(msg, _("\nJobs waiting to reserve a drive:\n"));
Expand All @@ -660,10 +660,10 @@ static void list_jobs_waiting_on_reservation(STATUS_PKT *sp)
static void list_terminated_jobs(STATUS_PKT *sp)
{
int len;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[30], b2[30];
char level[10];
struct s_last_job *je;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[30], b2[30];

if (!sp->api) {
len = pm_strcpy(msg, _("\nTerminated Jobs:\n"));
Expand Down Expand Up @@ -818,6 +818,7 @@ static const char *level_to_str(int level)
static void sendit(const char *msg, int len, STATUS_PKT *sp)
{
BSOCK *bs = sp->bs;

if (bs) {
memcpy(bs->msg, msg, len+1);
bs->msglen = len+1;
Expand All @@ -835,6 +836,7 @@ static void sendit(const char *msg, int len, void *sp)
static void sendit(POOL_MEM &msg, int len, STATUS_PKT *sp)
{
BSOCK *bs = sp->bs;

if (bs) {
memcpy(bs->msg, msg.c_str(), len+1);
bs->msglen = len+1;
Expand Down

0 comments on commit 04d1d24

Please sign in to comment.