1 |
/* Bison Grammar Scanner -*- C -*- |
/* Bison Grammar Scanner -*- C -*- |
2 |
|
|
3 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of Bison, the GNU Compiler Compiler. |
This file is part of Bison, the GNU Compiler Compiler. |
6 |
|
|
682 |
static size_t |
static size_t |
683 |
no_cr_read (FILE *fp, char *buf, size_t size) |
no_cr_read (FILE *fp, char *buf, size_t size) |
684 |
{ |
{ |
685 |
size_t s = fread (buf, 1, size, fp); |
size_t bytes_read = fread (buf, 1, size, fp); |
686 |
if (s) |
if (bytes_read) |
687 |
{ |
{ |
688 |
char *w = memchr (buf, '\r', s); |
char *w = memchr (buf, '\r', bytes_read); |
689 |
if (w) |
if (w) |
690 |
{ |
{ |
691 |
char const *r = ++w; |
char const *r = ++w; |
692 |
char const *lim = buf + s; |
char const *lim = buf + bytes_read; |
693 |
|
|
694 |
for (;;) |
for (;;) |
695 |
{ |
{ |
718 |
} |
} |
719 |
} |
} |
720 |
|
|
721 |
return s; |
return bytes_read; |
722 |
} |
} |
723 |
|
|
724 |
|
|