From 1c70a8515a87e3d22bf03e9b2a71c04b76fb47fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Mon, 17 Jul 2017 15:52:00 +0200
Subject: [PATCH 1/6] add dirent.h test back to configure

Haiku doesn't have sys/dir.h which is deprecated anyway,
so it's better to actually use dirent.h if found.
---
 src/configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/configure.ac b/src/configure.ac
index cad8633..3162f5d 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -84,6 +84,9 @@ AC_SEARCH_LIBS([openpty], [util openpty], [
 dnl
 AC_CHECK_HEADERS(langinfo.h)
 
+dnl
+AC_CHECK_HEADERS(dirent.h)
+
 dnl
 dnl Check user changeable stuff
 dnl
-- 
2.24.1


From b103f36b7832cca68b48161559000cab78f5a1fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Mon, 17 Jul 2017 15:52:54 +0200
Subject: [PATCH 2/6] remove hardcoded -lutil

AC_SEARCH_LIBS prepends the found library already.
---
 src/configure.ac | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/configure.ac b/src/configure.ac
index 3162f5d..afc0c00 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -76,7 +76,6 @@ dnl
 AC_CHECK_HEADERS(pty.h util.h libutil.h)
 AC_SEARCH_LIBS([openpty], [util openpty], [
 	AC_DEFINE(HAVE_OPENPTY)
-	LIBS="$LIBS -lutil"
 ], [
 	AC_MSG_ERROR([unable to find openpty() function])
 ])
-- 
2.24.1


From 2d2f2601287d2e25f3abed3fdeb207ba88fe647e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Mon, 17 Jul 2017 15:53:45 +0200
Subject: [PATCH 3/6] fix mismatched types in prototype

not everyone defines pid_t as int...
---
 src/display.h | 2 +-
 src/screen.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/display.h b/src/display.h
index 1e257d6..0caaca1 100644
--- a/src/display.h
+++ b/src/display.h
@@ -317,7 +317,7 @@ do				\
   }				\
 while (0)
 
-Display *MakeDisplay (char *, char *, char *, int, int, struct mode *);
+Display *MakeDisplay (char *, char *, char *, int, pid_t, struct mode *);
 void  FreeDisplay (void);
 void  DefProcess (char **, size_t *);
 void  DefRedisplayLine (int, int, int, int);
diff --git a/src/screen.h b/src/screen.h
index 63ac662..5f6f373 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -221,7 +221,7 @@ void  SigHup (int);
 void  eexit (int) __attribute__((__noreturn__));
 void  Detach (int);
 void  Hangup (void);
-void  Kill (int, int);
+void  Kill (pid_t, int);
 void  Msg (int, const char *, ...) __attribute__((format(printf, 2, 3)));
 void  Panic (int, const char *, ...) __attribute__((format(printf, 2, 3))) __attribute__((__noreturn__));
 void  QueryMsg (int, const char *, ...) __attribute__((format(printf, 2, 3)));
-- 
2.24.1


From a29dad2c3ef21c1f359007f1c0a15d339a3c868f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Fri, 20 Jun 2014 17:16:37 +0200
Subject: [PATCH 4/6] Haiku port: Check for some libraries

* libnetwork for sockets,
* libbsd for getpass and openpty.
---
 src/configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/configure.ac b/src/configure.ac
index afc0c00..b71c400 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -74,7 +74,7 @@ AC_SEARCH_LIBS([crypt], [crypt], [], [
 
 dnl
 AC_CHECK_HEADERS(pty.h util.h libutil.h)
-AC_SEARCH_LIBS([openpty], [util openpty], [
+AC_SEARCH_LIBS([openpty], [util openpty bsd], [
 	AC_DEFINE(HAVE_OPENPTY)
 ], [
 	AC_MSG_ERROR([unable to find openpty() function])
@@ -195,6 +195,10 @@ AC_DEFINE_UNQUOTED(PTY_MODE, $with_pty_mode)
 dnl -- with_pty_group
 AC_DEFINE_UNQUOTED(PTY_GROUP, $with_pty_group)
 
+AC_SEARCH_LIBS(socket, network)
+
+AC_CHECK_LIB(bsd, getpass)
+
 dnl -- with_pty_rofs
 AS_IF([test "x$with_pty_rofs" == "xyes"], [
 	AC_DEFINE(PTY_ROFS)
-- 
2.24.1


From b991405aad21cd100d66f14d741c7c8b998f5764 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Thu, 24 Sep 2015 01:30:00 +0200
Subject: [PATCH 5/6] Haiku port: temporary workaround undefined TIOCCONS

We should either implement it or do something else, really.
---
 src/tty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/tty.c b/src/tty.c
index de5b8cd..b255aca 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -867,8 +867,10 @@ int TtyGrabConsole(int fd, bool on, char *rc_name)
 	InitTTY(&new1, 0);
 	SetMode(&new1, &new2, 0, 0);
 	SetTTY(consredirfd[1], &new2);
+#ifdef TIOCCONS
 	if (UserContext() == 1)
 		UserReturn(ioctl(consredirfd[1], TIOCCONS, (char *)&on));
+#endif
 	if (UserStatus()) {
 		Msg(errno, "%s: ioctl TIOCCONS failed", rc_name);
 		close(consredirfd[0]);
-- 
2.24.1


From cea265c1e630c0f55f6ee86fbebe52e9407d6ba8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Thu, 24 Sep 2015 01:30:42 +0200
Subject: [PATCH 6/6] define _NSIG as NSIG if not defined

Neither seem to be part of POSIX, btw.
---
 src/attacher.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/attacher.c b/src/attacher.c
index d8de9d4..fe8ec40 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -45,6 +45,10 @@
 #include <security/pam_appl.h>
 #endif
 
+#ifndef _NSIG
+#define _NSIG NSIG
+#endif
+
 #include "misc.h"
 #include "socket.h"
 #include "tty.h"
-- 
2.24.1

