+2000-05-19 DJ Delorie <dj@cygnus.com>
+
+ * syscalls.cc (setmode): change mode of any matching FILE* also.
+
Thu May 18 17:28:19 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Remove external.h dependency.
return (char *)(dtable[fd]->ttyname ());
}
+/* internal newlib function */
+extern "C" int _fwalk (struct _reent *ptr, int (*function)(FILE *));
+
+static int setmode_mode;
+static int setmode_file;
+
+static int
+setmode_helper (FILE *f)
+{
+ if (fileno(f) != setmode_file)
+ return 0;
+ if (setmode_mode & O_TEXT)
+ f->_flags |= __SCLE;
+ else
+ f->_flags &= ~__SCLE;
+ return 0;
+}
+
/* Set a file descriptor into text or binary mode, returning the
previous mode. */
p->set_r_binary (0);
}
+ setmode_mode = mode;
+ setmode_file = fd;
+ _fwalk(_REENT, setmode_helper);
+
return res;
}