$NetBSD: patch-ac,v 1.2 2004/11/25 11:53:13 imilh Exp $ --- check-hdlc.c.orig 2002-06-10 19:49:33.000000000 +0200 +++ check-hdlc.c @@ -9,5 +9,7 @@ */ +#if !defined(_XOPEN_SOURCE) && !defined(__osf__) && !defined(__NetBSD__) #define _XOPEN_SOURCE /* for grantpt in */ +#endif #include @@ -16,4 +18,12 @@ #include #include +#ifdef __NetBSD__ +#include +#include +#include +#include + +#define N_HDLC 13 +#endif /* for ident(1) command */ @@ -22,4 +32,17 @@ static const char id[] = "@(#) $Id: chec int get_master_slave_ptmx(int *master, int *slave) { +#ifdef __NetBSD__ + /* openpty(3) exists in OSF/1 and some other os'es */ + char buf[64]; + int i; + + i = openpty(master, slave, buf, NULL, NULL); + if (i < 0) { + err(1, "openpty: %.100s", strerror(errno)); + return -1; + } + + return 0; +#else const char *pts; @@ -40,4 +63,5 @@ int get_master_slave_ptmx(int *master, i /* gotcha! */ return 0; +#endif }