From 212515aa37e4dc5c71ece6fd03e31756d384008f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 2 Mar 2021 22:44:28 +1000
Subject: Fixes for Haiku


diff --git a/html/Makefile.am b/html/Makefile.am
old mode 100755
new mode 100644
index aa6a741..c8af33c
--- a/html/Makefile.am
+++ b/html/Makefile.am
@@ -37,8 +37,8 @@ EXTRA_DIST = $(HelpHtml_DATA) $(HelpHtmlimg_DATA) $(HelpHtmlimages_DATA) \
 	httrack.css
 
 install-data-hook:
-	if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \
-		( cd $(DESTDIR)$(prefix)/share/httrack \
+	if test ! -L $(DESTDIR)$(prefix)/data/httrack/html ; then \
+		( cd $(DESTDIR)$(prefix)/data/httrack \
 			&& $(LN_S) $(htmldir) html \
 		) \
 	fi
diff --git a/html/Makefile.in b/html/Makefile.in
index 5da9b5d..1601b12 100644
--- a/html/Makefile.in
+++ b/html/Makefile.in
@@ -814,8 +814,8 @@ uninstall-am: uninstall-HelpHtmlDATA uninstall-HelpHtmlTxtDATA \
 
 
 install-data-hook:
-	if test ! -L $(DESTDIR)$(prefix)/share/httrack/html ; then \
-		( cd $(DESTDIR)$(prefix)/share/httrack \
+	if test ! -L $(DESTDIR)$(prefix)/data/httrack/html ; then \
+		( cd $(DESTDIR)$(prefix)/data/httrack \
 			&& $(LN_S) $(htmldir) html \
 		) \
 	fi
diff --git a/src/htsweb.c b/src/htsweb.c
index 77ad1a0..e36b06c 100644
--- a/src/htsweb.c
+++ b/src/htsweb.c
@@ -178,7 +178,7 @@ int main(int argc, char *argv[]) {
     fprintf(stderr,
             "usage: %s [--port <port>] [--ppid parent-pid] <path-to-html-root-dir> [key value [key value]..]\n",
             argv[0]);
-    fprintf(stderr, "example: %s /usr/share/httrack/\n", argv[0]);
+    fprintf(stderr, "example: %s /system/data/httrack/\n", argv[0]);
     return 1;
   }
 
diff --git a/src/minizip/ioapi.h b/src/minizip/ioapi.h
index a531284..12a1d93 100644
--- a/src/minizip/ioapi.h
+++ b/src/minizip/ioapi.h
@@ -50,7 +50,7 @@
 #define ftello64 ftell
 #define fseeko64 fseek
 #else
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__HAIKU__)
 #define fopen64 fopen
 #define ftello64 ftello
 #define fseeko64 fseeko
-- 
2.30.0


From 03f70ba5b001a19d6d15a7f1a157dc9aecd5863b Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 2 Mar 2021 23:49:44 +1000
Subject: Disable strnlen for haiku


diff --git a/src/htssafe.h b/src/htssafe.h
index 1349e23..57084c9 100644
--- a/src/htssafe.h
+++ b/src/htssafe.h
@@ -176,7 +176,7 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) {
   "overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__)
 
 /** strnlen replacement (autotools). **/
-#if ( ! defined(_WIN32) && ! defined(HAVE_STRNLEN) )
+#if ( ! defined(_WIN32) && ! defined(__HAIKU__) && ! defined(HAVE_STRNLEN) )
 static HTS_UNUSED size_t strnlen(const char *s, size_t maxlen) {
   size_t i;
   for(i = 0 ; i < maxlen && s[i] != '\0' ; i++) ;
-- 
2.30.0

