The attached patch fixes DragonFly BSD support in gnulib. The patch is 
written by Matthew Dillon and is tested by many users as part of GNU m4 
pkgsrc package.


regards,

-- 
Hasso Tepper
diff --git a/lib/freadahead.c b/lib/freadahead.c
index 610de87..5914326 100644
--- a/lib/freadahead.c
+++ b/lib/freadahead.c
@@ -65,6 +65,8 @@ freadahead (FILE *fp)
 	 + (fp->_Mode & 0x4000 /* _MBYTE */
 	    ? (fp->_Back + sizeof (fp->_Back)) - fp->_Rback
 	    : 0);
+#elif defined __DragonFly__	/* DragonFly BSD */
+  return __sreadahead(fp);
 #else
  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
 #endif
diff --git a/lib/freading.c b/lib/freading.c
index e201b89..8abf478 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -46,6 +46,8 @@ freading (FILE *fp)
 #elif defined __QNX__               /* QNX */
   return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
 	  || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
+#elif defined __DragonFly__	/* DragonFly BSD */
+  return ((((struct __FILE_public *)fp)->_flags & __SRD) != 0);
 #else
  #error "Please port gnulib freading.c to your platform!"
 #endif
diff --git a/lib/fseeko.c b/lib/fseeko.c
index 536dfaf..12a2a6c 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -25,6 +25,17 @@
 
 #include "stdio-impl.h"
 
+#ifdef __DragonFly__
+#undef fseeko
+
+int
+rpl_fseeko (FILE *fp, off_t offset, int whence)
+{
+  return(fseeko(fp, offset, whence));
+}
+
+#else /* !__DragonFly__ */
+
 #undef fseeko
 #if !HAVE_FSEEKO
 # undef fseek
@@ -111,3 +122,4 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   else
     return fseeko (fp, offset, whence);
 }
+#endif /* !__DragonFly__ */

Reply via email to