summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-02-18 23:20:06 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-02-18 23:20:06 (GMT)
commit1a35a544342c26a5fa207edcd05448d6f525d9a1 (patch)
tree2f90d911ac81d67f6c4c48cd5168156dd5dd6aef /generic
parent9afa8a13e86fbd71a030ead7909cbe7d7db76296 (diff)
downloadtcl-1a35a544342c26a5fa207edcd05448d6f525d9a1.zip
tcl-1a35a544342c26a5fa207edcd05448d6f525d9a1.tar.gz
tcl-1a35a544342c26a5fa207edcd05448d6f525d9a1.tar.bz2
Callers of TranslateInputEOL are expected to manage the INPUT_NEED_NL flag.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index c862923..68d370a 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8824,6 +8824,20 @@ CopyAndTranslateBuffer(
if (bytesInBuffer <= copied) {
copied = bytesInBuffer;
}
+ if (copied == 0) {
+ return 0;
+ }
+ if (statePtr->flags & INPUT_NEED_NL) {
+ ResetFlag(statePtr, INPUT_NEED_NL);
+
+ if (RemovePoint(bufPtr)[0] == '\n') {
+ bufPtr->nextRemoved++;
+ *result = '\n';
+ } else {
+ *result = '\r';
+ }
+ return 1;
+ }
TranslateInputEOL(statePtr, result, RemovePoint(bufPtr),
&copied, &bytesInBuffer);
bufPtr->nextRemoved += bytesInBuffer;