From b55c3fb66b0624fc87619991008302d6b180c37d Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Thu, 28 Apr 2011 08:32:00 +0200
Subject: [PATCH] ENH: avoid stray options affecting _foamEval, pass
 FOAM_SETTINGS to foamExec

---
 bin/foamExec | 2 +-
 etc/bashrc   | 4 ++++
 etc/cshrc    | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/bin/foamExec b/bin/foamExec
index 711e3f7a8e1..66892c525bc 100755
--- a/bin/foamExec
+++ b/bin/foamExec
@@ -122,7 +122,7 @@ sourceRc()
     # extra safety when sourcing the bashrc
     [ -n "$prefix" ] && export FOAM_INST_DIR="$prefix"
 
-    . $foamDotFile
+    . $foamDotFile $FOAM_SETTINGS
 }
 
 
diff --git a/etc/bashrc b/etc/bashrc
index edbf3064f07..d2539c5b501 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -144,6 +144,10 @@ _foamEval()
     while [ $# -gt 0 ]
     do
         case "$1" in
+        -*)
+            # stray option (not meant for us here) -> get out
+            break
+            ;;
         *=)
             # name=       -> unset name
             [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}"
diff --git a/etc/cshrc b/etc/cshrc
index 9b824f0c99f..c2c1b12a9b7 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -142,6 +142,10 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh`
 setenv FOAM_SETTINGS "${*}"
 while ( $#argv > 0 )
     switch ($argv[1])
+    case -*:
+        # stray option (not meant for us here) -> get out
+        break
+        breaksw
     case *=:
         # name=       -> unsetenv name
         if ($?FOAM_VERBOSE && $?prompt) echo "unsetenv $argv[1]:s/=//"
-- 
GitLab