# Modified: $Date: 2011/10/24 18:07:05 $
# Language: bash
#
-# (c) Copyright 2000-2011, ClearSCM, Inc., all rights reserved.
+# (c) Copyright 2000-2016, ClearSCM, Inc., all rights reserved.
#
################################################################################
-# Set ARCH, architecture of the machine
-KERNEL=$(uname -s)
-
-if [[ $KERNEL = CYGWIN* ]]; then
- export ARCH=cygwin
- vobtagPrefix='\\\\\\\'
-elif [ $KERNEL = "Linux" ]; then
- export ARCH=linux
-elif [ $KERNEL = "SunOS" ]; then
- export ARCH=sun
-elif [ $KERNEL = "FreeBSD" ]; then
- export ARCH=$KERNEL
-else
- export ARCH=''
- echo "Warning: Unknown architecture ($KERNEL)"
-fi
-
-if [ $ARCH = 'cygwin' ]; then
- export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Rational Software/RSINSTALLDIR' 2>/dev/null)"/Clearcase 2>/dev/null);
+if [ $ARCHITECTURE = 'cygwin' ]; then
+ # The following should work but fails because they are using /c to mount
+ # the C drive and that messes things up.
+ export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Atria/ClearCase/CurrentVersion/ProductHome' 2>/dev/null)" 2>/dev/null)
+ export CCHOME=/opt/rational/clearcase
else
export CCHOME="/opt/rational/clearcase"
fi
export CLEARCASE_BLD_HOST_TYPE="unix"
if [ -f "$CCHOME/etc/utils/creds" ]; then
- if [ $ARCH = 'cygwin' ]; then
+ if [ $ARCHITECTURE = 'cygwin' ]; then
alias creds=$(cygpath "$CCHOME/etc/utils/creds")
else
alias creds="$CCHOME/etc/utils/creds"
if [ -x "$CLEARTOOL" ]; then
# Cleartool suddenly started appending ^M's (I think as of 7.1)
- if [ $ARCH = 'cygwin' ]; then
+ if [ $ARCHITECTURE = 'cygwin' ]; then
# Need to set pipefail to pick up the exit code from cleartool
# otherwise we get the exit code from tr which is usually 0
set -o pipefail
# View related functions
function setview {
- if [ $ARCH = 'cygwin' ]; then
+ if [ $ARCHITECTURE = 'cygwin' ]; then
if [[ $1 = -* ]]; then
echo "The setview command with options is not supported on Windows"
return
if [ $# != 1 ]; then
echo "vtree: Error: Must specify an element to view its version tree"
else
- if [ $ARCH = 'cygwin' ]; then
+ if [ $ARCHITECTURE = 'cygwin' ]; then
scm lsvtree -g "$@"
else
xlsvtree "$@"
unreserve \
"
-if [ $ARCH = 'cygwin' ]; then
+if [ $ARCHITECTURE = 'cygwin' ]; then
_arch_policies="\
POLICY_WIN_INT_SNAP \
POLICY_WIN_DEV_SNAP \
# We simply must rid ourselves of these bloody backlashes!!! And yet Clearcase
# insists on retaining them. Let's strip them off, do our thing, then put them
# back to backslashes when we output stuff.
- if [ $ARCH = 'cygwin' ]; then
+ if [ $ARCHITECTURE = 'cygwin' ]; then
if [ $# -eq 0 ]; then
scm lsvob -short | sed 's:\\:\\\\\\\\:'
else
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
- if [[ $cur == -* && $ARCH != cygwin ]]; then
+ if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then
COMPREPLY=($(compgen -W "$opts" -- $cur))
elif [[ $cur == * ]]; then
COMPREPLY=($(compgen -W "$(_views $cur)"))
fi
} # _object_selector
-complete -o default -F _scm scm ct
-
-complete -F _catcs catcs
-complete -F _checkin ci
-complete -F _deliver deliver
-complete -F _endview endview
-complete -F _lsactivity lsact
-complete -F _lsbl lsbl
-complete -F _lsproject lsproj
-complete -F _lsfolder lsfolder llfolder
-complete -F _lsstgloc lsstgloc
-complete -F _lsstream lsstream llstream
-complete -F _lsview lsview llview
-complete -F _lsvob lsvob llvob
-complete -F _merge merge
-complete -F _mktag mktag
-complete -F _mkview mkview
-complete -F _rebase rebase
-complete -F _rmtag rmtag
-complete -F _rmview rmview
-complete -F _setactivity setact
-complete -F _setcs setcs
-complete -F _setview setview
-complete -F _startview startview
-complete -F _space space
-complete -F _register register
-complete -F _uncheckout unco
-complete -F _unregister unregister
-
-complete -F _object_selector -o nospace lstype
-complete -F _object_selector -o nospace lltype
-complete -F _object_selector -o nospace lslock
-complete -F _object_selector -o nospace lllock
+if [[ $BASH_VERSION = 2.05* || $BASH_VERSION = 4* ]]; then
+ complete -o default -F _scm scm ct
+
+ complete -F _catcs catcs
+ complete -F _checkin ci
+ complete -F _deliver deliver
+ complete -F _endview endview
+ complete -F _lsactivity lsact
+ complete -F _lsbl lsbl
+ complete -F _lsproject lsproj
+ complete -F _lsfolder lsfolder llfolder
+ complete -F _lsstgloc lsstgloc
+ complete -F _lsstream lsstream llstream
+ complete -F _lsview lsview llview
+ complete -F _lsvob lsvob llvob
+ complete -F _merge merge
+ complete -F _mktag mktag
+ complete -F _mkview mkview
+ complete -F _rebase rebase
+ complete -F _rmtag rmtag
+ complete -F _rmview rmview
+ complete -F _setactivity setact
+ complete -F _setcs setcs
+ complete -F _setview setview
+ complete -F _startview startview
+ complete -F _space space
+ complete -F _register register
+ complete -F _uncheckout unco
+ complete -F _unregister unregister
+else
+ : echo 'Clearcase command completion broken on old Sun Bash shells'
+fi
+
+if [[ $BASH_VERSION = 4* ]]; then
+ complete -F _object_selector -o nospace lstype
+ complete -F _object_selector -o nospace lltype
+ complete -F _object_selector -o nospace lslock
+ complete -F _object_selector -o nospace lllock
+elif [[ $BASH_VERSION = 2.05* ]]; then
+ complete -F _object_selector lstype
+ complete -F _object_selector lltype
+ complete -F _object_selector lslock
+ complete -F _object_selector lllock
+ #echo 'Clearcase command completion partially broken on old Sun Bash shells'
+fi