STYLE: use 'setenv PATH' instead of 'set path=' for c-shell scripts

- the path is accesible either way, but use setenv for consistency with
  other environment variables. It also simplifies foamCleanPath again.
This commit is contained in:
Mark Olesen
2010-03-19 16:49:41 +01:00
parent 3ee8595169
commit db34c43ab0
8 changed files with 50 additions and 68 deletions

View File

@ -43,7 +43,6 @@ usage() {
cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options:
-space treat 'path' as space-delimited (eg, from C-Shell)
-strip remove inaccessible directories
-help print the usage
@ -57,7 +56,7 @@ USAGE
}
unset space strip
unset strip
# parse options
while [ "$#" -gt 0 ]
do
@ -65,10 +64,6 @@ do
-h | -help)
usage
;;
-space)
space=true
shift
;;
-strip)
strip=true
shift
@ -82,12 +77,7 @@ done
[ "$#" -ge 1 ] || usage
if [ "$space" = true ]
then
dirList=$(echo "$1" | sed -e 's/ /:/g')
else
dirList="$1"
fi
dirList="$1"
shift
##DEBUG echo "input>$dirList<" 1>&2
@ -140,11 +130,8 @@ done
IFS=' '
set -- $dirList
# join on ':', unless -space option was specified
if [ "$space" != true ]
then
IFS=':'
fi
# rejoin on ':'
IFS=':'
dirList="$*"
# restore IFS

View File

@ -44,7 +44,7 @@ if ( -r $CEI_HOME ) then
endif
# add to path
set path=($CEI_HOME/bin $path)
setenv PATH ${CEI_HOME}/bin:${PATH}
setenv ENSIGHT9_INPUT dummy
setenv ENSIGHT9_READER $FOAM_LIBBIN

View File

@ -35,8 +35,8 @@
#------------------------------------------------------------------------------
# clean the PATH
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath -space "$path" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) set path=($cleaned)
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) setenv PATH $cleaned
# determine the cmake to be used
unsetenv CMAKE_HOME
@ -44,7 +44,7 @@ foreach cmake ( cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 )
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
if ( -r $cmake ) then
setenv CMAKE_HOME $cmake
set path=($CMAKE_HOME/bin $path)
setenv PATH ${CMAKE_HOME}/bin:${PATH}
break
endif
end
@ -73,7 +73,7 @@ setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-
# set paths if binaries or source are present
if ( -r $ParaView_DIR || -r $paraviewInstDir ) then
set path=($ParaView_DIR/bin $path)
setenv PATH ${ParaView_DIR}/bin:${PATH}
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR}
# add in python libraries if required

View File

@ -209,16 +209,16 @@ default:
endsw
# Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
if (! $?MANPATH) setenv MANPATH ''
#- Clean path/PATH
set cleaned=`$foamClean -space "$path" "$foamOldDirs"`
if ( $status == 0 ) set path=($cleaned)
#- Clean PATH (path)
set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
@ -242,9 +242,9 @@ _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH
set cleaned=`$foamClean -space "$path"`
if ( $status == 0 ) set path=($cleaned)
#- Clean PATH (path)
set cleaned=`$foamClean "$PATH"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH"`

View File

@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# File
# etc/prefs.csh
#
# Description

View File

@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# File
# etc/prefs.sh
#
# Description

View File

@ -32,7 +32,7 @@
#------------------------------------------------------------------------------
# prefix to PATH
alias _foamAddPath 'set path=(\!* $path)'
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH
@ -68,14 +68,10 @@ setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path
set path=($WM_DIR $WM_PROJECT_DIR/bin $path)
setenv PATH ${WM_DIR}:${WM_PROJECT_DIR}/bin:${PATH}
_foamAddPath $FOAM_APPBIN
_foamAddPath $FOAM_SITE_APPBIN
_foamAddPath $FOAM_USER_APPBIN
_foamAddLib $FOAM_LIBBIN
_foamAddLib $FOAM_SITE_LIBBIN
_foamAddLib $FOAM_USER_LIBBIN
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
# Select compiler installation
@ -117,8 +113,7 @@ case OpenFOAM:
endif
_foamAddPath ${WM_COMPILER_DIR}/bin
_foamAddLib ${WM_COMPILER_DIR}/lib
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib
_foamAddMan ${WM_COMPILER_DIR}/man
breaksw
@ -274,8 +269,8 @@ if ( $?CGAL_LIB_DIR ) then
endif
# Switch on the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if ( -f $FOAM_LIBBIN/libhoard.so ) then
# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD}
#endif

View File

@ -94,8 +94,8 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path
export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
_foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
_foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN
# Compiler settings
@ -309,8 +309,8 @@ export MPI_BUFFER_SIZE
[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
# Switch on the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_LIBBIN/libhoard.so ]
#then
# export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD