]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_output.c
- Fix the block listing bug pointed out by Arno.
[bacula/bacula] / bacula / src / dird / ua_output.c
index 33a8343e5b68872e56c50c731f094898abe05ab7..c3f1ac1883a37bbb4bd0d8e2c711018d8d063ad7 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -55,10 +55,10 @@ int autodisplay_cmd(UAContext *ua, const char *cmd)
 
    switch (find_arg_keyword(ua, kw)) {
    case 0:
-      ua->auto_display_messages = 1;
+      ua->auto_display_messages = true;
       break;
    case 1:
-      ua->auto_display_messages = 0;
+      ua->auto_display_messages = false;
       break;
    default:
       bsendmsg(ua, _("ON or OFF keyword missing.\n"));
@@ -68,7 +68,7 @@ int autodisplay_cmd(UAContext *ua, const char *cmd)
 }
 
 /*
- * Turn batch processing on/off
+ * Turn GUI mode on/off
  */
 int gui_cmd(UAContext *ua, const char *cmd)
 {
@@ -79,12 +79,10 @@ int gui_cmd(UAContext *ua, const char *cmd)
 
    switch (find_arg_keyword(ua, kw)) {
    case 0:
-      ua->batch = true;
-      ua->jcr->gui = true;
+      ua->jcr->gui = ua->gui = true;
       break;
    case 1:
-      ua->batch = false;
-      ua->jcr->gui = false;
+      ua->jcr->gui = ua->gui = false;
       break;
    default:
       bsendmsg(ua, _("ON or OFF keyword missing.\n"));
@@ -268,7 +266,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
       } else if (strcasecmp(ua->argk[i], N_("jobtotals")) == 0) {
          db_list_job_totals(ua->jcr, ua->db, &jr, prtit, ua);
 
-      /* List JOBID */
+      /* List JOBID=nn */
       } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0) {
          if (ua->argv[i]) {
             jobid = str_to_int64(ua->argv[i]);
@@ -278,12 +276,19 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
             }
          }
 
-      /* List JOB */
+      /* List JOB=xxx */
       } else if (strcasecmp(ua->argk[i], N_("job")) == 0 && ua->argv[i]) {
          bstrncpy(jr.Job, ua->argv[i], MAX_NAME_LENGTH);
          jr.JobId = 0;
          db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
 
+      /* List JOBNAME=xxx */
+      } else if (strcasecmp(ua->argk[i], N_("job")) == 0 && ua->argv[i]) {
+         bstrncpy(jr.Name, ua->argv[i], MAX_NAME_LENGTH);
+         jr.JobId = 0;
+         db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
+
+
       /* List FILES */
       } else if (strcasecmp(ua->argk[i], N_("files")) == 0) {
 
@@ -458,12 +463,12 @@ static bool list_nextvol(UAContext *ua, int ndays)
       if (!complete_jcr_for_job(jcr, job, pool)) {
          return false;
       }
-      mr.PoolId = jcr->PoolId;
+      mr.PoolId = jcr->jr.PoolId;
       if (run->storage) {
          jcr->store = run->storage;
       }
       memset(&pr, 0, sizeof(pr));
-      pr.PoolId = jcr->PoolId;
+      pr.PoolId = jcr->jr.PoolId;
       if (! db_get_pool_record(ua->jcr, ua->db, &pr)) {
          strcpy(pr.Name, "*UnknownPool*");
       }
@@ -520,7 +525,8 @@ RUN *find_next_run(RUN *run, JOB *job, time_t &runtime, int ndays)
    }
    for ( ; run; run=run->next) {
       /*
-       * Find runs in next 24 hours
+       * Find runs in next 24 hours.  Day 0 is today, so if
+       *   ndays=1, look at today and tomorrow.
        */
       for (day = 0; day <= ndays; day++) {
          future = now + (day * 60 * 60 * 24);
@@ -620,7 +626,6 @@ int complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool)
          Jmsg(jcr, M_INFO, 0, _("Pool %s created in database.\n"), pr.Name);
       }
    }
-   jcr->PoolId = pr.PoolId;
    jcr->jr.PoolId = pr.PoolId;
    return 1;
 }
@@ -649,7 +654,7 @@ void do_messages(UAContext *ua, const char *cmd)
       do_truncate = true;
    }
    if (do_truncate) {
-      ftruncate(fileno(con_fd), 0L);
+      (void)ftruncate(fileno(con_fd), 0L);
    }
    console_msg_pending = FALSE;
    ua->user_notified_msg_pending = FALSE;