Totalview® User Guide : PART III Using the CLI : Chapter 17 Seeing the CLI at Work : Setting the CLI EXECUTABLE_PATH Variable
Setting the CLI EXECUTABLE_PATH Variable
The following macro recursively descends through all directories, starting at a location that you enter. (This is indicated by the root argument.) The macro ignores directories named in the filter argument. The result is set as the value of the CLI EXECUTABLE_PATH state variable.
See also the TotalView Reference Guide’s entry for the EXECUTABLE_PATH variable
# Usage:
#
# rpath [root] [filter]
#
# If root is not specified, start at the current
# directory. filter is a regular expression that removes
# unwanted entries. If it is not specified, the macro
# automatically filters out CVS/RCS/SCCS directories.
#
# The search path is set to the result.
proc rpath {{root "."} {filter "/(CVS|RCS|SCCS)(/|$)"}} {
# Invoke the UNIX find command to recursively obtain
# a list of all directory names below "root".
set find [split [exec find $root -type d -print] \n]
set npath ""
# Filter out unwanted directories.
foreach path $find {
if {! [regexp $filter $path]} {
append npath ":"
append npath $path
}
}
# Tell TotalView to use it.
dset EXECUTABLE_PATH $npath
}
In this macro, the last statement sets the EXECUTABLE_PATH state variable. This is the only statement that is unique to the CLI. All other statements are standard Tcl.
The dset command, like most interactive CLI commands, begins with the letter d. (The dset command is only used in assigning values to CLI state variables. In contrast, values are assigned to Tcl variables by using the standard Tcl set command.)