diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-10-14 16:10:49 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-10-20 10:14:42 +1000 |
commit | 7e49edb64137275cf35e60c0a8e8e596a1fd5fc3 (patch) | |
tree | 2ae3f5c9d825e8b682f31125ffd0f4ce945b7940 | |
parent | ad3f49ba9d88bb6bfb67b4cc3806736857151ab0 (diff) | |
download | jimtcl-7e49edb64137275cf35e60c0a8e8e596a1fd5fc3.zip jimtcl-7e49edb64137275cf35e60c0a8e8e596a1fd5fc3.tar.gz jimtcl-7e49edb64137275cf35e60c0a8e8e596a1fd5fc3.tar.bz2 |
Set $argc in jimsh
Apparently tclsh does this. It is just [llength $argv]
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | Tcl_shipped.html | 11 | ||||
-rw-r--r-- | jim_tcl.txt | 4 | ||||
-rw-r--r-- | jimsh.c | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/Tcl_shipped.html b/Tcl_shipped.html index 99d87b7..1fb31eb 100644 --- a/Tcl_shipped.html +++ b/Tcl_shipped.html @@ -6302,6 +6302,15 @@ by the Tcl library.</p></div> </p>
</dd>
<dt class="hdlist1">
+<tt><strong>argc</strong></tt>
+</dt>
+<dd>
+<p>
+ If jimsh is invoked to run a script, this variable contains the number
+ of arguments supplied to the script.
+</p>
+</dd>
+<dt class="hdlist1">
<tt><strong>jim_argv0</strong></tt>
</dt>
<dd>
@@ -6365,7 +6374,7 @@ official policies, either expressed or implied, of the Jim Tcl Project.</tt></pr <div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2010-10-15 11:11:55 EST
+Last updated 2010-10-20 10:12:09 EST
</div>
</div>
</body>
diff --git a/jim_tcl.txt b/jim_tcl.txt index a11177f..0e9a780 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -4285,6 +4285,10 @@ The following global variables are set by jimsh. If jimsh is invoked to run a script, this variable contains a list of any arguments supplied to the script. ++*argc*+:: + If jimsh is invoked to run a script, this variable contains the number + of arguments supplied to the script. + +*jim_argv0*+:: The value of argv[0] when jimsh was invoked. @@ -134,6 +134,7 @@ static void JimSetArgv(Jim_Interp *interp, int argc, char *const argv[]) } Jim_SetVariableStr(interp, "argv", listObj); + Jim_SetVariableStr(interp, "argc", Jim_NewIntObj(interp, argc)); } int main(int argc, char *const argv[]) |