$NetBSD: patch-ac,v 1.2 2006/05/12 09:41:16 joerg Exp $

--- handlers/pty.c.orig	2002-09-30 19:45:00.000000000 +0000
+++ handlers/pty.c
@@ -21,7 +21,12 @@ static char const RCSID[] =
 #include <termios.h>
 #include <fcntl.h>
 #include <stdio.h>
-#ifndef N_HDLC
+#ifdef __NetBSD__
+#include <util.h>
+#elif defined(__DragonFly__) || defined(__FreeBSD__)
+#include <libutil.h>
+#endif
+#if defined(__linux__) && !defined(N_HDLC)
 #include <linux/termios.h>
 #endif
 
@@ -39,6 +44,9 @@ static char const RCSID[] =
 int
 pty_get(int *mfp, int *sfp)
 {
+#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
+	return openpty(mfp, sfp, NULL, NULL, NULL);
+#else
     char pty_name[24];
     struct termios tios;
     int mfd, sfd;
@@ -92,5 +100,6 @@ pty_get(int *mfp, int *sfp)
 	return -1;
     }
     return 0;
+#endif
 }
 
