#! /bin/csh -f
#------------------------------------------------------------------------
# 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
foreach next ($argv)
    set next=`echo $next | sed -e 's,/$,,g'`
#---------------------------------------------------------------------
#   Remove directory from PATH
#---------------------------------------------------------------------
    setenv PATH \
       `echo :${PATH}: | sed -e "s,:${next}/bin:,:,g" -e 's,^:,,g' -e 's,:$,,g'`
    if ("$PATH" == "") unsetenv PATH
#---------------------------------------------------------------------
#   Remove directory from LD_LIBRARY_PATH
#---------------------------------------------------------------------
    if ( $?LD_LIBRARY_PATH ) then
        setenv LD_LIBRARY_PATH \
           `echo :${LD_LIBRARY_PATH}: | sed -e "s,:${next}/lib:,:,g" -e "s,:${next}/lib64:,:,g" -e 's,^:,,' -e 's,:$,,'`
        if ("$LD_LIBRARY_PATH" == "") unsetenv LD_LIBRARY_PATH
    endif
#---------------------------------------------------------------------
#   Remove directory from PATH
#---------------------------------------------------------------------
    if ( $?MANPATH ) then
        setenv MANPATH \
            `echo :${MANPATH}: | sed -e "s,:${next}/man:,:,g" -e 's,^:,,g' -e 's,:$,,g'`
        if ("$MANPATH" == "") unsetenv MANPATH
    endif
end
rehash

