__fpending.c 778 B

12345678910111213141516171819202122232425262728
  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. #include "_stdio.h"
  8. #include <stdio_ext.h>
  9. /* Solaris function --
  10. * Returns the number of bytes in the buffer for a writing stream.
  11. *
  12. * NOTE: GLIBC DIFFERENCE!!!
  13. *
  14. * glibc will return the number of wide chars pending for wide oriented
  15. * streams. We always return the number of bytes in the buffer, as we
  16. * convert wide chars to their multibyte encodings and buffer _those_.
  17. */
  18. size_t __fpending(register FILE * __restrict stream)
  19. {
  20. __STDIO_STREAM_VALIDATE(stream);
  21. return (__STDIO_STREAM_IS_WRITING(stream))
  22. ? __STDIO_STREAM_BUFFER_WUSED(stream)
  23. : 0;
  24. }