From b5e90c4656599710617ca6a24c750ef9f1c93b5f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 16:20:12 +0000
Subject: avoid warning on gcc 4.6+


diff --git a/lib/fadvise.c b/lib/fadvise.c
index 8d3af99..f9e0f27 100644
--- a/lib/fadvise.c
+++ b/lib/fadvise.c
@@ -14,6 +14,10 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNU_C__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+#endif
+
 #include <config.h>
 #include "fadvise.h"
 
-- 
1.8.3.4


From 23a01facb7fd62c93e3df82a4302dca3aaee4944 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 17:18:52 +0000
Subject: define __USE_GNU for wempcpy


diff --git a/lib/fnmatch.c b/lib/fnmatch.c
index 6a09e1a..a26b0ca 100644
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -21,6 +21,9 @@
 #ifndef _GNU_SOURCE
 # define _GNU_SOURCE    1
 #endif
+#ifndef __USE_GNU
+# define __USE_GNU		1
+#endif
 
 #if ! defined __builtin_expect && __GNUC__ < 3
 # define __builtin_expect(expr, expected) (expr)
-- 
1.8.3.4


From a277df80f2d5dba4b4519a97ea9042fb56c9feb5 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 17:22:10 +0000
Subject: force declaration of rpl_inet_ntop


diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index ba89e97..3be3941 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -72,7 +72,7 @@
 
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
-# if @REPLACE_INET_NTOP@
+# if 1
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef inet_ntop
 #   define inet_ntop rpl_inet_ntop
-- 
1.8.3.4


From e0b54fa2760209c59364a131cd7aced2f9958790 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 17:32:36 +0000
Subject: Haiku defines mknod in unistd.h


diff --git a/lib/mknod.c b/lib/mknod.c
index 71e9d34..1dc218c 100644
--- a/lib/mknod.c
+++ b/lib/mknod.c
@@ -18,6 +18,7 @@
 
 #include <config.h>
 
+#include <unistd.h>
 #include <sys/stat.h>
 
 #include <errno.h>
-- 
1.8.3.4


From 45cd156446cd8ac305462f48b2e871fdddc39b93 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 17:35:25 +0000
Subject: protect the label, not used on Haiku


diff --git a/lib/mountlist.c b/lib/mountlist.c
index b839cd1..c095a25 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -953,7 +953,7 @@ read_file_system_list (bool need_fs_type)
   *mtail = NULL;
   return mount_list;
 
-
+#ifndef __HAIKU__
  free_then_fail:
   {
     int saved_errno = errno;
@@ -969,6 +969,7 @@ read_file_system_list (bool need_fs_type)
     errno = saved_errno;
     return NULL;
   }
+#endif
 }
 
 /* Free a mount entry as returned from read_file_system_list ().  */
-- 
1.8.3.4


From 0dcf7067f72fdb61b8ce4705dae4a6e82ac7542f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 May 2014 17:38:39 +0000
Subject: protect a bool not used on Haiku


diff --git a/lib/rename.c b/lib/rename.c
index 3e463ea..8dff5d5 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -285,7 +285,9 @@ rpl_rename (char const *src, char const *dst)
   char *dst_temp = (char *) dst;
   bool src_slash;
   bool dst_slash;
+#if RENAME_DEST_EXISTS_BUG
   bool dst_exists;
+#endif
   int ret_val = -1;
   int rename_errno = ENOTDIR;
   struct stat src_st;
@@ -340,7 +342,9 @@ rpl_rename (char const *src, char const *dst)
     {
       if (errno != ENOENT || (!S_ISDIR (src_st.st_mode) && dst_slash))
         return -1;
+#if RENAME_DEST_EXISTS_BUG
       dst_exists = false;
+#endif
     }
   else
     {
@@ -353,7 +357,9 @@ rpl_rename (char const *src, char const *dst)
       if (SAME_INODE (src_st, dst_st))
         return 0;
 # endif /* RENAME_HARD_LINK_BUG */
+#if RENAME_DEST_EXISTS_BUG
       dst_exists = true;
+#endif
     }
 
 # if (RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG        \
-- 
1.8.3.4


From c75141b2cf4726e9f83a2d415c3b1585360552cc Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 15:40:32 +0000
Subject: strchrnul needs __USE_GNU on Haiku


diff --git a/lib/regex.h b/lib/regex.h
index 854c6ed..86f16b8 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -31,8 +31,10 @@ extern "C" {
 /* Define __USE_GNU to declare GNU extensions that violate the
    POSIX name space rules.  */
 #ifdef _GNU_SOURCE
+#ifndef __USE_GNU
 # define __USE_GNU 1
 #endif
+#endif
 
 #ifdef _REGEX_LARGE_OFFSETS
 
diff --git a/lib/string.in.h b/lib/string.in.h
index d7a6c9c..729338d 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -23,6 +23,9 @@
 @PRAGMA_COLUMNS@
 
 /* The include_next requires a split double-inclusion guard.  */
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
 #@INCLUDE_NEXT@ @NEXT_STRING_H@
 
 #ifndef _@GUARD_PREFIX@_STRING_H
-- 
1.8.3.4


From ab49c9e1edac815682126be26afd0b70d1e30f87 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 15 May 2014 20:13:58 +0000
Subject: don't build hostid, uptime, nice, users, who, dd


diff --git a/Makefile.in b/Makefile.in
index dab25d0..3be1664 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -611,16 +611,15 @@ src_libver_a_LIBADD =
 nodist_src_libver_a_OBJECTS = src/version.$(OBJEXT)
 src_libver_a_OBJECTS = $(nodist_src_libver_a_OBJECTS)
 am__EXEEXT_1 = src/arch$(EXEEXT) src/hostname$(EXEEXT)
-am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) src/hostid$(EXEEXT) \
-	src/libstdbuf.so$(EXEEXT) src/nice$(EXEEXT) src/pinky$(EXEEXT) \
-	src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/uptime$(EXEEXT) \
-	src/users$(EXEEXT) src/who$(EXEEXT)
+am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) \
+	src/libstdbuf.so$(EXEEXT) \
+	src/stdbuf$(EXEEXT) src/stty$(EXEEXT)
 am__EXEEXT_3 = src/[$(EXEEXT) src/base64$(EXEEXT) \
 	src/basename$(EXEEXT) src/cat$(EXEEXT) src/chcon$(EXEEXT) \
 	src/chgrp$(EXEEXT) src/chmod$(EXEEXT) src/chown$(EXEEXT) \
 	src/cksum$(EXEEXT) src/comm$(EXEEXT) src/cp$(EXEEXT) \
 	src/csplit$(EXEEXT) src/cut$(EXEEXT) src/date$(EXEEXT) \
-	src/dd$(EXEEXT) src/dir$(EXEEXT) src/dircolors$(EXEEXT) \
+	src/dir$(EXEEXT) src/dircolors$(EXEEXT) \
 	src/dirname$(EXEEXT) src/du$(EXEEXT) src/echo$(EXEEXT) \
 	src/env$(EXEEXT) src/expand$(EXEEXT) src/expr$(EXEEXT) \
 	src/factor$(EXEEXT) src/false$(EXEEXT) src/fmt$(EXEEXT) \
@@ -3247,12 +3246,12 @@ WARN_ON_USE_H = lib/warn-on-use.h
 # FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am
 AM_CFLAGS = $(WERROR_CFLAGS)
 no_install__progs = src/arch src/hostname
-build_if_possible__progs = src/chroot src/df src/hostid \
+build_if_possible__progs = src/chroot src/df \
 	src/libstdbuf.so src/nice src/pinky src/stdbuf src/stty \
 	src/uptime src/users src/who
 default__progs = src/[ src/base64 src/basename src/cat src/chcon \
 	src/chgrp src/chmod src/chown src/cksum src/comm src/cp \
-	src/csplit src/cut src/date src/dd src/dir src/dircolors \
+	src/csplit src/cut src/date src/dir src/dircolors \
 	src/dirname src/du src/echo src/env src/expand src/expr \
 	src/factor src/false src/fmt src/fold src/ginstall src/groups \
 	src/head src/id src/join src/kill src/link src/ln src/logname \
-- 
1.8.3.4
