Version 0 of SrcFile

Updated 2005-05-19 15:27:45

I had a file intended to be sourced as well as evalled - that is, it was an executable file but could also be sourced into a running tcl program. Problem: "source" does not take args. So it was impossible to use the same argument parsing system for both modes. Or is it?

  proc srcfile { filename args } {
    global argv

    set argv $args
    source $filename
  }

This proc will, of course, mung your argument vector, so make sure you have parsed it before "srcfile" is used.