From ecaab377d1d8e663590f71cf143769ebd738d315 Mon Sep 17 00:00:00 2001
From: Francois Henrotte <francois.henrotte@ulg.ac.be>
Date: Tue, 18 Oct 2011 12:03:01 +0000
Subject: [PATCH] gmsh -onelab sock can be a remoteNetworkClient

---
 Common/CommandLine.cpp | 8 ++++++++
 Common/Gmsh.cpp        | 5 ++++-
 Common/GmshMessage.cpp | 6 +++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index dc45ef6c85..51d9e37198 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -138,6 +138,14 @@ void GetOptions(int argc, char *argv[])
         CTX::instance()->batch = -99;
         i++;
       }
+      else if(!strcmp(argv[i] + 1, "onelab")) {
+        i++;        
+        if(argv[i])
+           Msg::InitializeOnelab(argv[i++]);
+        else
+          Msg::Fatal("Missing string");
+        CTX::instance()->batch = -4;
+      }
       else if(!strcmp(argv[i] + 1, "socket")) {
         i++;        
         if(argv[i])
diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index 4001084102..38af13f286 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -150,7 +150,10 @@ int GmshBatch()
   }
 #endif
 
-  if(CTX::instance()->batch == -3){
+  if(CTX::instance()->batch == -4){
+    // 
+  }
+  else if(CTX::instance()->batch == -3){
     GmshRemote();
   }
   else if(CTX::instance()->batch == -2){
diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index c6dbfa36df..da91206820 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -600,7 +600,11 @@ void Msg::FinalizeClient()
 void Msg::InitializeOnelab(const std::string &sockname)
 {
   // Gmsh could also be used as a distant CAD/post-pro client... 
-  _onelabClient = new onelab::localClient("Gmsh");
+  if (sockname.empty())
+    _onelabClient = new onelab::localClient("Gmsh");
+  else {
+    _onelabClient = new onelab::remoteNetworkClient("GmshRemote",sockname);
+  }
 }
 
 void Msg::ExchangeOnelabParameter(const std::string &key,
-- 
GitLab