From 13c24ef163f56c815641ec1e19920d699c2369de Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 13 Oct 2008 18:33:32 +0000 Subject: [PATCH] ebl cleanup git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7778 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/testing/autoselect.patch | 29 -- .../testing/bconsole_use_history.patch | 328 ------------------ .../testing/bconsole_use_history.readme | 5 - 3 files changed, 362 deletions(-) delete mode 100644 bacula/patches/testing/autoselect.patch delete mode 100644 bacula/patches/testing/bconsole_use_history.patch delete mode 100644 bacula/patches/testing/bconsole_use_history.readme diff --git a/bacula/patches/testing/autoselect.patch b/bacula/patches/testing/autoselect.patch deleted file mode 100644 index 8e8090f5db..0000000000 --- a/bacula/patches/testing/autoselect.patch +++ /dev/null @@ -1,29 +0,0 @@ - - This patch fixes the autoselect option that is broken for a while... - - Apply it to version 2.2.8 or higher with: - - cd - patch -p0 - make - ... - make install - - -Index: src/stored/reserve.c -=================================================================== ---- src/stored/reserve.c (revision 7051) -+++ src/stored/reserve.c (working copy) -@@ -1093,6 +1093,11 @@ - /* Try each device in this AutoChanger */ - foreach_alist(rctx.device, changer->device) { - Dmsg1(dbglvl, "Try changer device %s\n", rctx.device->hdr.name); -+ if (!rctx.device->autoselect) { -+ Dmsg1(100, "Device %s not autoselect skipped.\n", -+ rctx.device->hdr.name); -+ continue; /* device is not available */ -+ } - stat = reserve_device(rctx); - if (stat != 1) { /* try another device */ - continue; diff --git a/bacula/patches/testing/bconsole_use_history.patch b/bacula/patches/testing/bconsole_use_history.patch deleted file mode 100644 index bde065eccf..0000000000 --- a/bacula/patches/testing/bconsole_use_history.patch +++ /dev/null @@ -1,328 +0,0 @@ -Index: src/console/console.c -=================================================================== ---- src/console/console.c (révision 5452) -+++ src/console/console.c (copie de travail) -@@ -333,7 +333,137 @@ - #endif - } - -+#ifdef HAVE_READLINE -+#define READLINE_LIBRARY 1 -+#undef free -+#include "readline.h" -+#include "history.h" - -+int -+get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) -+{ -+ char *line; -+ -+ rl_catch_signals = 0; /* do it ourselves */ -+ line = readline((char *)prompt); /* cast needed for old readlines */ -+ -+ if (!line) { -+ exit(1); -+ } -+ strip_trailing_junk(line); -+ sock->msglen = pm_strcpy(&sock->msg, line); -+ if (sock->msglen) { -+ add_history(sock->msg); -+ } -+ free(line); -+ return 1; -+} -+ -+#else /* no readline, do it ourselves */ -+ -+#if !defined(HAVE_WIN32) -+static bool bisatty(int fd) -+{ -+ if (no_conio) { -+ return false; -+ } -+ return isatty(fd); -+} -+#endif -+ -+/* -+ * Returns: 1 if data available -+ * 0 if timeout -+ * -1 if error -+ */ -+static int -+wait_for_data(int fd, int sec) -+{ -+#if defined(HAVE_WIN32) -+ return 1; -+#else -+ fd_set fdset; -+ struct timeval tv; -+ -+ tv.tv_sec = sec; -+ tv.tv_usec = 0; -+ for ( ;; ) { -+ FD_ZERO(&fdset); -+ FD_SET((unsigned)fd, &fdset); -+ switch(select(fd + 1, &fdset, NULL, NULL, &tv)) { -+ case 0: /* timeout */ -+ return 0; -+ case -1: -+ if (errno == EINTR || errno == EAGAIN) { -+ continue; -+ } -+ return -1; /* error return */ -+ default: -+ return 1; -+ } -+ } -+#endif -+} -+ -+/* -+ * Get next input command from terminal. -+ * -+ * Returns: 1 if got input -+ * 0 if timeout -+ * -1 if EOF or error -+ */ -+int -+get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) -+{ -+ int len; -+ if (!stop) { -+ if (output == stdout || teeout) { -+ sendit(prompt); -+ } -+ } -+again: -+ switch (wait_for_data(fileno(input), sec)) { -+ case 0: -+ return 0; /* timeout */ -+ case -1: -+ return -1; /* error */ -+ default: -+ len = sizeof_pool_memory(sock->msg) - 1; -+ if (stop) { -+ sleep(1); -+ goto again; -+ } -+#ifdef HAVE_CONIO -+ if (bisatty(fileno(input))) { -+ input_line(sock->msg, len); -+ break; -+ } -+#endif -+#ifdef HAVE_WIN32 /* use special console for input on win32 */ -+ if (input == stdin) { -+ if (win32_cgets(sock->msg, len) == NULL) { -+ return -1; -+ } -+ } -+ else -+#endif -+ if (fgets(sock->msg, len, input) == NULL) { -+ return -1; -+ -+ } -+ break; -+ } -+ if (usrbrk()) { -+ clrbrk(); -+ } -+ strip_trailing_junk(sock->msg); -+ sock->msglen = strlen(sock->msg); -+ return 1; -+} -+ -+#endif /* end non-readline code */ -+ -+ - /********************************************************************* - * - * Main Bacula Console -- User Interface Program -@@ -589,6 +719,11 @@ - - /* Run commands in ~/.bconsolerc if any */ - char *env = getenv("HOME"); -+ -+#ifdef HAVE_READLINE -+ POOL_MEM history_file; -+#endif -+ - if (env) { - FILE *fd; - pm_strcpy(&UA_sock->msg, env); -@@ -598,6 +733,14 @@ - read_and_process_input(fd, UA_sock); - fclose(fd); - } -+ -+#ifdef HAVE_READLINE -+ pm_strcpy(history_file, env); -+ pm_strcat(history_file, "/.bconsole_history"); -+ -+ using_history(); -+ read_history(history_file.c_str()); -+#endif - } - - read_and_process_input(stdin, UA_sock); -@@ -607,6 +750,19 @@ - UA_sock->close(); - } - -+#ifdef HAVE_READLINE -+ if (env) { -+ /* first, try to truncate the history file, and if it -+ * fail, the file is probably not present, and we -+ * can use write_history to create it -+ */ -+ if (history_truncate_file(history_file.c_str(), 100) == 0) { -+ append_history(history_length, history_file.c_str()); -+ } else { -+ write_history(history_file.c_str()); -+ } -+ } -+#endif - terminate_console(0); - return 0; - } -@@ -702,138 +858,6 @@ - return OK; - } - -- --#ifdef HAVE_READLINE --#define READLINE_LIBRARY 1 --#undef free --#include "readline.h" --#include "history.h" -- -- --int --get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) --{ -- char *line; -- -- rl_catch_signals = 0; /* do it ourselves */ -- line = readline((char *)prompt); /* cast needed for old readlines */ -- -- if (!line) { -- exit(1); -- } -- strip_trailing_junk(line); -- sock->msglen = pm_strcpy(&sock->msg, line); -- if (sock->msglen) { -- add_history(sock->msg); -- } -- free(line); -- return 1; --} -- --#else /* no readline, do it ourselves */ -- --#if !defined(HAVE_WIN32) --static bool bisatty(int fd) --{ -- if (no_conio) { -- return false; -- } -- return isatty(fd); --} --#endif -- --/* -- * Returns: 1 if data available -- * 0 if timeout -- * -1 if error -- */ --static int --wait_for_data(int fd, int sec) --{ --#if defined(HAVE_WIN32) -- return 1; --#else -- fd_set fdset; -- struct timeval tv; -- -- tv.tv_sec = sec; -- tv.tv_usec = 0; -- for ( ;; ) { -- FD_ZERO(&fdset); -- FD_SET((unsigned)fd, &fdset); -- switch(select(fd + 1, &fdset, NULL, NULL, &tv)) { -- case 0: /* timeout */ -- return 0; -- case -1: -- if (errno == EINTR || errno == EAGAIN) { -- continue; -- } -- return -1; /* error return */ -- default: -- return 1; -- } -- } --#endif --} -- --/* -- * Get next input command from terminal. -- * -- * Returns: 1 if got input -- * 0 if timeout -- * -1 if EOF or error -- */ --int --get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec) --{ -- int len; -- if (!stop) { -- if (output == stdout || teeout) { -- sendit(prompt); -- } -- } --again: -- switch (wait_for_data(fileno(input), sec)) { -- case 0: -- return 0; /* timeout */ -- case -1: -- return -1; /* error */ -- default: -- len = sizeof_pool_memory(sock->msg) - 1; -- if (stop) { -- sleep(1); -- goto again; -- } --#ifdef HAVE_CONIO -- if (bisatty(fileno(input))) { -- input_line(sock->msg, len); -- break; -- } --#endif --#ifdef HAVE_WIN32 /* use special console for input on win32 */ -- if (input == stdin) { -- if (win32_cgets(sock->msg, len) == NULL) { -- return -1; -- } -- } -- else --#endif -- if (fgets(sock->msg, len, input) == NULL) { -- return -1; -- -- } -- break; -- } -- if (usrbrk()) { -- clrbrk(); -- } -- strip_trailing_junk(sock->msg); -- sock->msglen = strlen(sock->msg); -- return 1; --} -- --#endif /* end non-readline code */ -- - static int versioncmd(FILE *input, BSOCK *UA_sock) - { - senditf("Version: " VERSION " (" BDATE ") %s %s %s\n", diff --git a/bacula/patches/testing/bconsole_use_history.readme b/bacula/patches/testing/bconsole_use_history.readme deleted file mode 100644 index 2359c6c862..0000000000 --- a/bacula/patches/testing/bconsole_use_history.readme +++ /dev/null @@ -1,5 +0,0 @@ -From: Eric Bollengier - -Add $HOME/.bconsole_history file to bconsole. - - -- 2.39.5