Commit 2e96eb92 authored by Guido van Rossum's avatar Guido van Rossum

replace "\r\n" with "\n" at line end (Jim Ahlstrom)

parent b65a48e2
...@@ -235,6 +235,7 @@ tok_nextc(tok) ...@@ -235,6 +235,7 @@ tok_nextc(tok)
else { else {
int done = 0; int done = 0;
int cur = 0; int cur = 0;
char *pt;
if (tok->start == NULL) { if (tok->start == NULL) {
if (tok->buf == NULL) { if (tok->buf == NULL) {
tok->buf = NEW(char, BUFSIZ); tok->buf = NEW(char, BUFSIZ);
...@@ -295,6 +296,13 @@ tok_nextc(tok) ...@@ -295,6 +296,13 @@ tok_nextc(tok)
done = tok->inp[-1] == '\n'; done = tok->inp[-1] == '\n';
} }
tok->cur = tok->buf + cur; tok->cur = tok->buf + cur;
/* replace "\r\n" with "\n" */
pt = tok->inp - 2;
if (pt >= tok->buf && *pt == '\r') {
*pt++ = '\n';
*pt = '\0';
tok->inp = pt;
}
} }
if (tok->done != E_OK) { if (tok->done != E_OK) {
if (tok->prompt != NULL) if (tok->prompt != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment