From 0728c98865e74d0166ad157308c0b19f8bd0d679 Mon Sep 17 00:00:00 2001 From: rjohnson Date: Tue, 13 Oct 1998 18:44:15 +0000 Subject: Fixed bug in "info complete" - it did not handle NULLs correctly. FossilOrigin-Name: 5ae085bcc21de9de1f5e59b1e85bc8909c02ac60 --- changes | 8 ++++++-- generic/tclCmdIL.c | 8 +++----- tests/info.test | 8 +++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/changes b/changes index 31f8f87..e886008 100644 --- a/changes +++ b/changes @@ -1,6 +1,6 @@ Recent user-visible changes to Tcl: -RCS: @(#) $Id: changes,v 1.23 1998/10/05 22:32:56 escoffon Exp $ +RCS: @(#) $Id: changes,v 1.24 1998/10/13 18:44:15 rjohnson Exp $ 1. No more [command1] [command2] construct for grouping multiple commands on a single command line. @@ -3622,4 +3622,8 @@ Windows, MYDLLNAME.DLL was sourced, and mydllname.dll loaded. (EMS) 10/5/98 (new feature) Created a new Tcl_Obj type, "procbody". This object's internal representation holds a pointer to a Proc structure. Extended -TclCreateProc to take both strings and "procbody" +TclCreateProc to take both strings and "procbody". (EMS) + +10/13/98 (bug fix) The "info complete" command can now handle strings +with NULLs embedded. Thanks to colin@field.medicine.adelaide.edu.au +for providing this fix. (RJ) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 470d291..a1e6894 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.7 1998/09/14 18:39:57 stanton Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.8 1998/10/13 18:44:16 rjohnson Exp $ */ #include "tclInt.h" @@ -762,19 +762,17 @@ InfoCompleteCmd(dummy, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - char *command; - if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "command"); return TCL_ERROR; } - command = Tcl_GetStringFromObj(objv[2], (int *) NULL); - if (Tcl_CommandComplete(command)) { + if (TclObjCommandComplete(objv[2])) { Tcl_SetIntObj(Tcl_GetObjResult(interp), 1); } else { Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); } + return TCL_OK; } diff --git a/tests/info.test b/tests/info.test index d4ad093..228524d 100644 --- a/tests/info.test +++ b/tests/info.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: info.test,v 1.3 1998/09/14 18:40:10 stanton Exp $ +# RCS: @(#) $Id: info.test,v 1.4 1998/10/13 18:44:16 rjohnson Exp $ if {[string compare test [info procs test]] == 1} then {source defs} @@ -233,6 +233,12 @@ test info-5.46 {info complete option} { test info-5.47 {info complete option} { info complete "abc\\\n" } 0 +test info-5.48 {info complete option} { + info complete "set x [binary format H 00]; puts hi" +} 1 +test info-5.49 {info complete option} { + info complete "set x [binary format H 00]; {" +} 0 test info-6.1 {info default option} { proc t1 {a b {c d} {e "long default value"}} {} -- cgit v0.12