# 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/Modules/libexec/modulecmd.tcl csh autoinit`"

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

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

   if ( $?MANPATH ) then
      set manpath = $MANPATH
   else
      set 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/share/man:*' ) then
      if ( "$MANPATH" == '' || "$MANPATH" == ':' ) then
         set mlpathsep = ''
      else
         set mlpathsep = :
      endif
      setenv MANPATH "/usr/share/man$mlpathsep$MANPATH"
      unset mlpathsep
   endif
   unset manpath
endif
