This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Sebastian, On Jun 23 11:22, Sebastian Huber wrote: > This simplifies further changes in this area. > > Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> > --- > newlib/libc/stdio/findfp.c | 50 ++++++++++++++++++++++++++++++---------------- > 1 file changed, 33 insertions(+), 17 deletions(-) > > diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c > index ecc65d6d3..601795098 100644 > --- a/newlib/libc/stdio/findfp.c > +++ b/newlib/libc/stdio/findfp.c > @@ -84,6 +84,36 @@ _DEFUN(std, (ptr, flags, file), > #endif > } > > +static void > +stdin_init(FILE *ptr) > +{ > + std (ptr, __SRD, 0); > +} > + > +static void > +stdout_init(FILE *ptr) > +{ > + /* On platforms that have true file system I/O, we can verify > + whether stdout is an interactive terminal or not, as part of > + __smakebuf on first use of the stream. For all other platforms, > + we will default to line buffered mode here. Technically, POSIX > + requires both stdin and stdout to be line-buffered, but tradition > + leaves stdin alone on systems without fcntl. */ > +#ifdef HAVE_FCNTL > + std (ptr, __SWR, 1); > +#else > + std (ptr, __SWR | __SLBF, 1); > +#endif > +} > + > +static void > +stderr_init(FILE *ptr) > +{ > + /* POSIX requires stderr to be opened for reading and writing, even > + when the underlying fd 2 is write-only. */ > + std (ptr, __SRW | __SNBF, 2); > +} >. + Perhaps these func should be inline? Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |