[444] | 1 | /* |
---|
| 2 | FUNCTION |
---|
| 3 | <<stdio_ext>>,<<__fbufsize>>,<<__fpending>>,<<__flbf>>,<<__freadable>>,<<__fwritable>>,<<__freading>>,<<__fwriting>>---access internals of FILE structure |
---|
| 4 | |
---|
| 5 | INDEX |
---|
| 6 | __fbufsize |
---|
| 7 | INDEX |
---|
| 8 | __fpending |
---|
| 9 | INDEX |
---|
| 10 | __flbf |
---|
| 11 | INDEX |
---|
| 12 | __freadable |
---|
| 13 | INDEX |
---|
| 14 | __fwritable |
---|
| 15 | INDEX |
---|
| 16 | __freading |
---|
| 17 | INDEX |
---|
| 18 | __fwriting |
---|
| 19 | |
---|
| 20 | SYNOPSIS |
---|
| 21 | #include <stdio.h> |
---|
| 22 | #include <stdio_ext.h> |
---|
| 23 | size_t __fbufsize(FILE *<[fp]>); |
---|
| 24 | size_t __fpending(FILE *<[fp]>); |
---|
| 25 | int __flbf(FILE *<[fp]>); |
---|
| 26 | int __freadable(FILE *<[fp]>); |
---|
| 27 | int __fwritable(FILE *<[fp]>); |
---|
| 28 | int __freading(FILE *<[fp]>); |
---|
| 29 | int __fwriting(FILE *<[fp]>); |
---|
| 30 | |
---|
| 31 | DESCRIPTION |
---|
| 32 | These functions provides access to the internals of the FILE structure <[fp]>. |
---|
| 33 | |
---|
| 34 | RETURNS |
---|
| 35 | <<__fbufsize>> returns the number of bytes in the buffer of stream <[fp]>. |
---|
| 36 | |
---|
| 37 | <<__fpending>> returns the number of bytes in the output buffer of stream <[fp]>. |
---|
| 38 | |
---|
| 39 | <<__flbf>> returns nonzero if stream <[fp]> is line-buffered, and <<0>> if not. |
---|
| 40 | |
---|
| 41 | <<__freadable>> returns nonzero if stream <[fp]> may be read, and <<0>> if not. |
---|
| 42 | |
---|
| 43 | <<__fwritable>> returns nonzero if stream <[fp]> may be written, and <<0>> if not. |
---|
| 44 | |
---|
| 45 | <<__freading>> returns nonzero if stream <[fp]> if the last operation on |
---|
| 46 | it was a read, or if it read-only, and <<0>> if not. |
---|
| 47 | |
---|
| 48 | <<__fwriting>> returns nonzero if stream <[fp]> if the last operation on |
---|
| 49 | it was a write, or if it write-only, and <<0>> if not. |
---|
| 50 | |
---|
| 51 | PORTABILITY |
---|
| 52 | These functions originate from Solaris and are also provided by GNU libc. |
---|
| 53 | |
---|
| 54 | No supporting OS subroutines are required. |
---|
| 55 | */ |
---|
| 56 | |
---|
| 57 | #ifndef __rtems__ |
---|
| 58 | |
---|
| 59 | #include <_ansi.h> |
---|
| 60 | #include <stdio.h> |
---|
| 61 | |
---|
| 62 | /* Subroutine versions of the inline or macro functions. */ |
---|
| 63 | |
---|
| 64 | size_t |
---|
| 65 | __fbufsize (FILE * fp) |
---|
| 66 | { |
---|
| 67 | return (size_t) fp->_bf._size; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | size_t |
---|
| 71 | __fpending (FILE * fp) |
---|
| 72 | { |
---|
| 73 | return fp->_p - fp->_bf._base; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | int |
---|
| 77 | __flbf (FILE * fp) |
---|
| 78 | { |
---|
| 79 | return (fp->_flags & __SLBF) != 0; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | int |
---|
| 83 | __freadable (FILE * fp) |
---|
| 84 | { |
---|
| 85 | return (fp->_flags & (__SRD | __SRW)) != 0; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | int |
---|
| 89 | __fwritable (FILE * fp) |
---|
| 90 | { |
---|
| 91 | return (fp->_flags & (__SWR | __SRW)) != 0; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | int |
---|
| 95 | __freading (FILE * fp) |
---|
| 96 | { |
---|
| 97 | return (fp->_flags & __SRD) != 0; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | int |
---|
| 101 | __fwriting (FILE * fp) |
---|
| 102 | { |
---|
| 103 | return (fp->_flags & __SWR) != 0; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | #endif /* __rtems__ */ |
---|