]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_select.c
- Back port changes to 1.38.5
[bacula/bacula] / bacula / src / dird / ua_select.c
index 1a5df789aa4da96a7fb368c76dee693c4365e835..17f9e1de7f7db5369f6fb26e2fce938a4ee73e7b 100644 (file)
@@ -7,7 +7,7 @@
  *   Version  $Id$
  */
 /*
-   Copyright (C) 2001-2005 Kern Sibbald
+   Copyright (C) 2001-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
@@ -631,6 +631,7 @@ int get_job_dbr(UAContext *ua, JOB_DBR *jr)
          bstrncpy(jr->Job, ua->argv[i], sizeof(jr->Job));
       } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0 && ua->argv[i]) {
          jr->JobId = str_to_int64(ua->argv[i]);
+         jr->Job[0] = 0;
       } else {
          continue;
       }
@@ -643,6 +644,16 @@ int get_job_dbr(UAContext *ua, JOB_DBR *jr)
       return jr->JobId;
    }
 
+   jr->JobId = 0;
+   jr->Job[0] = 0;
+
+   for (i=1; i<ua->argc; i++) {
+      if (strcasecmp(ua->argk[i], N_("jobname")) == 0 && ua->argv[i]) {
+         jr->JobId = 0;
+         bstrncpy(jr->Name, ua->argv[i], sizeof(jr->Name));
+         break;
+      }
+   }
    if (!select_job_dbr(ua, jr)) {  /* try once more */
       return 0;
    }
@@ -711,10 +722,12 @@ int do_prompt(UAContext *ua, const char *automsg, const char *msg, char *prompt,
       item = -1;
       goto done;
    }
+// bnet_sig(ua->UA_sock, BNET_START_SELECT);
    bsendmsg(ua, ua->prompt[0]);
    for (i=1; i < ua->num_prompts; i++) {
       bsendmsg(ua, "%6d: %s\n", i, ua->prompt[i]);
    }
+// bnet_sig(ua->UA_sock, BNET_END_SELECT);
 
    for ( ;; ) {
       /* First item is the prompt string, not the items */
@@ -837,7 +850,7 @@ STORE *get_storage_resource(UAContext *ua, bool use_default)
       store = NULL;
    }
 
-   if (!store && store_name) {
+   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);