]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/console.c
kes Make arguments to get_scratch_volume() in same order as other
[bacula/bacula] / bacula / src / console / console.c
index 34064f774fd2dce0329fdba578cf3d4eb6755371..c691c2316f31f795c09f0830b5fd803c823a5b28 100644 (file)
@@ -7,8 +7,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -345,6 +345,7 @@ int main(int argc, char *argv[])
    bool no_signals = false;
    bool test_config = false;
    JCR jcr;
+   utime_t heart_beat;
 
    setlocale(LC_ALL, "");
    bindtextdomain("bacula", LOCALEDIR);
@@ -462,14 +463,19 @@ try_again:
       LockRes();
       numdir = 0;
       foreach_res(dir, R_DIRECTOR) {
-         senditf( _("%d  %s at %s:%d\n"), 1+numdir++, dir->hdr.name, dir->address,
+         senditf( _("%2d:  %s at %s:%d\n"), 1+numdir++, dir->hdr.name, dir->address,
             dir->DIRport);
       }
       UnlockRes();
-      if (get_cmd(stdin, _("Select Director: "), UA_sock, 600) < 0) {
+      if (get_cmd(stdin, _("Select Director by entering a number: "), UA_sock, 600) < 0) {
          (void)WSACleanup();               /* Cleanup Windows sockets */
          return 1;
       }
+      if (!is_a_number(UA_sock->msg)) {
+         senditf(_("%s is not a number. You must enter a number between 1 and %d\n"), 
+                 UA_sock->msg, numdir);
+         goto try_again;
+      }
       item = atoi(UA_sock->msg);
       if (item < 0 || item > numdir) {
          senditf(_("You must enter a number between 1 and %d\n"), numdir);
@@ -556,7 +562,14 @@ try_again:
       }
    }
 
-   UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address,
+   if (dir->heartbeat_interval) {
+      heart_beat = dir->heartbeat_interval;
+   } else if (cons) {
+      heart_beat = cons->heartbeat_interval;
+   } else {
+      heart_beat = 0;
+   }
+   UA_sock = bnet_connect(NULL, 5, 15, heart_beat, "Director daemon", dir->address,
                           NULL, dir->DIRport, 0);
    if (UA_sock == NULL) {
       terminate_console(0);
@@ -890,7 +903,7 @@ static int do_outputcmd(FILE *input, BSOCK *UA_sock)
    if (!fd) {
       berrno be;
       senditf(_("Cannot open file %s for output. ERR=%s\n"),
-         argk[1], be.strerror(errno));
+         argk[1], be.bstrerror(errno));
       return 1;
    }
    output = fd;
@@ -918,7 +931,7 @@ static int execcmd(FILE *input, BSOCK *UA_sock)
    if (!bpipe) {
       berrno be;
       senditf(_("Cannot popen(\"%s\", \"r\"): ERR=%s\n"),
-         argk[1], be.strerror(errno));
+         argk[1], be.bstrerror(errno));
       return 1;
    }
   
@@ -929,7 +942,7 @@ static int execcmd(FILE *input, BSOCK *UA_sock)
    if (stat != 0) {
       berrno be;
       be.set_errno(stat);
-     senditf(_("Autochanger error: ERR=%s\n"), be.strerror());
+     senditf(_("Autochanger error: ERR=%s\n"), be.bstrerror());
    }
    return 1;
 }