Fossil SCM
Restore the previous Tcl argc/argv handling as all the arguments will be used for the Tcl argv script variable.
Commit
c9bb3200658911d8c8cc73b8bd5d315101e51d9e
Parent
7f96a7159942bfd…
2 files changed
+4
-2
+5
-4
+4
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -86,11 +86,12 @@ | ||
| 86 | 86 | ** All Tcl related context information is in this structure. This structure |
| 87 | 87 | ** definition has been copied from and should be kept in sync with the one in |
| 88 | 88 | ** "th_tcl.c". |
| 89 | 89 | */ |
| 90 | 90 | struct TclContext { |
| 91 | - char *argv0; | |
| 91 | + int argc; | |
| 92 | + char **argv; | |
| 92 | 93 | Tcl_Interp *interp; |
| 93 | 94 | }; |
| 94 | 95 | #endif |
| 95 | 96 | |
| 96 | 97 | /* |
| @@ -411,11 +412,12 @@ | ||
| 411 | 412 | int idx; |
| 412 | 413 | int rc; |
| 413 | 414 | int i; |
| 414 | 415 | |
| 415 | 416 | #ifdef FOSSIL_ENABLE_TCL |
| 416 | - g.tcl.argv0 = argv[0]; | |
| 417 | + g.tcl.argc = argc; | |
| 418 | + g.tcl.argv = argv; | |
| 417 | 419 | g.tcl.interp = 0; |
| 418 | 420 | #endif |
| 419 | 421 | |
| 420 | 422 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 421 | 423 | memset(&g, 0, sizeof(g)); |
| 422 | 424 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -86,11 +86,12 @@ | |
| 86 | ** All Tcl related context information is in this structure. This structure |
| 87 | ** definition has been copied from and should be kept in sync with the one in |
| 88 | ** "th_tcl.c". |
| 89 | */ |
| 90 | struct TclContext { |
| 91 | char *argv0; |
| 92 | Tcl_Interp *interp; |
| 93 | }; |
| 94 | #endif |
| 95 | |
| 96 | /* |
| @@ -411,11 +412,12 @@ | |
| 411 | int idx; |
| 412 | int rc; |
| 413 | int i; |
| 414 | |
| 415 | #ifdef FOSSIL_ENABLE_TCL |
| 416 | g.tcl.argv0 = argv[0]; |
| 417 | g.tcl.interp = 0; |
| 418 | #endif |
| 419 | |
| 420 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 421 | memset(&g, 0, sizeof(g)); |
| 422 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -86,11 +86,12 @@ | |
| 86 | ** All Tcl related context information is in this structure. This structure |
| 87 | ** definition has been copied from and should be kept in sync with the one in |
| 88 | ** "th_tcl.c". |
| 89 | */ |
| 90 | struct TclContext { |
| 91 | int argc; |
| 92 | char **argv; |
| 93 | Tcl_Interp *interp; |
| 94 | }; |
| 95 | #endif |
| 96 | |
| 97 | /* |
| @@ -411,11 +412,12 @@ | |
| 412 | int idx; |
| 413 | int rc; |
| 414 | int i; |
| 415 | |
| 416 | #ifdef FOSSIL_ENABLE_TCL |
| 417 | g.tcl.argc = argc; |
| 418 | g.tcl.argv = argv; |
| 419 | g.tcl.interp = 0; |
| 420 | #endif |
| 421 | |
| 422 | sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0); |
| 423 | memset(&g, 0, sizeof(g)); |
| 424 |
+5
-4
| --- src/th_tcl.c | ||
| +++ src/th_tcl.c | ||
| @@ -93,11 +93,12 @@ | ||
| 93 | 93 | /* |
| 94 | 94 | ** Tcl context information used by TH1. This structure definition has been |
| 95 | 95 | ** copied from and should be kept in sync with the one in "main.c". |
| 96 | 96 | */ |
| 97 | 97 | struct TclContext { |
| 98 | - char *argv0; | |
| 98 | + int argc; | |
| 99 | + char **argv; | |
| 99 | 100 | Tcl_Interp *interp; |
| 100 | 101 | }; |
| 101 | 102 | |
| 102 | 103 | /* |
| 103 | 104 | ** Syntax: |
| @@ -340,11 +341,11 @@ | ||
| 340 | 341 | |
| 341 | 342 | /* |
| 342 | 343 | ** Array of Tcl integration commands. Used when adding or removing the Tcl |
| 343 | 344 | ** integration commands from TH1. |
| 344 | 345 | */ |
| 345 | -static const struct _Command { | |
| 346 | +static struct _Command { | |
| 346 | 347 | const char *zName; |
| 347 | 348 | Th_CommandProc xProc; |
| 348 | 349 | void *pContext; |
| 349 | 350 | } aCommand[] = { |
| 350 | 351 | {"tclEval", tclEval_command, 0}, |
| @@ -388,12 +389,12 @@ | ||
| 388 | 389 | return TH_ERROR; |
| 389 | 390 | } |
| 390 | 391 | if ( tclContext->interp ){ |
| 391 | 392 | return TH_OK; |
| 392 | 393 | } |
| 393 | - if ( tclContext->argv0 ){ | |
| 394 | - Tcl_FindExecutable(tclContext->argv0); | |
| 394 | + if ( tclContext->argc>0 && tclContext->argv ) { | |
| 395 | + Tcl_FindExecutable(tclContext->argv[0]); | |
| 395 | 396 | } |
| 396 | 397 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 397 | 398 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 398 | 399 | Th_ErrorMessage(interp, |
| 399 | 400 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 400 | 401 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -93,11 +93,12 @@ | |
| 93 | /* |
| 94 | ** Tcl context information used by TH1. This structure definition has been |
| 95 | ** copied from and should be kept in sync with the one in "main.c". |
| 96 | */ |
| 97 | struct TclContext { |
| 98 | char *argv0; |
| 99 | Tcl_Interp *interp; |
| 100 | }; |
| 101 | |
| 102 | /* |
| 103 | ** Syntax: |
| @@ -340,11 +341,11 @@ | |
| 340 | |
| 341 | /* |
| 342 | ** Array of Tcl integration commands. Used when adding or removing the Tcl |
| 343 | ** integration commands from TH1. |
| 344 | */ |
| 345 | static const struct _Command { |
| 346 | const char *zName; |
| 347 | Th_CommandProc xProc; |
| 348 | void *pContext; |
| 349 | } aCommand[] = { |
| 350 | {"tclEval", tclEval_command, 0}, |
| @@ -388,12 +389,12 @@ | |
| 388 | return TH_ERROR; |
| 389 | } |
| 390 | if ( tclContext->interp ){ |
| 391 | return TH_OK; |
| 392 | } |
| 393 | if ( tclContext->argv0 ){ |
| 394 | Tcl_FindExecutable(tclContext->argv0); |
| 395 | } |
| 396 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 397 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 398 | Th_ErrorMessage(interp, |
| 399 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 400 |
| --- src/th_tcl.c | |
| +++ src/th_tcl.c | |
| @@ -93,11 +93,12 @@ | |
| 93 | /* |
| 94 | ** Tcl context information used by TH1. This structure definition has been |
| 95 | ** copied from and should be kept in sync with the one in "main.c". |
| 96 | */ |
| 97 | struct TclContext { |
| 98 | int argc; |
| 99 | char **argv; |
| 100 | Tcl_Interp *interp; |
| 101 | }; |
| 102 | |
| 103 | /* |
| 104 | ** Syntax: |
| @@ -340,11 +341,11 @@ | |
| 341 | |
| 342 | /* |
| 343 | ** Array of Tcl integration commands. Used when adding or removing the Tcl |
| 344 | ** integration commands from TH1. |
| 345 | */ |
| 346 | static struct _Command { |
| 347 | const char *zName; |
| 348 | Th_CommandProc xProc; |
| 349 | void *pContext; |
| 350 | } aCommand[] = { |
| 351 | {"tclEval", tclEval_command, 0}, |
| @@ -388,12 +389,12 @@ | |
| 389 | return TH_ERROR; |
| 390 | } |
| 391 | if ( tclContext->interp ){ |
| 392 | return TH_OK; |
| 393 | } |
| 394 | if ( tclContext->argc>0 && tclContext->argv ) { |
| 395 | Tcl_FindExecutable(tclContext->argv[0]); |
| 396 | } |
| 397 | tclInterp = tclContext->interp = Tcl_CreateInterp(); |
| 398 | if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){ |
| 399 | Th_ErrorMessage(interp, |
| 400 | "Could not create Tcl interpreter", (const char *)"", 0); |
| 401 |