From 831826db9440c6d8f94cc57c85208d0c2674119e Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 19 May 2011 07:21:42 +0000 Subject: [PATCH] * libc/include/stdio_ext.h: New header. * libc/stdio/fpurge.c [!__rtems__] (__fpurge): New function. --- newlib/ChangeLog | 5 +++++ newlib/libc/include/stdio_ext.h | 22 ++++++++++++++++++++++ newlib/libc/stdio/fpurge.c | 23 +++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 newlib/libc/include/stdio_ext.h diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 5ae2a34b7..cbba19330 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2011-05-19 Yaakov Selkowitz + + * libc/include/stdio_ext.h: New header. + * libc/stdio/fpurge.c [!__rtems__] (__fpurge): New function. + 2011-05-19 Matthew Gretton-Dann * Makefile.am (install-data-local): Fix condition and rm call. diff --git a/newlib/libc/include/stdio_ext.h b/newlib/libc/include/stdio_ext.h new file mode 100644 index 000000000..fcfb662a0 --- /dev/null +++ b/newlib/libc/include/stdio_ext.h @@ -0,0 +1,22 @@ +/* + * stdio_ext.h + * + * Definitions for I/O internal operations, originally from Solaris. + */ + +#ifndef _STDIO_EXT_H_ +#define _STDIO_EXT_H_ + +#ifdef __rtems__ +#error " not supported" +#endif + +#include + +_BEGIN_STD_C + +void _EXFUN(__fpurge,(FILE *)); + +_END_STD_C + +#endif /* _STDIO_EXT_H_ */ diff --git a/newlib/libc/stdio/fpurge.c b/newlib/libc/stdio/fpurge.c index 41228efd7..7e23bb7fd 100644 --- a/newlib/libc/stdio/fpurge.c +++ b/newlib/libc/stdio/fpurge.c @@ -11,6 +11,8 @@ INDEX fpurge INDEX _fpurge_r +INDEX + __fpurge ANSI_SYNOPSIS #include @@ -18,6 +20,11 @@ ANSI_SYNOPSIS int _fpurge_r(struct _reent *<[reent]>, FILE *<[fp]>); + #include + #include + void __fpurge(FILE *<[fp]>); + + DESCRIPTION Use <> to clear all buffers of the given stream. For output streams, this discards data not yet written to disk. For input streams, @@ -26,6 +33,8 @@ but not yet read via <>. This is more severe than <>, and generally is only needed when manually altering the underlying file descriptor of a stream. +<<__fpurge>> behaves exactly like <> but does not return a value. + The alternate function <<_fpurge_r>> is a reentrant version, where the extra argument <[reent]> is a pointer to a reentrancy structure, and <[fp]> must not be NULL. @@ -42,6 +51,9 @@ No supporting OS subroutines are required. #include <_ansi.h> #include +#ifndef __rtems__ +#include +#endif #include #include "local.h" @@ -87,4 +99,15 @@ _DEFUN(fpurge, (fp), return _fpurge_r (_REENT, fp); } +#ifndef __rtems__ + +void +_DEFUN(__fpurge, (fp), + register FILE * fp) +{ + _fpurge_r (_REENT, fp); +} + +#endif + #endif /* _REENT_ONLY */