| # utils.exp, a collection of Tcl/Expect utilities for texinfo tests. |
| |
| # ----------default-------------------------------------------- |
| # default VAR VALUE |
| # Check whether VAR exists and has a nonempty value; |
| # if not, use VALUE as the default |
| # ------------------------------------------------------------- |
| proc default {varname varval} { |
| upvar $varname outervar |
| if { ![info exists outervar] || [string match {} $outervar] } then { |
| verbose "Defaulting $varname to $varval\n" 1 |
| set outervar $varval |
| } else { |
| verbose "$varname retains existing value $outervar\n" 1 |
| } |
| return |
| } |
| |
| |
| # ----------is_executable-------------------------------------- |
| # is_executable NAME |
| # Boolean predicate: is NAME an executable file |
| # somewhere on our PATH? |
| # ------------------------------------------------------------- |
| proc is_executable {name} { |
| if [ file executable [which $name] ] then { |
| return 1 |
| } else { |
| return 0 |
| } |
| } |