summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-10-31 16:43:27 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-10-31 16:43:27 (GMT)
commit22042ac17d28b7e80420612e880f6f4e3130db65 (patch)
tree6a344203c055c89c6bc0cb214b92128c1f8c2d60
parentc29a0584716dc23c315d6fbaf3c578e5aef6412c (diff)
downloadtcl-22042ac17d28b7e80420612e880f6f4e3130db65.zip
tcl-22042ac17d28b7e80420612e880f6f4e3130db65.tar.gz
tcl-22042ac17d28b7e80420612e880f6f4e3130db65.tar.bz2
Make [info globals ::foo] work. [Bug 1057461]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclCmdIL.c12
-rw-r--r--tests/info.test6
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e6a9b96..8b346e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tclCmdIL.c (InfoGlobalsCmd):
+ * tests/info.test (info-8.4): Strip leading global-namespace
+ specifiers from the pattern argument. [Bug 1057461]
+
2004-10-30 Miguel Sofer <msofer@users.sf.net>
* generic/tclCmdAH.c (Tcl_CatchObjCmd): removed erroneous comment
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index c692ce7..5951df7 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -15,7 +15,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.47.2.3 2004/10/14 15:28:38 dkf Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.4 2004/10/31 16:43:30 dkf Exp $
*/
#include "tclInt.h"
@@ -1082,7 +1082,15 @@ InfoGlobalsCmd(dummy, interp, objc, objv)
if (objc == 2) {
pattern = NULL;
} else if (objc == 3) {
- pattern = Tcl_GetString(objv[2]);
+ pattern = Tcl_GetString(objv[2]);
+ /*
+ * Strip leading global-namespace qualifiers. [Bug 1057461]
+ */
+ if (pattern[0] == ':' && pattern[1] == ':') {
+ while (*pattern == ':') {
+ pattern++;
+ }
+ }
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?pattern?");
return TCL_ERROR;
diff --git a/tests/info.test b/tests/info.test
index 715f9ae..27e6edc 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -11,7 +11,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.24.2.1 2003/03/27 13:11:14 dkf Exp $
+# RCS: @(#) $Id: info.test,v 1.24.2.2 2004/10/31 16:43:30 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -291,6 +291,10 @@ test info-8.2 {info globals option} {
test info-8.3 {info globals option} {
list [catch {info globals 1 2} msg] $msg
} {1 {wrong # args: should be "info globals ?pattern?"}}
+test info-8.4 {info globals option: may have leading namespace qualifiers} {
+ set x 0
+ list [info globals x] [info globals :x] [info globals ::x] [info globals :::x] [info globals ::::x]
+} {x {} x x x}
test info-9.1 {info level option} {
info level