diff options
Diffstat (limited to 'pty.c')
-rw-r--r-- | pty.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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 |