Tcl Command Line Parsing Problem

I have this one-liner:

puts “argc = $argc”

and saved it to cmdline.tcl. If I invoke the program directly like
this:

cmdline.tcl one two three

then the result is:

argc = 0

If I invoke it as:

tclsh cmdline.tcl one two three

then the result is correct:

argc = 3

The same program works fine on my Mac OS X Leopard machine. After posting my problem on comp.lang.tcl, I received help from Cameron Laird and was able to pinpoint the problem to the following registry key: HKEY_CLASSES_ROOT\tcl_auto_file\shell\open\command whose value was:

“C:\Tcl\bin\tclsh.exe” “%1”

After making the modification below, everything worked beautifully.

“C:\Tcl\bin\tclsh.exe” “%1” %*

UPDATE: After installing ActiveTcl 8.5, I found out a couple of changes:

  1. tclsh.exe no longer exists, instead, use tclsh85.exe
  2. HKEY_CLASSES_ROOT\ActiveTclScript\shell\open\command is the new registry location, by default, it invokes wish85.exe instead of tclsh85.exe

Blogged with Flock

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s