freadahead.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Retrieve information about a FILE stream.
  2. Copyright (C) 2007-2013 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #include <stddef.h>
  14. #include <stdio.h>
  15. /* Assuming the stream STREAM is open for reading:
  16. Return the number of bytes waiting in the input buffer of STREAM.
  17. This includes both the bytes that have been read from the underlying input
  18. source and the bytes that have been pushed back through 'ungetc'.
  19. If this number is 0 and the stream is not currently writing,
  20. fflush (STREAM) is known to be a no-op.
  21. STREAM must not be wide-character oriented. */
  22. #if HAVE___FREADAHEAD /* musl libc */
  23. # include <stdio_ext.h>
  24. # define freadahead(stream) __freadahead (stream)
  25. #else
  26. # ifdef __cplusplus
  27. extern "C" {
  28. # endif
  29. extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE;
  30. # ifdef __cplusplus
  31. }
  32. # endif
  33. #endif