mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
forkpty for Sun OS.
This commit is contained in:
parent
fed1a3ba8a
commit
0d5ad358ae
@ -1,4 +1,4 @@
|
|||||||
# $Id: GNUmakefile,v 1.22 2008-06-18 19:36:27 nicm Exp $
|
# $Id: GNUmakefile,v 1.23 2008-06-18 19:52:29 nicm Exp $
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
@ -53,9 +53,9 @@ INSTALLMAN= install -g bin -o root -m 444
|
|||||||
|
|
||||||
ifeq ($(shell uname),SunOS)
|
ifeq ($(shell uname),SunOS)
|
||||||
INCDIRS+= -Icompat
|
INCDIRS+= -Icompat
|
||||||
SRCS+= compat/strtonum.c compat/daemon.c
|
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c
|
||||||
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
|
||||||
-DNO_DAEMON
|
-DNO_DAEMON -DNO_FORKPTY
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(shell uname),Darwin)
|
ifeq ($(shell uname),Darwin)
|
||||||
|
65
compat/forkpty-sunos.c
Normal file
65
compat/forkpty-sunos.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/* $Id: forkpty-sunos.c,v 1.1 2008-06-18 19:52:29 nicm Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "tmux.h"
|
||||||
|
|
||||||
|
pid_t
|
||||||
|
forkpty(int *master, int *slave,
|
||||||
|
char *name, struct termios *tio, struct winsize *ws)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
if ((*master = open("/dev/ptmx", O_RDWR)) == -1)
|
||||||
|
return (-1);
|
||||||
|
if (grantpt(*master) != 0)
|
||||||
|
goto out;
|
||||||
|
if (unlockpt(*master) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if ((path = ptsname(*master)) == NULL)
|
||||||
|
goto out;
|
||||||
|
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;
|
||||||
|
|
||||||
|
switch (pid = fork()) {
|
||||||
|
case -1:
|
||||||
|
goto out;
|
||||||
|
case 0:
|
||||||
|
close(*master);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(*slave);
|
||||||
|
return (pid);
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (*master != -1)
|
||||||
|
close(*master);
|
||||||
|
if (*slave != -1)
|
||||||
|
close(*slave);
|
||||||
|
return (-1);
|
||||||
|
}
|
8
tmux.h
8
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.147 2008-06-18 19:36:27 nicm Exp $ */
|
/* $Id: tmux.h,v 1.148 2008-06-18 19:52:29 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -765,6 +765,12 @@ size_t strlcat(char *, const char *, size_t);
|
|||||||
size_t daemon(int, int);
|
size_t daemon(int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_FORKPTY
|
||||||
|
/* forkpty.c */
|
||||||
|
pid_t forkpty(
|
||||||
|
int *, int *, char *, struct termios *, struct winsize *);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* tmux.c */
|
/* tmux.c */
|
||||||
extern volatile sig_atomic_t sigwinch;
|
extern volatile sig_atomic_t sigwinch;
|
||||||
extern volatile sig_atomic_t sigterm;
|
extern volatile sig_atomic_t sigterm;
|
||||||
|
Loading…
Reference in New Issue
Block a user