* libc/stdio/fgets.c (fgets): perform CRLF conversions if __SCLE
This commit is contained in:
parent
e73a56e982
commit
f43932615d
|
@ -1,3 +1,7 @@
|
||||||
|
2000-05-18 DJ Delorie <dj@cygnus.com>
|
||||||
|
|
||||||
|
* libc/stdio/fgets.c (fgets): perform CRLF conversions if __SCLE
|
||||||
|
|
||||||
Mon May 15 18:54:00 2000 Jeff Johnston <jjohnstn@cygnus.com>
|
Mon May 15 18:54:00 2000 Jeff Johnston <jjohnstn@cygnus.com>
|
||||||
|
|
||||||
* libc/include/ctype.h: Changed tolower and toupper macros
|
* libc/include/ctype.h: Changed tolower and toupper macros
|
||||||
|
|
|
@ -79,6 +79,25 @@ _DEFUN (fgets, (buf, n, fp),
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
s = buf;
|
s = buf;
|
||||||
|
|
||||||
|
#ifdef __SCLE
|
||||||
|
if (fp->_flags & __SCLE)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
/* Sorry, have to do it the slow way */
|
||||||
|
while (--n > 0 && (c = __sgetc(fp)) != EOF)
|
||||||
|
{
|
||||||
|
*s++ = c;
|
||||||
|
if (c == '\n')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (c == EOF && s == buf)
|
||||||
|
return NULL;
|
||||||
|
*s = 0;
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
n--; /* leave space for NUL */
|
n--; /* leave space for NUL */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue