Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
07:57 • Closed ticket [219057ffff]: info script should take an option parameter so you c... artifact: b3e906ee59 user: dgp
07:57 • Open ticket [219057ffff]. artifact: ecc2db9f06 user: dgp
2000-10-26
08:34 • Closed ticket [219057ffff]. artifact: 1f0adf8d76 user: welch
01:09 • New ticket [219057ffff]. artifact: e69d007028 user: nobody

info script should take an option parameter so you can set t

Closed / Fixed219057ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:59
OriginalBugID: 4225 RFE
Version: 8.3
SubmitDate: '2000-02-22'
LastModified: '2000-05-27'
Severity: SER
Status: Released
Submitter: welch
ChangedBy: hobbs
OS: All
FixedDate: '2000-05-27'
FixedInVersion: 8.4a1
ClosedDate: '2000-10-25'


Anyone that overrides the "source" command has a problem with

info script - it won't return the correct value.  By allowing an

optional parameter to info script that sets the current script value,

then a proper hooking of source can be achieved.  Otherwise you have

to redefine the whole info command, which can slow down your whole

application miserably.



Patch:



Index: generic/tclCmdIL.c

===================================================================

RCS file: /home/cvs/external/tcl/generic/tclCmdIL.c,v

retrieving revision 1.26

diff -r1.26 tclCmdIL.c

1581c1581,1583

<  *          info script

---

>  *          info script ?newName?

>  *

>  *If newName is specified, it will set that as the internal name.

1588c1590,1591

<  *an error, the result is an error message.

---

>  *an error, the result is an error message.  It may change the

>  *internal script filename.

1601c1604

<     if (objc != 2) {

---

>     if ((objc != 2) && (objc != 3)) {

1605a1609,1618

>     if (objc == 3) {

> int length;

> char *filename = Tcl_GetStringFromObj(objv[2], &length);

> 

> if (iPtr->scriptFile != NULL) {

>     ckfree(iPtr->scriptFile);

> }

> iPtr->scriptFile = ckalloc((unsigned) (length + 1));

> strcpy(iPtr->scriptFile, filename);

>     }

Index: generic/tclIOUtil.c

===================================================================

RCS file: /home/cvs/external/tcl/generic/tclIOUtil.c,v

retrieving revision 1.10

diff -r1.10 tclIOUtil.c

327c327,328

<     iPtr->scriptFile = fileName;

---

>     iPtr->scriptFile = ckalloc((unsigned) (strlen(fileName) + 1));

>     strcpy(iPtr->scriptFile, fileName);

329a331

>     ckfree(iPtr->scriptFile);



Patched as above for 8.4a1. 
-- 05/27/2000 hobbs
welch Closed ticket [219057ffff]. [History diff]2000-10-26 08:34:06
dgp Open ticket [219057ffff]. [History diff]2001-04-05 07:57:11
dgp Closed ticket [219057ffff]. [History diff]2001-04-05 07:57:43
Log in (anonymous is fine) to add a comment.