mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
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:
parent
0d2dfbc84f
commit
8db40354c5
1 changed files with 14 additions and 1 deletions
|
@ -483,7 +483,7 @@ int
|
||||||
dropcr(char *p, int n)
|
dropcr(char *p, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *w, *r;
|
char *w, *r, *q;
|
||||||
|
|
||||||
r = p;
|
r = p;
|
||||||
w = p;
|
w = p;
|
||||||
|
@ -494,6 +494,19 @@ dropcr(char *p, int n)
|
||||||
w--;
|
w--;
|
||||||
break;
|
break;
|
||||||
case '\r':
|
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';
|
*w++ = '\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue