ClearCase Development Environment
It is important that all of your ClearCase users have the same environment. Otherwise, it may be hard to tell if an error is due to environment problems or software problems. Many installations basically tell users how to modify their .login or .profile startup scripts to include /usr/atria/bin in the user's PATH, plus a few other changes.
This type of setup can cause many problems. First of all, a user might not be your exclusive user. That user might be involved with other development environments that contradict the way your environment might be setup. It also means trusting the users to change their own files to your specifications, and if you decide that there must be a change in your user's environment, then you will have to get this information to all the users, and verify each user made the change.
For example, there is a ClearCase environment variable called CCASE_BLD_UMASK. This variable specifies the UMASK for derived objects. In most ClearCase installations this variable is set to "002" to allow users to change the derived objects. If you forgot to tell your users to set this variable, then when a user winks in a Derived Object from another user's view, that Derived Object is read only. If a user tries to rebuild that object file, then their build will fail.
In order to solve this problem, you decide that all users have to now set CCASE_BLD_UMASK to "002". This would now have to be done for all users. Not only that, but this also has to be done for any new user. If you have a fairly small development team of ten to twelve users, this task could take a week or two. If you have 40 or more developers, getting all of the users to change their .profile or .login scripts would become impossible.
The best way to handle the environment problem is to give the users an environment file to actually load either on the command line, or one that can be placed into their .login or .profile script. This environment should contain all the correct environment variables including PATH, MANPATH, and special ClearCase environment variables. It should also contain any special aliases or shell functions that helps users in their development work.
This special environment file should not be sourced into the current user's environment. Doing that would make it impossible for the user to restore their original environment and do other work not related to the project. Instead, a sub-shell should be set at the end of your environment script.
Unix has many different shells in Unix, but your development environment should select a single shell for all users. This makes it easier for you, the ClearCase Administrator, to verify that all users actually have identical environments. If there are multiple shells, you must provide multiple environment files which means more work for you. Plus, the more files you must maintain, the more likely that some file will not be updated, and become out of sync with the rest of the environment.
There are two basic shell styles in Unix: The C-Shell environments that include csh, and the Turbo-C shell, and the Bourne based environment that include the Bourne, the BASH, the Kornshell, and the Posix shell. The original Unix shell is the Bourne shell developed at AT&T. It provided good programability, and became the standard shell for Unix adminstration scripts. The Csh was developed by Berkeley to take care of some of the deficiencies of the Bourne shell. This included adding command history editing, command aliasing, and shell file name completion. Other added functions including preventing accidental logging out when a CNTL-D was recieved (a common problem in the slow, noisy modem days).
Unfortunately, the syntax for the shell was completely rewritten making it incompatible with most of the established shell scripts. Not only was the syntax changed, but the Csh programming environment is buggy and not as well documented.
For years, most Unix people prefered to program shell scripts in Bourne shell, but use Csh as their environment shell. This allowed them to enjoy the features of the Bourne programming environment, but have the features found in Csh. In 1978, David Korn at AT&T developed a new shell based upon the Bourne shell that kept the standard Bourne shell syntax, but added and improved upon the features found in the Csh. Many users quickly switched to the Kornshell as their default enviroment. Some users, mainly on SunOS which refused to license the Kornshell, kept using the Csh.
My personal preference in ClearCase is stanrdizing on the Kornshell environment. The actual Kornshell is licensed on almost all Unix platforms including Sun (Solaris). In Unix platforms that do not have the actual Kornshell, the Public Domain Kornshell is available. Kornshell does all the must haves that are in Csh, and does them better (not personal opinion, but fact). Kornshell syntax is based upon Bourne shell, and almost all Bourne shell programs run easily under Kornshell. Also, the standard Posix shell is based upon Kornshell, and the default Motif shell is the Desktop Kornshell.
The Kornshell "select" syntax works out great when using ClearStart, and Kornshell is more efficient and faster than Bourne shell. However, the ability in Kornshell to define your environment file (instead of having an assumed default) makes it the winner when setting up a ClearCase environment.
I use two environment files in the ClearCase environment. The first is an executable Kornshell script called env that sits in the ClearCase Administrator's HOME directory. When this shell script is executed by the user, the script sets all environment variables needed for the ClearCase environment including PATH, MANPATH, and the special ClearCase environment variables. At the end of the env, a new Kornshell is envoked, and the environment file that contains the definitions for all the shell functions and aliases is set as the default environment. Whenever a user sets a view, the user's ClearCase environment file is automatically set. This feature is not easily available in other shells. In Csh, it is impossible to redefine the .cshrc file. In BASH, you must invoke bash -posix to get the same behavior, and in Zsh, you must redefine ZDOTROOT, and fiddle around with the file names.
Below is a commented version of the standard env and environment files that I do use.
The following file is my actual "env" file that I have users execute (not source in!) to set their ClearCase work environment. If you want to download a copy of this file, you may get it here.:
As a ClearCase administrator for an entire site, I may be administering ClearCase for several separate projects. Some of these projects might be part of the same department, so they share the license server and the ClearCase Registry too. Over the years, I have come up with a standardized way of defining the ClearCase environment and I attempt to use the same basic files over and over again. Much of this file is fairly automated. I might need to change one or two things which I place at the beginning of this file for this purpose.
Notice the #! /bin/ksh on the top. Most computers now can understand that this should be run under the Kornshell. However, you might have to specify /usr/local/bin/ksh or /usr/contrib/ksh or some other location depending upon your system. Some really brain dead C shells might still not recognize the "#!" magic symbol. If you have such a system, you might try replacing the "#!" with this:
:
if [ "$RANDOM" = "$RANDOM" ]
then
exec ksh $*
fi
This is the old hack that was needed for certain computer systems. All C shells will execute a shell script in Bourne shell if the first line in the file is a colon. In Kornshell, the $RANDOM variable will change each time it is used. So, in Kornshell $RANDOM will never equal $RANDOM. However, in Bourne shell, $RANDOM isn't usually defined, and if it is defined, the value won't change while the if statement is being executed. This almost guarantees that this script will be executed in Kornshell.
#! /bin/ksh
# env
########################################################################
########################################################################
# ENVIRONMENT SUBSHELL
#
# This program sets up all standard ClearCase Environment variables
# (start with CCENV_*), the standard Unix variables, and the
# ClearCase variables (start with CCASE_* or CLEARCASE_*) needed for
# this project. The project then sets "ENV" to point to the ClearCase
# Environement file that defines all the functions and aliases.
#
# Once this is done, Kornshell is called. Since all environment variables
# are exported, they are sent to subshell environments, and the ENV
# file reintroduces the aliases and functions that were previously
# defined.
#
########################################################################
########################################################################
# CONSTANTS TO SET
#
# These are constants used in the "environment" shell script. You
# set the project name (which might be different from the "user"
# ID. Everything else should be set more or less automatically, although
# it might vary from site to site more than project to project.
# directory this script is in.
#
#-----------------------------------------------------------------------
#
# CCENV_PROJ: Name of the Project. This must be set for each
# project. This is the used as the VOB mount point,
# and for the shell prompt.
#
# CCENV_HOME: Home directory of the ClearCase Administrator for
# this project. It should be the directory where this
# shell script is stored.
#
# CCENV_ROOT: This is the root directory where the project VOB
# directory mountpoint is actually attached. This only
# needs to be set once for the entire site. This is NOT
# the actual VOB mount point, but just the place where the
# mount point mounts. I usually simply have this set as
# "" so if my project is called foo, all of foo's VOBS
# would be mounted off of "/foo". Some sites might want
# something like "/vobs" so all of foo's VOBS will mount
# off of "/vobs/foo".
#
# CCENV_VIEWRDIR: The directory were all views are stored. Views
# shouldn't be stored in the user's HOME directory, but
# in a subdirectory off of a View Server which should
# be a fairly fast and reliable machine that no one
# ever logs onto. In many cases, it is the ClearCase
# VOB server.
#
# id: User's id. Used to create separate subdirectories for
# user's views. Might vary how to find from system to system
#
#-----------------------------------------------------------------------
#
#
The CCENV_PROJ variable is the only line that changes each time I use this file. I prefer to have CCENV_PROJ the same as the ClearCase Administrator user's ID. For example, this would be the TEK project, and the ClearCase Administrator for the TEK project is user "tek" who is also the owner of all the VOBs.
A user to set the ClearCase environment for this project would type in the following:
$ ~tek/env
This is usually pretty easy for most users to remember. However, many Bourne shells do not recognize the ~user syntax. For these users, they might have to type something like this:
$ /home/tek/env
However, considering that a Bourne shell user could easily use the Kornshell without the user even knowing it, I would recommend that you simply switch users from Bourne to Kornshell as their default shell. In fact, many operating systems now simply make /bin/sh a link to /bin/ksh.
export CCENV_PROJ="tek"
export CCENV_ROOT=""
I normally have the machine that I am using for the View Server to be the system where the ClearCase Administrator's HOME account is located. The CCENV_VIEWDIR variable is use by the .default file in ClearStart to store all of my user's views. If you have a lot of users, it might be impractical to store all of the views in a single location. In that case, you might need to expand the following line a bit so users are evenly divided between different systems.
Never, never allow views to be stored under the user's HOME directory.
export CCENV_VIEWDIR=$CCENV_HOME/views/$id
The following two lines set the CCENV_HOME directory to the directory where this file is located.
export CCENV_HOME=$(dirname $0)
[ "." = "$CCENV_HOME" ] && CCENV_HOME=$PWD
id ="$(id | sed 's/[^(]*(\([^(]*\)).*/\1/')"
#
########################################################################
########################################################################
# SETUP BASIC CLEARCASE ENVIRONMENT VARIABLES
#
# These are all self setting environment variables.
#
#-----------------------------------------------------------------------
#
#
# CCENV_VOB_ROOT: This is the root directory where the VOBS are actually
# attached. I take the CCENV_ROOT, and append the project
# name on it.
#
# HOSTNAME: Name of current machine. It is set in some Kornshells
# but not others. Since people depend upon it, I set it.
#
# ATRIAHOME: Home directory where ClearCase is loaded. Should always
# be /usr/atria, but who knows...
#
# CCENV_PROMPT: Part of the Unix Prompt. Uppercase of project's name
#
# BOLD/OBOLD: Used in various Shell Scripts to turn bold prompting on
# and off. Actually Standout Mode.
#
# cleartool: Where the cleartool command is located. Should be
# $ATRIAHOME/bin/cleartool aka /usr/atria/bin/cleartool.
#
#-----------------------------------------------------------------------
#
#
export CCENV_VOB_ROOT="$CCENV_ROOT/${CCENV_PROJ}"
export CCENV_ADMINVOB="$CCENV_VOB_ROOT/AdminVOB"
export HOSTNAME=$(uname -n)
export ATRIAHOME="/usr/atria"
typeset -u CCENV_PROMPT="$CCENV_PROJ"
export BOLD="$(tput smso 2> /dev/null)"
export OBOLD="$(tput rmso 2> /dev/null)"
export cleartool="$ATRIAHOME/bin/cleartool"
#
########################################################################
I normally place all of my ClearCase shell and Perl scripts that users should have access to under $CCENV_HOME/bin. However, there are times when you might use a binary like less or even a shell or Perl script will differ from system to system due to OS issues. I place these files under the directory $CCENV_HOME/bin/<os> the binaries and scripts that differ from system to system. The following is used to find out if I am executing Solaris or SunOS. This has to be modified depending upon whatever machines you tend to run into. Unfortunately, there is no easy way around this issue.
########################################################################
# FIND OUT IF YOU'RE SUN OR SOLARIS
#
# I store ClearCase scripts and binaries that all users should have
# direct access to under the $CCENV_HOME/bin directory. In a
# muli-system environment, there are some binaries that are machine
# specific. This part of this script figures out the type of system
# you're # on using the "uname -r" command. I need to know whether a
# system is Solaris or SunOS. This will have to be modified from site
# to get all the various possibilities.
#
typeset -L1 x_release=$(uname -r)
if [ "$x_release" = "5" ]
then
export CCENV_SYSTEM=solaris
else
export CCENV_SYSTEM=sun4
fi
export CCENV_SYSBIN=$CCENV_HOME/bin/$CCENV_SYSTEM
#
########################################################################
########################################################################
# IF SUNOS AND XTERM: CHANGE TO VT100
#
# Due to a "feature" in the SunOS Xterm termdef, ClearStart doesn't
# show a menu when run. To get around this problem, I change
# the term on Sun4 systems to "vt100".
#
[ "sun4" = "$CCENV_SYSTEM" -a "xterm" = "$TERM" ] && export TERM="vt100"
#
########################################################################
########################################################################
# SET PATH
#
# Setup of standard PATH for ClearCase. I merely prepend the ClearCase
# paths upon the user's path variables. I would prefer setting up
# the path from scratch so all users have the exact same environment,
# but too many users have their own favorite scripts. At least I
# make sure they execute something related to ClearCase or this
# environment before checking their own PATH
#
I have found that this is the best way to set a PATH in Unix. It is clear what you are setting, it is obvious if you are setting the same directory twice in your PATH, but best of all, doing it this way makes it easy to change the way you set your PATH when necessary.
If you also use ClearDDTs, you also should include it in this PATH.
PATH="$CCENV_SYSBIN:$PATH"
PATH="$ATRIAHOME/bin:$PATH"
PATH="$CCENV_HOME/bin:$PATH"
PATH="$ATRIAHOME/bugtrack:$PATH"
export PATH
#
########################################################################
########################################################################
# SET MANPATH
#
# Setup of standard MANPATH for ClearCase. I merely prepend the ClearCase
# paths upon the user's manpath variables.
#
MANPATH="$ATRIAHOME/doc/man:$MANPATH"
#
########################################################################
Again, I'll make the argument to use the Kornshell as the sole ClearCase environment shell. Even Sun includes the Kornshell in their release. I use to try to emulate much of what I do in this environment file in C shell, but maintaining two separate shell environments took too much time. Besides, you simply cannot match what I do in the env and environment files feature for feature with C shell.
If a user really starts to whine about not being able to use C shell (and I've only had two users who insisted on using C shell or Turbo C shell), give them a copy of the env and environment file, and tell them if they can rewrite this into C shell, and promise to maintain it, they can use C shell. No one has ever taken me up on that offer.
########################################################################
# SHELL MUST BE KORNSHELL
#
# I make all users use the Kornshell for their ClearCase shell. Even
# Sun Systems now come with it. It is easier to have a single standard
# shell for your development environment. The best all around purpose
# shell is Kornshell. It has all the "must haves" that C shell uses,
# and runs the standard Bourne syntax. It is now standard on almost
# all Unix systems, and if not, is available free from AT&T.
#
# Best of all, Kornshell allows me to redefine the user's environment file
# (which is usually $HOME/.kshrc) to whatever I want, and I use this
# feature. In Bourne shell, you have to run "bash -posix" to get this
# option to work. In Z-shell, you have to redefine "ZDOTDIR", and rename
# the "environment file to ".zshrc".
#
# BASH is a close second as a default shell, but has some problems
# with certain features. For example, BASH executes all for and while
# loops in a subshell. This means variables set there won't be set once
# you leave the loop which will cause havoc with the way CLEARCASE_AVOBS
# is set. It might be possible to modify this behavior, but I personally
# don't know how to do this.
#
# Becareful with PD-KSH. Various versions have various problems
# with what should be normal Kornshell behavior. For example,
#
# OLDIFS="$IFS"
# IFS=":"
# echo "ennie:menie:minie:moe" | read one two three
# IFS="$OLDIFS"
#
# in Kornshell will set one="ennie", two="menie", and three="minie:moe".
# This doesn't work with some versions of PD-KSH. However, there is
# nothing in the "env" file or the "environment" file that causes
# any known version of pdksh any problems.
#
# Z-Shell is too unstable and bloated to use as a default shell, but
# these script will work with Z-Shell if that is your site's preference.
# Many sites like Z-Shell because Z-shell accepts a lot of the Csh
# syntax and makes it a bit easier for a Csh user to convert over to
# Z-Shell.
#
if [ -f /bin/ksh ]
then
export SHELL="/bin/ksh"
else
export SHELL="/usr/local/bin/ksh"
fi
#
########################################################################
For a while, I tried installing ClearCase as a link install. That way, I could modify certain text configuration files in one location. However, when it came time to upgrade ClearCase, I've found problems with that type of installation. I was stuck upgrading each and every system at once whenever I installed a new version of ClearCase.
It is much easier to change these environment variables. For example, if you have to modify the xclearcase interface, you can prefix the GRP_PATH environment variable with $CCENV_HOME/grp, copy the grp file you want to change there, and modify the group file under the $CCENV_HOME/grp directory.
########################################################################
# STANDARD CLEARCASE ENVIRONMENT VARIABLES
#
# All of these are taken from the ClearCase Reference Manual in the
# env_ccase section. Most are commented out because I don't want
# to change them. However, the ones which I do set, I decomment
# the line and edit it.
#
#ATRIA_LICENSE_HOST= #HP-UX Only
#ATRIA_LINK_HOME= #HP-UX Only
#ATRIA_RGY_HOST= #HP-UX Only
#ATRIA_RGY_REGION= #HP-UX Only
#
#ATRIA_NO_BOLD=0 #Allow Bold character output
#BITMAP_PATH="$HOME/.bitmaps:$ATRIA_CONFIG_DIR/ui/bitmaps"
CLEARAUDIT_SHELL="$SHELL"
#CCASE_AUDIT_TMPDIR="/tmp" #Abe Temporary Files
#CLEARCASE_ABE_PN="$ATRIAHOME/etc/abe" #Audit Build Executor Location
#CCASE_BLD_NOWAIT #Wait for VOB locks on build
#CCASE_BLD_VOBS #Vobs to check for locks
CCASE_BLD_UMASK="2" #Umask for Derived Objects
#CLEARCASE_BLD_CONC="" #ClearCase Concurrency Level
#CLEARCASE_CXX_COMP_INST
#CLEARCASE_CMSAFE_CXX_LINK_INST
#CLEARCASE_INCREMENTAL_CXX_LINK_INST
#CLEARCASE_BLD_HOST_TYPE
#CLEARCASE_DEBUG_GROUP="0" #Print debugging info in xclearcase
#CLEARCASE_MAKE_CONFIG_DIR=$ATRIAHOME/config/clearmake
#CLEARCASE_MAKE_COMPAT
#CLEARCASE_BLD_OPTIONS_SPECS
#CLEARCASE_BLD_SHELL_FLAGS="-e"
#CLEARCASE_BLD_VERBOSITY=0
#CLEARCASE_MSG_PROTO #Who to talk to ToolTalk, SoftBench
CLEARCASE_OBSO_SYN_EV="WARN" #Warn of Obsolete Syntax Usage
#CLEARCASE_REMOTE_USER #clearexport_dsee Variable
#CLEARCASE_ROOT #Auto Set For View Path Extend Naming
#CLEARCASE_CMNT_PN= #Comment Caching File
#CLEARCASE_TAB_SIZE="8" #Tab Size for xcleardiff, etc.
#CLEARCASE_TRACE_TRIGGERS="0" #For Trigger Debugging
#EXPORT_REPLACE_CHAR="." #Invalid Chars in clearexport_* files
#EXPORT_REPLACE_COMM="made from flat file." #clearexport_ffile comment
#EXPORT_REPLACE_STRING="REPLACED" #For clearexport_*
#GRP_PATH="$HOME/grp:$ATRIAHOME/config/ui/grp" #Files xclearcase uses
#ICON_PATH="$HOME/.icon:$ATRIAHOME/config/ui/icon" #Icons used by xclearcase
A controversy erupted recently on the ClearCase International User Group's mailing list about the MAGIC_PATH environment variable. It is possible for a user to redefine it, and posibly override your site's policy. I recommend that you at least put a trigger on the chtype command and the mkelem command to mail you whenever a user creates a new element, or changes the element's type. This will allow you to make sure that users are not overriding your element type policy.
In places with really tight security, you may want use a trigger to verify that MAGIC_PATH had not been changed when a user does a cleartool mkelem.
MAGIC_PATH=$CCENV_HOME/magic:$ATRIAHOME/config/magic #Magic File
#MAKEFLAGS=""
#WINEDITOR=""
#SCHEMESEARCHPATH=/usr/lib/X11/%T/%N%:$ATRIAHOME/config/ui/%T/%N%S
#
# ####ClearStart "HOME" Directory
#
export CLEARSTART_HOME="$CCENV_HOME/clearstart"
#
########################################################################
########################################################################
# SET CLEARCASE_AVOBS VARIABLE
#
# Sets up the -avobs switch in various commands to only include the
# VOBs in the current project. This is done by seeing what other VOBs
# are linked to the Administration VOB. This is done with a cleartool
# describe command. The -fmt prevents printing of a "header" line,
# and the -ahlink AdminVOB only lists AdminVOB hyperlinks. The
# awk command simply strips out the VOB names. This will not work
# with the standard BASH shell since CLEARCASE_AVOBs is being
# set within the for loop. Should work with PD-KSH.
#
# I know I have personally rampaged against using the "for var in list"
# in many shell scripts, but this only applies if you don't know the
# size of the list being returned. The command buffer in Kornshell is
# guaranteed to be at least 65,000 characters, which will allow for
# over 1000 VOBs to be used in the for statement without over running
# the command buffer.
#
For a project, I create a single AdminVOB (I can't think for a reason why you might want more than one) and have all VOBs in the project point to this AdminVOB. This script uses the hyperlinks to find all the VOBs that user the current AdminVOB, and places them into $CLEARCASE_AVOBS.
CLEARCASE_AVOBS="$CCENV_ADMINVOB"
CCENV_VOBLIST=$($cleartool desc -fmt "" -ahlink AdminVOB vob:$CCENV_ADMINVOB \
| awk -F: '/AdminVOB/ {print $2}')
for vob in $CCENV_VOBLIST
do
CLEARCASE_AVOBS="$CLEARCASE_AVOBS:$vob"
done
#
########################################################################
########################################################################
# EXPORT ENVIRONMENT FILE IF NEEDED
#
# Tricky stuff. I need to set the ClearCase Environment File, yet
# I want to avoid infinite recursion too. To do this, I have to
# make sure that $OLDENV != $ENV. If it does, null out $OLDENV.
#
Kornshell users get really mad when you override their favorite settings. Therefore, I save the location of the user's ENV file, and source it in after I set everything. I really don't like doing that since users can completely change the environment that way. I have a policy that if a user is having ClearCase problems, and I suspect that it is due to their personal ENV file, I will insist that they get rid of it.
There is also a very simple rule when it comes to Kornshell environment files: The $ENV file should not print out anything to STDERR or STDOUT, and should not append or prepend any environment variables.
if [ "" = "$OLDENV" ]
then
export OLDENV="$ENV"
fi
export ENV=$CCENV_HOME/environment
[ "$ENV" = "$OLDENV" ] && OLDENV=""
#
########################################################################
########################################################################
# START THE SUBSHELL
#
# Starting this subshell will automatically source in the ClearCase
# $ENV file.
#
ksh
#
########################################################################
This file contains a few shell functions and a few aliases that make life a bit easier for the average ClearCase user. For example, for many ClearCase commands, I alias out the cleartool prefix.
#! /bin/ksh
# environment
#
# STANDARD ENVIRONMENT FILE FOR CLEARCASE
########################################################################
########################################################################
# STANDARD FUNCTIONS
#
# These are various functions that I use for my standard installation.
#
#-----------------------------------------------------------------------
#
# settitle : Sets the title of DtTerm and XTerm windows.
# setprompt: Sets the prompt to show view, project, directory.
# cd: Sets the prompt and title bar on cd changes.
# setview: Runs "ClearStart" if no view name is given.
# Otherwise, runs "cleartool setview"
# su: Sets the Titlebar on "su" command
# rlogin: Sets the Titlebar on "rlogin" command.
#
#-----------------------------------------------------------------------
#
#
# ####FUNCTION: settitle
#
I have found it easier to set the PATH, and the view's name in the ClearCase prompt. That way, a user can easily tell whether they are in a view, and which view (in case they are working in several views). I also include the project's name in the prompt because many users work in multiple projects. This makes the prompt quite long (especially with the ClearStart view tags) and I have now been placing the prompt on two separate lines.
Much of this information might work better in the Window title, and that might make the prompt fit on a single line. However, I've noticed that most users don't notice the Window's titlebar, so I still prefer the extra long prompt.
settitle()
{
[ "$TERM" != "xterm" -a "$TERM" != "dtterm" -a $TERM != "vt100" ] && return
[ -o interactive ] && print "]0;${1}\007"
}
#
# ####FUNCTION: setprompt
#
_setprompt ()
{
[ -x $cleartool ] && \
viewname="$(cleartool pwv -set -short 2> /dev/null)"
[ "** NONE **" = "$viewname" ] && viewname=""
[ "" != "$viewname" ] && viewname="[${viewname}]:"
dir="${PWD#$HOME}"
if [ "" = "$dir" ]
then
dir="~${LOGNAME}"
elif [ "x.$dir" != "x.$PWD" ]
then
dir="~${dir}"
fi
typeset -u prompt=$CCENV_PROJ
export PS1="
${BOLD}${prompt}:${viewname}${dir}
\$${OBOLD} "
}
#
# ####FUNCTION: cd
#
_cd()
{
\cd "$@"
_setprompt
}
alias cd="_cd"
#
# ####Set the Prompt and Titlebar
#
settitle $id@${HOSTNAME}
_setprompt
I've aliased the setview function to ClearStart. If you do specify a view, I then do execute the ClearTool command instead. Only later did I realize that if you give ClearStart a view name, it would automatically do the samething.
#
# ####Setview Function: If no parameter specified, sets view
#
setview()
{
if [ "" = "$1" ]
then
clearstart
else
$cleartool setview $1
fi
}
#
# ####Redefine su and rlogin Commands
#
I like the name of my machine and user on the titlebar of my window. However, if you rlogin or su to another system, and then exit that system, the titlebar didn't get changed. By defining these two functions, I fix that problem
function _rlogin
{
settitle ${id}@${1}
\rlogin "$@"
settitle ${id}@${HOSTNAME}
}
alias rlogin=_rlogin
function _su
{
settitle $1@${HOSTNAME}
\su "$@"
settitle ${id}@${HOSTNAME}
}
alias su=_su
#
########################################################################
########################################################################
# SET KORNSHELL OPTIONS
#
# These shouldn't be here either since it should be up to the
# individual user to set them. However, most of the people here
# use C Shell so these don't get set. I do re-read in the user's
# $ENV though so the user can reset these to their prefered values.
#
set -o allexport
set -o vi
set -o viraw
set -o nolog
#
########################################################################
########################################################################
# CLEARCASE ALIASES
#
# Various aliases that I use to make ClearCase a bit easier. Most
# simply remove having to put "cleartool" in front of each command.
# All the standard "ls" and "cat" commands are here (except ct ls).
# I also alias "cleartool" to simply "ct" and also alias the
# "ci", "co", and "unco" commands. People are just too use to them
# because of RCS.
#
Almost all of these simply remove the need for typing cleartool each time you want to execute the ClearCase command. The clearcase_tutor and the clearcase_help commands make it easier for users to access the hyperhelp program.
alias ct=$cleartool
alias ci="$cleartool ci"
alias co="$cleartool co"
alias unco="$cleartool unco"
alias desc="$cleartool describe"
alias describe="$cleartool describe"
alias edcs="$cleartool edcs"
alias pwv="$cleartool pwv"
alias xdiff="xcleardiff -blank"
alias clearcase_help="$ATRIAHOME/bin/hyperhelp $ATRIAHOME/doc/hlp/ref.hlp"
alias "clearcase_tutor=$ATRIAHOME/bin/hyperhelp $ATRIAHOME/doc/hlp/tut01.hlp &"
alias catcs="$cleartool catcs"
alias catcr="$cleartool catcr"
alias lsclients="$cleartool lsclients"
alias lsco="$cleartool lscheckout"
alias lsco="$cleartool lsco"
alias lsdo="$cleartool lsdo"
alias lshist="$cleartool lshistory"
alias lslock="$cleartool lslock"
alias lsp="$cleartool lsprivate"
alias lspool="$cleartool lspool"
alias lsprivate="$cleartool lsprivate"
alias lstype="$cleartool lstype"
alias lsview="$cleartool lsview"
alias lsvob="$cleartool lsvob"
alias lsvtree="$cleartool lsvtree"
#
#
########################################################################
########################################################################
# SET DEBUGGER IF DESIRED
#
# Neat little trick for Kornshell script debugging. If the variable
# DEBUG is set, and a script begins with "#! /bin/ksh", then set -xv
# is set, and each line prints as it is executed. The aliases make
# it easier to set this DEBUG variable. To debug a Kornshell script,
# type in "DEBUG" and run that Kornshell script. To turn off Debug
# Mode, type in UNDEBUG.
#
One of my favorite tricks. Simply type "DEBUG" at the Unix prompt, then any shell script that starts with "#! /bin/ksh" will automatically print out debugging information. To stop, simply type "UNDEBUG" at the Unix prompt. Makes it very easy to debug Kornshell scripts.
[ "$KSH_DEBUG" ] && set -xv
alias DEBUG="KSH_DEBUG=1"
alias UNDEBUG="unset KSH_DEBUG"
#
########################################################################
########################################################################
# LOAD OLD USER'S ENVIRONMENT FILE
#
# Reload in user's old Environment file if it exists. In our environment,
# we also must source in this /opt/bin/0LOAD file.
#
I hate doing this, but I guess if I was a user, I wouldn't want someone changing my shell settings either. I save the user's Kornshell Environment file and will source that in after I finish setting the ClearCase environment. This will allow me to reset the user's settings like using Emacs shell history editing instead of VI shell history editing, or some of the user's prefered aliases.
[ "" != "$OLDENV" ] && . $OLDENV
#
########################################################################