#! /bin/sh
#------------------------------------------------------------------------
# Establish search path for the loader, linker, and man pages. If they
#   already exist in the environment variable or the directory doesn't
#   exist, then quietly ignore the request.
#
# shift
for next in $@; do
#---------------------------------------------------------------------
#   Remove directory from PATH
#---------------------------------------------------------------------
    PATH=`echo :${PATH}: | sed -e "s|:${next}/bin:|:|g" -e 's|^:||' -e 's|:$||'`
    if [ PATH = "" ]; then unset PATH ; fi
#---------------------------------------------------------------------
#   Remove directory from LD_LIBRARY_PATH
#---------------------------------------------------------------------
    LD_LIBRARY_PATH=`echo :${LD_LIBRARY_PATH}: | sed -e "s|:${next}/lib64:|:|g" -e "s|:${next}/lib:|:|g" -e 's|^:||' -e 's|:$||'`
    if [ LD_LIBRARY_PATH = "" ]; then unset LD_LIBRARY_PATH ; fi
#---------------------------------------------------------------------
#   Remove directory from MANPATH
#---------------------------------------------------------------------
    MANPATH=`echo :${MANPATH}: | sed -e "s|:${next}/man:|:|g" -e 's|^:||' -e 's|:$||'`
    if [ MANPATH = "" ]; then unset MANPATH ; fi
done
