win: local \r cancellation

Change-Id: I4becec052af58c5a52b777004867eb23023b9403
Reviewed-on: https://plan9port-review.googlesource.com/1391
Reviewed-by: Russ Cox <rsc@google.com>
This commit is contained in:
Russ Cox 2015-11-10 10:33:12 -05:00 committed by Russ Cox
parent 0d2dfbc84f
commit 8db40354c5

View file

@ -483,7 +483,7 @@ int
dropcr(char *p, int n)
{
int i;
char *w, *r;
char *w, *r, *q;
r = p;
w = p;
@ -494,6 +494,19 @@ dropcr(char *p, int n)
w--;
break;
case '\r':
while(i<n-1 && *(r+1) == '\r') {
r++;
i++;
}
if(i<n && *(r+1) != '\n') {
q = r;
while(q>p && *(q-1) != '\n')
q--;
if(q > p) {
w = q;
break;
}
}
*w++ = '\n';
break;
default: