summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-03-29 15:47:30 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-03-29 15:47:30 (GMT)
commit36685551d45acf5e7551dc26ece246aaf9bf792c (patch)
tree35b7ab7ef8d01cc03d0f3752fd2e6741c4ce3feb /generic
parentc8e3b3d6810e3f38fd8ca4538eb288a79c5af5d9 (diff)
downloadtcl-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')
-rw-r--r--generic/tclMain.c34
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;
}