bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: portability tweak for Tru64 V4.0.


From: Jim Meyering
Subject: FYI: portability tweak for Tru64 V4.0.
Date: Wed, 25 Oct 2006 11:48:16 +0200

2006-10-25  Jim Meyering  <address@hidden>

        Portability to Tru64 V4.0.
        * src/system.h (ftello) [!HAVE_FSEEKO && !defined ftello]:
        Define inline replacement function.
        This (along with a yesterday's fix for autoconf's
        _AC_SYS_LARGEFILE_MACRO_VALUE macro) makes it so coreutils
        now builds once more on Tru64 V4.0.  Reported by Nelson Beebe.

diff --git a/src/system.h b/src/system.h
index 87a379e..efe9290 100644
--- a/src/system.h
+++ b/src/system.h
@@ -515,10 +515,26 @@ #ifndef EOVERFLOW
 # define EOVERFLOW EINVAL
 #endif

-#if ! HAVE_FSEEKO && ! defined fseeko
-# define fseeko(s, o, w) ((o) == (long int) (o)                \
-                         ? fseek (s, o, w)             \
-                         : (errno = EOVERFLOW, -1))
+#if ! HAVE_FSEEKO
+# if ! defined fseeko
+#  define fseeko(s, o, w) ((o) == (long int) (o)       \
+                          ? fseek (s, o, w)            \
+                          : (errno = EOVERFLOW, -1))
+# endif
+# if ! defined ftello
+static inline off_t ftello (FILE *stream)
+{
+  off_t off = ftell (stream);
+  if (off < 0)
+    return off;
+  if (off != (long int) off)
+    {
+      errno = EOVERFLOW;
+      return -1;
+    }
+  return off;
+}
+# endif
 #endif

 #if ! HAVE_SYNC




reply via email to

[Prev in Thread] Current Thread [Next in Thread]