From 27ddb36780394086cb4e99c7636a0ded9e0d9308 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 10 Mar 2015 02:18:36 +0000
Subject: [PATCH] experimental: propagate -setnumber/-setstring gmsh options to
 the onelab clients if they use the command line

---
 Common/CommandLine.cpp |  7 -------
 Common/onelabUtils.cpp | 12 ++++++------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 1c74f91f77..0ad7ecec91 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -20,11 +20,6 @@
 #include "CreateFile.h"
 #include "OS.h"
 
-// keep track of -setnumber/-setstring command line option, so we can propagate
-// them to subclients later on
-//std::map<std::string, double> CommandLineNumbers;
-//std::map<std::string, std::string> CommandLineStrings;
-
 #if defined(HAVE_FLTK)
 #include <FL/Fl.H>
 #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 3)
@@ -539,7 +534,6 @@ void GetOptions(int argc, char *argv[])
         i++;
 	if (i + 1 < argc && argv[i][0] != '-' && argv[i + 1][0] != '-') {
           gmsh_yystringsymbols[argv[i]] = argv[i + 1];
-          //CommandLineStrings[argv[i]] = argv[i + 1];
           i += 2;
 	}
         else
@@ -550,7 +544,6 @@ void GetOptions(int argc, char *argv[])
 	if (i + 1 < argc && argv[i][0] != '-') {
           std::vector<double> val(1, atof(argv[i + 1]));
           gmsh_yysymbols[argv[i]].value = val;
-          //CommandLineNumbers[argv[i]] = atof(argv[i + 1]);
           i += 2;
 	}
         else
diff --git a/Common/onelabUtils.cpp b/Common/onelabUtils.cpp
index 7aaa43574a..3080342490 100644
--- a/Common/onelabUtils.cpp
+++ b/Common/onelabUtils.cpp
@@ -124,15 +124,15 @@ namespace onelabUtils {
         args.push_back(" " + checkCommand) ;
       else if(action == "compute")
         args.push_back(" " + computeCommand);
-      // FIXME: this would be the place to propagate the the client any
-      // -setnumber/-setstring command line options given to gmsh. Is this a
-      // good idea?
+      // Experimental: propagate -setnumber/-setnumber gmsh option to the
+      // client. Is this a good idea?
       std::vector<std::string> gmshOptions = onelab::parameter::split
         (Msg::GetCommandLineArgs(), ' ');
       for(unsigned int i = 0; i < gmshOptions.size(); i++){
-        if(gmshOptions[i] == "-setnumber" && i < gmshOptions.size() - 2){
-          printf("hello!! %s %s %s\n", gmshOptions[i].c_str(), gmshOptions[i+1].c_str(),
-                 gmshOptions[i + 2].c_str());
+        if((gmshOptions[i] == "-setnumber" || gmshOptions[i] == "-setstring") &&
+           i < gmshOptions.size() - 2){
+          args.push_back(" " + gmshOptions[i] + " " + gmshOptions[i + 1] +
+                         " " + gmshOptions[i + 2]);
         }
       }
     }
-- 
GitLab