diff options
author | dgp <dgp@users.sourceforge.net> | 2004-03-29 15:47:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-03-29 15:47:30 (GMT) |
commit | 36685551d45acf5e7551dc26ece246aaf9bf792c (patch) | |
tree | 35b7ab7ef8d01cc03d0f3752fd2e6741c4ce3feb /generic/tclMain.c | |
parent | c8e3b3d6810e3f38fd8ca4538eb288a79c5af5d9 (diff) | |
download | tcl-36685551d45acf5e7551dc26ece246aaf9bf792c.zip tcl-36685551d45acf5e7551dc26ece246aaf9bf792c.tar.gz tcl-36685551d45acf5e7551dc26ece246aaf9bf792c.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]
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; } |