fix \r followed by something else than \n or EOF

This commit is contained in:
mirabilos 2017-03-26 00:09:46 +01:00
parent 62a5331aee
commit 859746b30b
1 changed files with 9 additions and 3 deletions

12
eval.c
View File

@ -888,10 +888,16 @@ expand(
{
if (c == '\r') {
c = shf_getc(x.u.shf);
if (c == -1)
c = '\r';
else if (c != '\n')
switch (c) {
case '\n':
break;
default:
shf_ungetc(c, x.u.shf);
/* FALLTHROUGH */
case -1:
c = '\r';
break;
}
}
#endif
if (c == '\n')