Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdio/fgets.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c
index abc2bb97c..d395d3344 100644
--- a/newlib/libc/stdio/fgets.c
+++ b/newlib/libc/stdio/fgets.c
@@ -79,6 +79,25 @@ _DEFUN (fgets, (buf, n, fp),
return 0;
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 */
do
{