--- coreutils-8.12/src/dd.c	2011-04-26 00:05:08.000000000 -0700
+++ coreutils-8.12/src/dd.c	2011-07-21 01:43:03.000000000 -0700
@@ -99,6 +99,14 @@
    OFF_T_MAX, for the benefit of the large-offset seek code.  */
 #define MAX_BLOCKSIZE(slop) MIN (SIZE_MAX - (slop), MIN (SSIZE_MAX, OFF_T_MAX))
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIuMAX
+#define PRIuMAX "llu"
+extern int fdatasync(int);
+#endif
+
+
 /* Conversions bit masks. */
 enum
   {
--- coreutils-8.12/src/getlimits.c	2011-02-19 09:17:03.000000000 -0800
+++ coreutils-8.12/src/getlimits.c	2011-07-21 01:49:03.000000000 -0700
@@ -55,6 +55,14 @@
 #define UID_T_MIN 0
 #define GID_T_MIN 0
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIdMAX
+#undef  PRIuMAX
+#define PRIdMAX "lld"
+#define PRIuMAX "llu"
+#endif
+
 void
 usage (int status)
 {
--- coreutils-8.12/src/md5sum.c	2011-04-25 02:45:49.000000000 -0700
+++ coreutils-8.12/src/md5sum.c	2011-07-21 01:44:18.000000000 -0700
@@ -102,6 +102,12 @@
    + 2 /* blank and binary indicator */ \
    + 1 /* minimum filename length */ )
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIuMAX
+#define PRIuMAX "llu"
+#endif
+
 /* True if any of the files read were the standard input. */
 static bool have_read_stdin;
 
--- coreutils-8.12/src/pr.c	2011-04-25 02:45:49.000000000 -0700
+++ coreutils-8.12/src/pr.c	2011-07-21 01:45:31.000000000 -0700
@@ -336,6 +336,12 @@
    the horizontal position start_position. */
 #define ANYWHERE	0
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIuMAX
+#define PRIuMAX "llu"
+#endif
+
 /* Each column has one of these structures allocated for it.
    If we're only dealing with one file, fp is the same for all
    columns.
--- coreutils-8.12/src/shred.c	2011-02-19 09:17:03.000000000 -0800
+++ coreutils-8.12/src/shred.c	2011-07-21 01:50:16.000000000 -0700
@@ -101,6 +101,11 @@
 #include "randint.h"
 #include "randread.h"
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+extern int fdatasync(int);
+#endif
+
 /* Default number of times to overwrite.  */
 enum { DEFAULT_PASSES = 3 };
 
--- coreutils-8.12/src/truncate.c	2011-02-19 09:17:03.000000000 -0800
+++ coreutils-8.12/src/truncate.c	2011-07-21 01:52:48.000000000 -0700
@@ -36,6 +36,12 @@
 
 #define AUTHORS proper_name_utf8 ("Padraig Brady", "P\303\241draig Brady")
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIdMAX
+#define PRIdMAX "lld"
+#endif
+
 /* (-c) If true, don't create if not already there */
 static bool no_create;
 
--- coreutils-8.12/src/uniq.c	2011-04-25 02:45:49.000000000 -0700
+++ coreutils-8.12/src/uniq.c	2011-07-21 01:50:44.000000000 -0700
@@ -51,6 +51,12 @@
     }						\
   while (0)
 
+#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
+#define DARWIN7
+#undef  PRIuMAX
+#define PRIuMAX "llu"
+#endif
+
 /* True if the LC_COLLATE locale is hard.  */
 static bool hard_LC_COLLATE;
 
