diff options
author | dgp <dgp@noemail.net> | 2004-03-29 15:47:29 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2004-03-29 15:47:29 (GMT) |
commit | 77df904eeda98af1cb99636717601cf4af30f0b4 (patch) | |
tree | 35b7ab7ef8d01cc03d0f3752fd2e6741c4ce3feb /generic/tclMain.c | |
parent | fe5d8b414de96609c40ad910c95183a7f8d74588 (diff) | |
download | tcl-77df904eeda98af1cb99636717601cf4af30f0b4.zip tcl-77df904eeda98af1cb99636717601cf4af30f0b4.tar.gz tcl-77df904eeda98af1cb99636717601cf4af30f0b4.tar.bz2 |
* generic/tclMain.c (Tcl_Main, StdinProc): Append newline only to
incomplete scripts as part of multi-line script construction. Do
not add an extra trailing newline to the complete script. [Bug 833150]
FossilOrigin-Name: 98d02c126413690e5e6fb7abad88663bbcfbd1d2
Diffstat (limited to 'generic/tclMain.c')
-rw-r--r-- | generic/tclMain.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index 19cf5d5..80eb200 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -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: tclMain.c,v 1.23 2004/03/19 18:33:52 kennykb Exp $ + * RCS: @(#) $Id: tclMain.c,v 1.24 2004/03/29 15:47:31 dgp Exp $ */ #include "tcl.h" @@ -455,17 +455,17 @@ Tcl_Main(argc, argv, appInitProc) break; } - /* - * Add the newline removed by Tcl_GetsObj back to the string. - */ - - if (Tcl_IsShared(commandPtr)) { - Tcl_DecrRefCount(commandPtr); - commandPtr = Tcl_DuplicateObj(commandPtr); - Tcl_IncrRefCount(commandPtr); - } - Tcl_AppendToObj(commandPtr, "\n", 1); if (!TclObjCommandComplete(commandPtr)) { + /* + * Add the newline removed by Tcl_GetsObj back to the string. + */ + + if (Tcl_IsShared(commandPtr)) { + Tcl_DecrRefCount(commandPtr); + commandPtr = Tcl_DuplicateObj(commandPtr); + Tcl_IncrRefCount(commandPtr); + } + Tcl_AppendToObj(commandPtr, "\n", 1); prompt = PROMPT_CONTINUE; continue; } @@ -683,13 +683,13 @@ StdinProc(clientData, mask) return; } - if (Tcl_IsShared(commandPtr)) { - Tcl_DecrRefCount(commandPtr); - commandPtr = Tcl_DuplicateObj(commandPtr); - Tcl_IncrRefCount(commandPtr); - } - Tcl_AppendToObj(commandPtr, "\n", 1); if (!TclObjCommandComplete(commandPtr)) { + if (Tcl_IsShared(commandPtr)) { + Tcl_DecrRefCount(commandPtr); + commandPtr = Tcl_DuplicateObj(commandPtr); + Tcl_IncrRefCount(commandPtr); + } + Tcl_AppendToObj(commandPtr, "\n", 1); isPtr->prompt = PROMPT_CONTINUE; goto prompt; } |