Setting the EXECUTABLE_PATH State 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 will ignore directories named in the filter argument. The result is then set as the value of the CLI EXECUTABLE_PATH state 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 TotalView search path is set to the result. 
 
proc rpath { { root "." } { filter "/(CVS|RCS|SCCS)(/|$)" } } {
 
    # Invoke the UNIX find command to recursively obtain 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 final statement setting the EXECUTABLE_PATH state variable is the only statement that is unique to the CLI. All other statements are standard Tcl.

The dset command, like most 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.)

 
 
 
 
support@etnus.com
Copyright © 2001, Etnus, LLC. All rights reserved.
Version 5.0