$NetBSD: patch-aa,v 1.4 2016/06/07 22:54:29 youri Exp $

--- main.c.orig	2005-05-09 01:14:32.000000000 +0000
+++ main.c
@@ -85,11 +85,17 @@ SOFTWARE.
 
 #include <pwd.h>
 #include <ctype.h>
+#include <termios.h>
 
 #include <data.h>
 #include <error.h>
 #include <menu.h>
 
+#include <utmp.h>
+#if !defined(__DragonFly__)
+#include <utmpx.h>
+#endif
+
 #ifdef AMOEBA
 #include <amoeba.h>
 #include <cmdreg.h>
@@ -3284,13 +3290,21 @@ spawn (void)
 #endif
 		ioctl(0, TIOCSPGRP, (char *)&pgrp);
 #ifndef __osf__
+#ifdef __APPLE__
+		setpgid(0,0);
+#else
 		setpgrp(0,0);
+#endif
 #else
 		setpgid(0,0);
 #endif
 		close(open(ttydev, O_WRONLY, 0));
-#ifndef __osf__
+#ifndef __osf__ 
+#ifdef __APPLE__
+		setpgid (0, pgrp);
+#else
 		setpgrp (0, pgrp);
+#endif
 #else
 		setpgid (0, pgrp);
 #endif
