From 27891753033f1385b6a973503f4e22b8b119b4fa Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 24 Feb 2006 02:15:43 +0000
Subject: [PATCH] *** empty log message ***

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

diff --git a/utils/solvers/c++/interactive.cpp b/utils/solvers/c++/interactive.cpp
index fc571b7fcb..ab7721249c 100644
--- a/utils/solvers/c++/interactive.cpp
+++ b/utils/solvers/c++/interactive.cpp
@@ -2,7 +2,7 @@
 #include <readline/readline.h>
 #include <readline/history.h>
 
-// compile with: g++ interact.cpp -lreadline
+// compile with: g++ interactive.cpp -lreadline
 
 class GmshInteractiveClient{
  private:
@@ -11,7 +11,8 @@ class GmshInteractiveClient{
   GmshInteractiveClient()
   {
     using_history();
-    char *socket = "/Users/geuzaine/.gmshsock";
+    char socket[256];
+    sprintf(socket, "%s/.gmshsock", getenv("HOME"));
     if(_client.Connect(socket) < 0) {
       printf("Unable to connect to Gmsh\n");
       exit(1);
@@ -25,6 +26,12 @@ class GmshInteractiveClient{
   }
   void read(char *prompt)
   {
+    // preload a few commands in the history:
+    add_history("lc = 1.;");
+    add_history("Point(1) = {0,0,0,lc};");
+    add_history("Point(2) = {5,0,0,lc};");
+    add_history("Line(1) = {1,2};");
+    
     while (1) {
       // read input char until CR, LF, EOF, ^D
       char *ptr = readline(prompt);
-- 
GitLab