]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_select.c
kes Reduce bconsole help to fit in 80 columns
[bacula/bacula] / bacula / src / dird / ua_select.c
index 749afd4c818f7f7325d8cc19ed418472d35d568c..d048861f00ec2ec62a69d7ee3d7806f741cdc64e 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2001-2009 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.
@@ -570,11 +570,11 @@ int select_media_dbr(UAContext *ua, MEDIA_DBR *mr)
       }
       mr->PoolId = pr.PoolId;
       db_list_media_records(ua->jcr, ua->db, mr, prtit, ua, HORZ_LIST);
-      if (!get_cmd(ua, _("Enter MediaId or Volume name: "))) {
+      if (!get_cmd(ua, _("Enter *MediaId or Volume name: "))) {
          return 0;
       }
-      if (is_a_number(ua->cmd)) {
-         mr->MediaId = str_to_int64(ua->cmd);
+      if (ua->cmd[0] == '*' && is_a_number(ua->cmd+1)) {
+         mr->MediaId = str_to_int64(ua->cmd+1);
       } else {
          bstrncpy(mr->VolumeName, ua->cmd, sizeof(mr->VolumeName));
       }
@@ -762,7 +762,13 @@ int do_prompt(UAContext *ua, const char *automsg, const char *msg,
    }
    /* If running non-interactive, bail out */
    if (ua->batch) {
-      ua->send_msg(_("Cannot select %s in batch mode.\n"), automsg);
+      /* First print the choices he wanted to make */
+      ua->send_msg(ua->prompt[0]);
+      for (i=1; i < ua->num_prompts; i++) {
+         ua->send_msg("%6d: %s\n", i, ua->prompt[i]);
+      }
+      /* Now print error message */
+      ua->send_msg(_("Your request has multiple choices for \"%s\". Selection is not possible in batch mode.\n"), automsg);
       item = -1;
       goto done;
    }