#%Module1.0

##############################################################################
#   Modules Revision 3.0
#   Providing a flexible user environment
#
#   File:		info/%M%
#   Revision:		%I%
#   First Edition:	95/12/06
#   Last Mod.:		%U%, %G%
#
#   Authors:		Jens Hamisch, Jens.Hamisch@Strawberry.COM
#
#   Description:	Testuite modulefile
#   Command:
#   Sub-Command:	setenv, module-info shell, module-info shelltype
#
#   Invocation:		load @M@/@V@
#   Result:	%R{
#			setenv	_LMFILES_ 	${_LMFILES_}:@M@/@V@
#			setenv	LOADEDMODULES	${LOADEDMODULES}:@P@/@M@/@V@
#			setenv	testsuite	@S@/@ST@
#		}R%
#   Comment:	%C{
#			The 'module-info shell' command returns the 
#			user shell as specified as thwe first argument
#			to modulecmd.
#			'module-info shelltype' returns the name of the
#			shell defining the syntax of the command output
#			modulecmd writes.
#			This modulefile checks the shell and shelltype
#			probing.
#		}C%
#			
##############################################################################

#
#  check all known shells in order to set up the return
#  value. 
#  I know, this isn't very effective, but it's a test!
#

set sh ""

if { [module-info shell sh] } {
    set sh "sh"
} elseif { [module-info shell ksh] } {
    set sh "ksh"
} elseif { [module-info shell zsh] } {
    set sh "zsh"
} elseif { [module-info shell bash] } {
    set sh "bash"
} elseif { [module-info shell csh] } {
    set sh "csh"
} elseif { [module-info shell tcsh] } {
    set sh "tcsh"
} elseif { [module-info shell perl] } {
    set sh "perl"
} elseif { [module-info shell cmake] } {
    set sh "cmake"
} else {
    set sh "unknown"
}

#
#  check all known shell types in order to set up the return
#  value. 
#

set sht ""

if { [module-info shelltype sh] } {
    set sht "sh"
} elseif { [module-info shelltype csh] } {
    set sht "csh"
} elseif { [module-info shelltype perl] } {
    set sht "perl"
} elseif { [module-info shelltype cmake] } {
    set sht "cmake"
} else {
    set sht "unknown"
}

#
#  This is, what's being returned
#

setenv testsuite "$sh/$sht"

#
#  Cleanup
#

unset sh
unset sht
