From 7e49edb64137275cf35e60c0a8e8e596a1fd5fc3 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 14 Oct 2010 16:10:49 +1000 Subject: Set $argc in jimsh Apparently tclsh does this. It is just [llength $argv] Signed-off-by: Steve Bennett --- Tcl_shipped.html | 11 ++++++++++- jim_tcl.txt | 4 ++++ jimsh.c | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) 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.

+argc +
+
+

+ If jimsh is invoked to run a script, this variable contains the number + of arguments supplied to the script. +

+
+
jim_argv0
@@ -6365,7 +6374,7 @@ official policies, either expressed or implied, of the Jim Tcl Project.
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. diff --git a/jimsh.c b/jimsh.c index d5ad678..63569a7 100644 --- a/jimsh.c +++ b/jimsh.c @@ -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[]) -- cgit v1.1