# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
eval "`/usr/bin/tclsh /usr/share/libexec/modulecmd.tcl tcsh autoinit`"

# no environment alteration if the above autoinit command failed
if ( $status == 0 ) then
   if ( $?tcsh && $?prompt && -r /usr/share/init/tcsh_completion ) then
      source /usr/share/init/tcsh_completion
   endif

   if ( ":${PATH}:" !~ '*:/usr/share/bin:*' ) then
      if ( "$PATH" == '' ) then
         setenv PATH /usr/share/bin
      else
         setenv PATH "/usr/share/bin:$PATH"
      endif
   endif

   if ( $?MANPATH ) then
      set manpath = $MANPATH
   else
      set manpath = `manpath`
      # initialize MANPATH if not set with a value that preserves manpath
      # system configuration even after addition of paths to this variable
      # by modulefiles
      setenv MANPATH :
   endif
   if ( ":${manpath}:" !~ '*:/usr/man/:*' ) then
      if ( "$MANPATH" == '' || "$MANPATH" == ':' ) then
         set mlpathsep = ''
      else
         set mlpathsep = :
      endif
      setenv MANPATH "/usr/man/$mlpathsep$MANPATH"
      unset mlpathsep
   endif
   unset manpath
endif
