diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-18 20:11:25 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-18 20:11:25 +0000 |
commit | be53d7f298bb81297ff0d186f9ddb585a2e57198 (patch) | |
tree | f461c861805dc1694884e772a7c07bfe64f14a3d /compat | |
parent | 0d5ad358ae3bc80cbf226f5aef5790ca1e1f430c (diff) | |
download | rtmux-be53d7f298bb81297ff0d186f9ddb585a2e57198.tar.gz rtmux-be53d7f298bb81297ff0d186f9ddb585a2e57198.tar.bz2 rtmux-be53d7f298bb81297ff0d186f9ddb585a2e57198.zip |
More Sun OS crap.
Diffstat (limited to 'compat')
-rw-r--r-- | compat/daemon.c | 5 | ||||
-rw-r--r-- | compat/forkpty-sunos.c | 30 |
2 files changed, 23 insertions, 12 deletions
diff --git a/compat/daemon.c b/compat/daemon.c index 420f58dc..06384ec8 100644 --- a/compat/daemon.c +++ b/compat/daemon.c @@ -29,10 +29,13 @@ */ #include <fcntl.h> -#include <paths.h> #include <unistd.h> #include <stdlib.h> +#ifndef NO_PATHS_H +#include <paths.h> +#endif + #include "tmux.h" int diff --git a/compat/forkpty-sunos.c b/compat/forkpty-sunos.c index 115807d8..27a44bc2 100644 --- a/compat/forkpty-sunos.c +++ b/compat/forkpty-sunos.c @@ -1,4 +1,4 @@ -/* $Id: forkpty-sunos.c,v 1.1 2008-06-18 19:52:29 nicm Exp $ */ +/* $Id: forkpty-sunos.c,v 1.2 2008-06-18 20:11:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -18,15 +18,20 @@ #include <sys/types.h> +#include <fcntl.h> #include <stdlib.h> +#include <stropts.h> +#include <unistd.h> #include "tmux.h" pid_t -forkpty(int *master, int *slave, - char *name, struct termios *tio, struct winsize *ws) +forkpty(int *master, + unused char *name, unused struct termios *tio, struct winsize *ws) { + int slave; char *path; + pid_t pid; if ((*master = open("/dev/ptmx", O_RDWR)) == -1) return (-1); @@ -37,13 +42,16 @@ forkpty(int *master, int *slave, if ((path = ptsname(*master)) == NULL) goto out; - if ((*slave = open(path, O_RDWR)) == -1) + if ((slave = open(path, O_RDWR)) == -1) goto out; - if (ioctl(*slave, I_PUSH, "ptem") == -1) - goto out; - if (ioctl(*slave, I_PUSH, "ldterm") == -1) - goto out; + if (ioctl(slave, I_PUSH, "ptem") == -1) + fatal("ioctl failed"); + if (ioctl(slave, I_PUSH, "ldterm") == -1) + fatal("ioctl failed"); + + if (ioctl(slave, TIOCSWINSZ, ws) == -1) + fatal("ioctl failed"); switch (pid = fork()) { case -1: @@ -53,13 +61,13 @@ forkpty(int *master, int *slave, return (0); } - close(*slave); + close(slave); return (pid); out: if (*master != -1) close(*master); - if (*slave != -1) - close(*slave); + if (slave != -1) + close(slave); return (-1); } |