Version 0 of source with args

Updated 2003-09-25 14:22:00

MGS [2003/09/25] - Sometimes it is useful to source a file and pass arguments to the script. Unfortunately, the source command only accepts a filename, but you can use the following procedure :

 proc src {file args} {
   set argv $::argv
   set argc $::argc
   set ::argv $args
   set ::argc [llength $args]
   set error [catch {uplevel [list source $file]} return]
   if { $error } { set code error } { set code ok }
   set ::argv $argv
   set ::argc $argc
   return -code $code $return
 }