]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/console.c
Fix bconsole bug with new BNET signals
[bacula/bacula] / bacula / src / console / console.c
index c70e2a3558e86bffa2432f774a9c260a61bf34cf..203cee38a1a0b2d7fac214eab816a4d23871a0f5 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2010 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.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -31,7 +31,6 @@
  *
  *     Kern Sibbald, September MM
  *
- *     Version $Id$
  */
 
 #include "bacula.h"
@@ -273,13 +272,13 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
       } else if (stat == 0) {         /* timeout */
          if (strcmp(prompt, "*") == 0) {
             tid = start_bsock_timer(UA_sock, timeout);
-            bnet_fsend(UA_sock, ".messages");
+            UA_sock->fsend(".messages");
             stop_bsock_timer(tid);
          } else {
             continue;
          }
       } else {
-         at_prompt = FALSE;
+         at_prompt = false;
          /* @ => internal command for us */
          if (UA_sock->msg[0] == '@') {
             parse_args(UA_sock->msg, &args, &argc, argk, argv, MAX_CMD_ARGS);
@@ -289,7 +288,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
             continue;
          }
          tid = start_bsock_timer(UA_sock, timeout);
-         if (!bnet_send(UA_sock)) {   /* send command */
+         if (!UA_sock->send()) {   /* send command */
             stop_bsock_timer(tid);
             break;                    /* error */
          }
@@ -299,7 +298,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          break;
       }
       tid = start_bsock_timer(UA_sock, timeout);
-      while ((stat = bnet_recv(UA_sock)) >= 0) {
+      while ((stat = UA_sock->recv()) >= 0) {
          if (at_prompt) {
             if (!stop) {
                sendit("\n");
@@ -323,7 +322,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
       if (is_bnet_stop(UA_sock)) {
          break;                       /* error or term */
       } else if (stat == BNET_SIGNAL) {
-         if (UA_sock->msglen == BNET_PROMPT) {
+         if (UA_sock->msglen == BNET_SUB_PROMPT) {
             at_prompt = true;
          }
          Dmsg1(100, "Got poll %s\n", bnet_sig_to_ascii(UA_sock));
@@ -608,6 +607,7 @@ static struct cpl_keywords_t cpl_keywords[] = {
    {"cd",         ".lsdir"         },
    {"mark",       ".ls"            },
    {"m",          ".ls"            },
+   {"unmark",     ".lsmark"        },
    {"actiononpurge=", ".actiononpurge" }
 };
 #define key_size ((int)(sizeof(cpl_keywords)/sizeof(struct cpl_keywords_t)))
@@ -872,6 +872,7 @@ static int console_init_history(const char *histfile)
    rl_completion_entry_function = dummy_completion_function;
    rl_attempted_completion_function = readline_completion;
    rl_filename_completion_desired = 0;
+   stifle_history(100);
 #endif
 
    return ret;