summaryrefslogtreecommitdiff
path: root/lib/__fpending.c
blob: 5b6e3e38170e571d036555c35901d469ac0e6e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
size_t
__fpending (FILE *fp)
{
#if STREAM_FPENDING_GLIBC2
  return fp->_IO_write_ptr - fp->_IO_write_base;
#endif

#if STREAM_FPENDING__PTR
  /* Traditional Unix */
  return fp->_ptr - fp->_base;
#endif

#if STREAM_FPENDING__P
  /* BSD */
  return fp->_p - fp->_bf._base;
#endif

#if STREAM_FPENDING__P
  /* SCO, Unixware */
  return fp->__ptr - fp->__base;
#endif

#if STREAM_FPENDING__BUFP
  /* old glibc? */
  return fp->__bufp - fp->__buffer;
#endif

#if STREAM_FPENDING__PPTR
  /* old glibc iostream? */
  return fp->_pptr - fp->_pbase;
#endif

#if STREAM_FPENDING__PTR_DEREF
  /* VMS */
  return (*fp)->_ptr - (*fp)->_base;
#endif

#if STREAM_FPENDING_NOT_AVAILABLE
  /* e.g., DGUX R4.11 */
  return 1; /* i.e. the info is not available */
#endif

}