summaryrefslogtreecommitdiff
path: root/lib/__fpending.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-08-25 07:39:22 +0000
committerJim Meyering <jim@meyering.net>2000-08-25 07:39:22 +0000
commitf35a629b1006f966f1061dc539124486d84125a4 (patch)
tree5342564295b45a1a911214978347878df0f718dc /lib/__fpending.c
parent2115d8b251196a7fec09b6494e739e472b60e961 (diff)
downloadcoreutils-f35a629b1006f966f1061dc539124486d84125a4.tar.xz
*** empty log message ***
Diffstat (limited to 'lib/__fpending.c')
-rw-r--r--lib/__fpending.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/__fpending.c b/lib/__fpending.c
new file mode 100644
index 000000000..11f4981ea
--- /dev/null
+++ b/lib/__fpending.c
@@ -0,0 +1,43 @@
+size_t
+__fpending (FILE *fp)
+{
+#if FPENDING_GLIBC2
+ return fp->_IO_write_ptr - fp->_IO_write_base;
+#endif
+
+#if FPENDING__PTR
+ /* Traditional Unix */
+ return fp->_ptr - fp->_base;
+#endif
+
+#if FPENDING__P
+ /* BSD */
+ return fp->_p - fp->_bf._base;
+#endif
+
+#if FPENDING__P
+ /* SCO, Unixware */
+ return fp->__ptr - fp->__base;
+#endif
+
+#if FPENDING__BUFP
+ /* old glibc? */
+ return fp->__bufp - fp->__buffer;
+#endif
+
+#if FPENDING__PPTR
+ /* old glibc iostream? */
+ return fp->_pptr - fp->_pbase;
+#endif
+
+#if FPENDING__PTR_DEREF
+ /* VMS */
+ return (*fp)->_ptr - (*fp)->_base;
+#endif
+
+#if FPENDING_NOT_AVAILABLE
+ /* e.g., DGUX R4.11 */
+ return 1; /* i.e. the info is not available */
+#endif
+
+}