From 8506a381c5bc007bdb8df1cd70887cac31ebb898 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 22 Mar 2006 20:42:47 +0000
Subject: [PATCH] take socket name on command line

---
 utils/solvers/c++/interactive.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/utils/solvers/c++/interactive.cpp b/utils/solvers/c++/interactive.cpp
index e8af99ddd4..e577364ae5 100644
--- a/utils/solvers/c++/interactive.cpp
+++ b/utils/solvers/c++/interactive.cpp
@@ -8,15 +8,9 @@ class GmshInteractiveClient{
  private:
   GmshClient _client;
  public:
-  GmshInteractiveClient()
+  GmshInteractiveClient(char *socket)
   {
     using_history();
-    char socket[256];
-#if !defined(WIN32) || defined(__CYGWIN__)
-    sprintf(socket, "%s/.gmshsock", getenv("HOME"));
-#else
-    sprintf(socket, "127.0.0.1:44122");
-#endif
     if(_client.Connect(socket) < 0) {
       printf("Unable to connect to Gmsh\n");
       exit(1);
@@ -81,9 +75,14 @@ class GmshInteractiveClient{
   }
 };
 
-int main() 
+int main(int argc, char **argv) 
 {
-  GmshInteractiveClient c;
+  if(argc < 2){
+    printf("usage: %s socket\n", argv[0]);
+    exit(1);
+  }
+
+  GmshInteractiveClient c(argv[1]);
   c.read("gmsh> ");
 
   return 0;
-- 
GitLab