TABLE OF CONTENTS


::pwtk::prog

SYNOPSIS

proc ::pwtk::prog {prog {pathname {}}} {}
proc ::pwtk::prog {args} {

USAGE

    ::pwtk::prog PROG ?PATHNAME?

PURPOSE

Explicitly set or query the full pathname/filename for $prog executable.

Set mode:

     ::pwtk::prog PROG PATHNAME

Query mode:

     ::pwtk::prog PROG

ARGUMENTS

FURTHER DESCRIPTION

For example:

       ::pwtk::prog pw.x /full/path/to/pw.x

is equivalent to:

       ::pwtk::pw /full/path/to/pw.x

RETURN VALUE

The full pathname for the PROG, /full/path/to/prog (e.g. /full/path/to/pw.x)

SOURCE

    variable QEprog

    lassign $args prog pathname
    set PROG [string toupper [regsub {\.x$} $prog {}]]

    if { [llength $args] == 1 } {
        # query mode
        ifempty QEprog($PROG) {
            return [findExecutable $prog]
        } else {
            return $QEprog($PROG)
        }
    } elseif { [llength $args] == 2 } {
        # set mode
        return [set QEprog($PROG) [findExecutable $pathname]]
    } else {
        ::pwtk::error "wrong number of arguments, must be [procName] PROG ?PATHNAME?, but got: [procName] $args" 1
    }
}