aboutsummaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'pty.c')
-rw-r--r--pty.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/pty.c b/pty.c
index 39794afc..44f609de 100644
--- a/pty.c
+++ b/pty.c
@@ -19,17 +19,21 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#ifdef __OpenBSD__
#include <sys/tty.h>
+#endif
#include <fcntl.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <util.h>
+
+#include "compat.h"
int pty_open(int *);
pid_t pty_fork(int, int *, char *, size_t, struct winsize *);
+#ifdef __OpenBSD__
int
pty_open(int *fd)
{
@@ -38,7 +42,16 @@ pty_open(int *fd)
return (-1);
return (0);
}
+#else
+int
+pty_open(__unused int *fd)
+{
+ *fd = -1;
+ return (0);
+}
+#endif
+#ifdef __OpenBSD__
pid_t
pty_fork(int ptmfd, int *fd, char *name, size_t namelen, struct winsize *ws)
{
@@ -65,3 +78,11 @@ pty_fork(int ptmfd, int *fd, char *name, size_t namelen, struct winsize *ws)
close(ptm.sfd);
return (pid);
}
+#else
+pid_t
+pty_fork(__unused int ptmfd, int *fd, char *name, __unused size_t namelen,
+ struct winsize *ws)
+{
+ return (forkpty(fd, name, NULL, ws));
+}
+#endif