From f2221f47395013f6259c574457889ba85d358efc Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 3 Feb 2016 17:11:02 +0000
Subject: [PATCH] print messages on terminal was not correctly restored from
 the option file

---
 Common/CommandLine.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 3ee3efec3d..080105b480 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -285,9 +285,10 @@ void PrintUsage(const std::string &name)
 
 void GetOptions(int argc, char *argv[])
 {
-  // print messages on terminal
+  // print messages on terminal (use special 99 value so that we can detect if
+  // it was later set to 1 in the option file)
   int terminal = CTX::instance()->terminal;
-  CTX::instance()->terminal = 1;
+  CTX::instance()->terminal = 99;
 
 #if defined(HAVE_PARSER)
   if(argc && argv){
@@ -1137,5 +1138,6 @@ void GetOptions(int argc, char *argv[])
   else
     GModel::current()->setFileName(CTX::instance()->files[0]);
 
-  CTX::instance()->terminal = terminal;
+  if(CTX::instance()->terminal == 99)
+    CTX::instance()->terminal = terminal;
 }
-- 
GitLab