]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/console_thread.cpp
Fix some trivial errors and implemented the restore of IRIX xattrs.
[bacula/bacula] / bacula / src / wx-console / console_thread.cpp
index 975abe05c2a0b30980c5d8aa0d68d47554c19217..675c15c36a35835b5ceb08c69b4909828497af9b 100644 (file)
@@ -1,38 +1,38 @@
-/*
- *
- *    Interaction thread between director and the GUI
- *
- *    Nicolas Boichat, April 2004
- *
- *    Version $Id$
- */
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2004-2008 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
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   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.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    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.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ *
+ *    Interaction thread between director and the GUI
+ *
+ *    Nicolas Boichat, April 2004
+ *
+ *    Version $Id$
+ */
 
 // http://66.102.9.104/search?q=cache:Djc1mPF3hRoJ:cvs.sourceforge.net/viewcvs.py/audacity/audacity-src/src/AudioIO.cpp%3Frev%3D1.102+macos+x+wxthread&hl=fr
 
@@ -65,12 +65,16 @@ char TERM_msg[] = "2999 Terminate\n";
 
 /* Imported functions */
 int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
+bool parse_wxcons_config(CONFIG *config, const char *cfgfile, LEX_ERROR_HANDLER *scan_error);
 
 bool console_thread::inited = false;
 bool console_thread::configloaded = false;
 wxString console_thread::working_dir = wxT(".");
 
 int numdir = 0;
+static CONFIG *config = NULL;
+static void scan_err(const char *file, int line, LEX *lc, const char *msg, ...);
+
 
 /*
  * Call-back for reading a passphrase for an encrypted PEM file
@@ -172,7 +176,7 @@ void console_thread::InitLib()
    }
    
    init_stack_dump();
-   my_name_is(0, NULL, "wx-console");
+   my_name_is(0, NULL, "bwx-console");
    working_directory = (const char*) console_thread::working_dir.GetData();
    
    inited = true;
@@ -224,7 +228,10 @@ wxString console_thread::LoadConfig(wxString configfile)
          return _("Error while initializing library.");
    }
    
-   free_config_resources();
+   if (config) {
+      config->free_resources();
+      free(config);
+   }          
    
    MSGS* msgs = (MSGS *)bmalloc(sizeof(MSGS));
    memset(msgs, 0, sizeof(MSGS));
@@ -238,7 +245,8 @@ wxString console_thread::LoadConfig(wxString configfile)
    //init_console_msg(console_thread::working_dir.mb_str(*wxConvCurrent));
 
    errmsg = wxT("");
-   if (!parse_config(configfile.mb_str(*wxConvCurrent), &scan_err)) {
+   config = new_config_parser();
+   if (!parse_wxcons_config(config, configfile.mb_str(*wxConvCurrent), &scan_err)) {
       configloaded = false;
       term_msg();
       return errmsg;
@@ -253,7 +261,7 @@ wxString console_thread::LoadConfig(wxString configfile)
    }
 
    term_msg();
-   wxRemoveFile(console_thread::working_dir + wxT("/wx-console.conmsg"));
+   wxRemoveFile(console_thread::working_dir + wxT("/bwx-console.conmsg"));
    init_msg(NULL, NULL);
    
    configloaded = true;
@@ -282,7 +290,7 @@ console_thread::~console_thread() {
 void* console_thread::Entry() {
 #ifndef HAVE_WIN32
    /* It seems we must redefine the locale on each thread on wxGTK. 
-    * On Win32 it makes wx-console crash. */
+    * On Win32 it makes bwx-console crash. */
    wxLocale m_locale;
    m_locale.Init();
    m_locale.AddCatalog(wxT("bacula"));
@@ -367,7 +375,7 @@ void* console_thread::Entry() {
 
    memset(&jcr, 0, sizeof(jcr));
    
-   jcr.dequeuing = 1; /* TODO: catch messages */
+   jcr.dequeuing_msgs = 1; /* TODO: catch messages */
 
    LockRes();
    /* If cons==NULL, default console will be used */
@@ -417,7 +425,7 @@ void* console_thread::Entry() {
    }
 
 
-   UA_sock = bnet_connect(&jcr, 3, 3, wxString(_("Director daemon")).mb_str(*wxConvCurrent),
+   UA_sock = bnet_connect(&jcr, 3, 3, 0, wxString(_("Director daemon")).mb_str(*wxConvCurrent),
       dir->address, NULL, dir->DIRport, 0);
       
    if (UA_sock == NULL) {
@@ -454,7 +462,7 @@ void* console_thread::Entry() {
    int stat;
 
    int last_is_eod = 0; /* Last packet received is BNET_EOD */
-   int do_not_forward_eod = 0; /* Last packet received/sent is .messages, so don't forward EOD. (so wx-console don't show the prompt again) */
+   int do_not_forward_eod = 0; /* Last packet received/sent is .messages, so don't forward EOD. (so bwx-console don't show the prompt again) */
 
    /* main loop */
    while(!TestDestroy()) {   /* Tests if thread has been ended */