Fossil

Check-in [a7392129]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Always call Tcl_FindExecutable, even when the command line arguments are invalid.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tcl-argv-handling-v2
Files: files | file ages | folders
SHA1: a7392129c060e1d365924b98e36658c08f405163
User & Date: mistachkin 2012-08-22 11:42:35.906
Context
2012-08-22
11:51
Merge the TCL argument handling patches into trunk. ... (check-in: b6a7e52c user: drh tags: trunk)
11:42
Always call Tcl_FindExecutable, even when the command line arguments are invalid. ... (Closed-Leaf check-in: a7392129 user: mistachkin tags: tcl-argv-handling-v2)
11:33
When there are no command line arguments, set the argv script variable to an empty list. ... (check-in: b04d5ab4 user: mistachkin tags: tcl-argv-handling-v2)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/th_tcl.c.
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449
450
451
452
453
454
455
456

457
458
459
460
461
462
463
static int createTclInterp(
  Th_Interp *interp,
  void *pContext
){
  struct TclContext *tclContext = (struct TclContext *)pContext;
  int argc;
  char **argv;

  Tcl_Interp *tclInterp;

  if ( !tclContext ){
    Th_ErrorMessage(interp,
        "Invalid Tcl context", (const char *)"", 0);
    return TH_ERROR;
  }
  if ( tclContext->interp ){
    return TH_OK;
  }
  argc = tclContext->argc;
  argv = tclContext->argv;
  if ( argc>0 && argv ) {
    Tcl_FindExecutable(argv[0]);
  }

  tclInterp = tclContext->interp = Tcl_CreateInterp();
  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
    Th_ErrorMessage(interp,
        "Could not create Tcl interpreter", (const char *)"", 0);
    return TH_ERROR;
  }
  if( Tcl_Init(tclInterp)!=TCL_OK ){







>












|
|

>







435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
static int createTclInterp(
  Th_Interp *interp,
  void *pContext
){
  struct TclContext *tclContext = (struct TclContext *)pContext;
  int argc;
  char **argv;
  char *argv0 = 0;
  Tcl_Interp *tclInterp;

  if ( !tclContext ){
    Th_ErrorMessage(interp,
        "Invalid Tcl context", (const char *)"", 0);
    return TH_ERROR;
  }
  if ( tclContext->interp ){
    return TH_OK;
  }
  argc = tclContext->argc;
  argv = tclContext->argv;
  if( argc>0 && argv ){
    argv0 = argv[0];
  }
  Tcl_FindExecutable(argv0);
  tclInterp = tclContext->interp = Tcl_CreateInterp();
  if( !tclInterp || Tcl_InterpDeleted(tclInterp) ){
    Th_ErrorMessage(interp,
        "Could not create Tcl interpreter", (const char *)"", 0);
    return TH_ERROR;
  }
  if( Tcl_Init(tclInterp)!=TCL_OK ){