001 #-----------------------------------------------------------------------
002 # assigns value to a TCL variable, defaults to specified value
003 # call: getenv name default
004 #-----------------------------------------------------------------------
005 proc getenv { Name Default} {
006 global env
007 if { [lsearch [array names env] $Name ] != -1 } { set x $env($Name)
008 } else { set x $Default }
009
010 puts "<<<getenv>>> : Name= $Name Default= $Default x= $x"
011 return $x
012 }
013
014 #-----------------------------------------------------------------------
015 # return name of the output file as specified on the command line
016 # assuming that ProductionExe was called as
017 #
018 # "ProductionExe -o output_file"
019 #-----------------------------------------------------------------------
020 proc get_output_file { Name } {
021 set x [split [exec ps -ww -C $Name -o cmd] ]
022 set of "";
023 set i 0 ;
024
025 foreach xx $x {
026 incr i ;
027 if { $xx == "-o" } { set of [lindex $x $i ] }
028 }
029 puts "<<<get_output_file>>>: output file = $of"
030 return $of
031 }
Send problems or questions to cdfcode@fnal.gov