]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/stdio/__fpending.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / stdio / __fpending.c
1 /* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
2  *
3  * GNU Library General Public License (LGPL) version 2 or later.
4  *
5  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
6  */
7
8 #include "_stdio.h"
9 #include <stdio_ext.h>
10
11 /* Solaris function --
12  * Returns the number of bytes in the buffer for a writing stream.
13  *
14  * NOTE: GLIBC DIFFERENCE!!!
15  *
16  * glibc will return the number of wide chars pending for wide oriented
17  * streams.  We always return the number of bytes in the buffer, as we
18  * convert wide chars to their multibyte encodings and buffer _those_.
19  */
20
21 #ifdef __UCLIBC_HAS_WCHAR__
22 #warning Note: Unlike the glibc version, this __fpending returns bytes in buffer for wide streams too!
23
24 link_warning(__fpending, "This version of __fpending returns bytes remaining in buffer for both narrow and wide streams.  glibc's version returns wide chars in buffer for the wide stream case.")
25
26 #endif
27
28 size_t __fpending(register FILE * __restrict stream)
29 {
30         __STDIO_STREAM_VALIDATE(stream);
31
32         return (__STDIO_STREAM_IS_WRITING(stream))
33                 ? __STDIO_STREAM_BUFFER_WUSED(stream)
34                 : 0;
35 }