From a68cec6b9b23f1632f14e74e86778ff248ecc8cd Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 26 Nov 2014 16:48:13 +0000
Subject: Haiku patch


diff --git a/configure.ac b/configure.ac
index 013fb62..5180019 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,7 @@ AM_CONDITIONAL(ENABLE_EXAMPLES, [test "$enable_examples" = "yes"])
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h curses.h ncurses.h sys/cdefs.h termcap.h])
+AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdint.h stdlib.h string.h sys/errno.h errno.h sys/ioctl.h sys/param.h unistd.h curses.h ncurses.h sys/cdefs.h langinfo.h])
 
 AC_CHECK_HEADER([ncurses.h], [],
   [AC_CHECK_HEADER([curses.h], [],
diff --git a/src/editline/readline.h b/src/editline/readline.h
index 7e53f41..64a5fb3 100644
--- a/src/editline/readline.h
+++ b/src/editline/readline.h
@@ -76,7 +76,7 @@ typedef KEYMAP_ENTRY *Keymap;
 
 #ifndef CTRL
 #include <sys/ioctl.h>
-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__HAIKU__)
 #include <sys/ttydefaults.h>
 #endif
 #ifndef CTRL
diff --git a/src/vis.c b/src/vis.c
index ce66205..283cf38 100644
--- a/src/vis.c
+++ b/src/vis.c
@@ -75,6 +75,10 @@ __FBSDID("$FreeBSD$");
 #include <wchar.h>
 #include <wctype.h>
 
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
 #ifdef __weak_alias
 __weak_alias(strvisx,_strvisx)
 #endif
-- 
2.30.2


From 95fc6ef00932e10efe45dbc379249d64cfc31d14 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 26 Nov 2014 16:55:47 +0000
Subject: define NBBY


diff --git a/src/sys.h b/src/sys.h
index d2bcf11..44dca9d 100644
--- a/src/sys.h
+++ b/src/sys.h
@@ -125,4 +125,8 @@ extern char* tgoto(const char*, int, int);
 extern char* tgetstr(char*, char**);
 #endif
 
+#ifdef __HAIKU__
+#define NBBY	8
+#endif
+
 #endif /* _h_sys */
-- 
2.30.2


From 70f3f89ddea86c9b0307ec7f717d6cde4c8fc16d Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Thu, 1 Feb 2018 11:05:59 +0000
Subject: gcc2 support.


diff --git a/src/hist.c b/src/hist.c
index 19ce1c1..2c88b28 100644
--- a/src/hist.c
+++ b/src/hist.c
@@ -188,12 +188,14 @@ hist_command(EditLine *el, int argc, const wchar_t **argv)
 			len = len * 4 + 1;
 			if (len >= maxlen) {
 				maxlen = len + 1024;
+				{
 				char *nbuf = el_realloc(buf, maxlen);
 				if (nbuf == NULL) {
 					el_free(buf);
 					return -1;
 				}
 				buf = nbuf;
+				}
 			}
 			strvis(buf, ptr, VIS_NL);
 			(void) fprintf(el->el_outfile, "%d\t%s\n",
-- 
2.30.2


From eaa32eed8c5a2f5709a3c71d2e6baf346775e46e Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 1 May 2021 09:40:38 +0000
Subject: Another gcc2 patch


diff --git a/src/filecomplete.c b/src/filecomplete.c
index baca190..a49ad41 100644
--- a/src/filecomplete.c
+++ b/src/filecomplete.c
@@ -707,6 +707,7 @@ fn_complete2(EditLine *el,
 	if (matches == NULL) {
 		goto out;
 	}
+	{
 	int i;
 	size_t matches_num, maxlen, match_len, match_display=1;
 	int single_match = matches[2] == NULL &&
@@ -813,6 +814,7 @@ fn_complete2(EditLine *el,
 out:
 	el_free(temp);
 	return retval;
+	}
 }
 
 int
-- 
2.30.2

