From 3863b0ad5751fc4865758f828ea1f58057f1528b Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Sun, 20 Nov 2011 14:48:01 +0100
Subject: [PATCH] use "clear -all" instead of "clear all" when running under
 Octave (cherry picked from commit 7840dbbb77683bad9dff8625c062dccd8962ae3e)

---
 preprocessor/ModFile.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index d5f06f093..82209665c 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -384,7 +384,13 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool console,
               << "%           from model file (.mod)" << endl << endl;
 
   if (clear_all)
-    mOutputFile << "clear all" << endl;
+    {
+      mOutputFile << "if exist('OCTAVE_VERSION')" << endl
+		  << "  clear -all" << endl
+		  << "else" << endl 
+		  << "  clear all" << endl
+		  << "end" << endl;
+    }
 
   mOutputFile << "tic;" << endl
               << "global M_ oo_ options_ ys0_ ex0_" << endl
-- 
GitLab