mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Add support for Haiku, from David Carlier. GitHub issue 2453.
This commit is contained in:
parent
dac285c92a
commit
72c46aa15e
@ -58,6 +58,11 @@ if IS_NETBSD
|
||||
AM_CPPFLAGS += -D_OPENBSD_SOURCE
|
||||
endif
|
||||
|
||||
# Set flags for Haiku.
|
||||
if IS_HAIKU
|
||||
AM_CPPFLAGS += -D_BSD_SOURCE
|
||||
endif
|
||||
|
||||
# List of sources.
|
||||
dist_tmux_SOURCES = \
|
||||
alerts.c \
|
||||
|
4
compat.h
4
compat.h
@ -110,6 +110,10 @@ void warnx(const char *, ...);
|
||||
#define pledge(s, p) (0)
|
||||
#endif
|
||||
|
||||
#ifndef IMAXBEL
|
||||
#define IMAXBEL 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
|
82
compat/forkpty-haiku.c
Normal file
82
compat/forkpty-haiku.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* 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 <sys/ioctl.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
void fatal(const char *, ...);
|
||||
void fatalx(const char *, ...);
|
||||
|
||||
pid_t
|
||||
forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
|
||||
{
|
||||
int slave = -1;
|
||||
char *path;
|
||||
pid_t pid;
|
||||
|
||||
if ((*master = open("/dev/ptmx", O_RDWR|O_NOCTTY)) == -1)
|
||||
return (-1);
|
||||
if (grantpt(*master) != 0)
|
||||
goto out;
|
||||
if (unlockpt(*master) != 0)
|
||||
goto out;
|
||||
|
||||
if ((path = ptsname(*master)) == NULL)
|
||||
goto out;
|
||||
if (name != NULL)
|
||||
strlcpy(name, path, TTY_NAME_MAX);
|
||||
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
|
||||
goto out;
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
goto out;
|
||||
case 0:
|
||||
close(*master);
|
||||
|
||||
setsid();
|
||||
if (ioctl(slave, TIOCSCTTY, NULL) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
if (tio != NULL && tcsetattr(slave, TCSAFLUSH, tio) == -1)
|
||||
fatal("tcsetattr failed");
|
||||
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
dup2(slave, 0);
|
||||
dup2(slave, 1);
|
||||
dup2(slave, 2);
|
||||
if (slave > 2)
|
||||
close(slave);
|
||||
return (0);
|
||||
}
|
||||
|
||||
close(slave);
|
||||
return (pid);
|
||||
|
||||
out:
|
||||
if (*master != -1)
|
||||
close(*master);
|
||||
if (slave != -1)
|
||||
close(slave);
|
||||
return (-1);
|
||||
}
|
30
configure.ac
30
configure.ac
@ -296,12 +296,25 @@ AC_TRY_LINK(
|
||||
found_b64_ntop=yes,
|
||||
found_b64_ntop=no
|
||||
)
|
||||
OLD_LIBS="$LIBS"
|
||||
if test "x$found_b64_ntop" = xno; then
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING(for b64_ntop with -lresolv)
|
||||
OLD_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lresolv"
|
||||
LIBS="$OLD_LIBS -lresolv"
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <resolv.h>
|
||||
],
|
||||
[b64_ntop(NULL, 0, NULL, 0);],
|
||||
found_b64_ntop=yes,
|
||||
found_b64_ntop=no
|
||||
)
|
||||
fi
|
||||
if test "x$found_b64_ntop" = xno; then
|
||||
AC_MSG_CHECKING(for b64_ntop with -lnetwork)
|
||||
LIBS="$OLD_LIBS -lnetwork"
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <sys/types.h>
|
||||
@ -312,16 +325,14 @@ if test "x$found_b64_ntop" = xno; then
|
||||
found_b64_ntop=yes,
|
||||
found_b64_ntop=no
|
||||
)
|
||||
if test "x$found_b64_ntop" = xno; then
|
||||
LIBS="$OLD_LIBS"
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
if test "x$found_b64_ntop" = xyes; then
|
||||
AC_DEFINE(HAVE_B64_NTOP)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
LIBS="$OLD_LIBS"
|
||||
AC_LIBOBJ(base64)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
# Look for networking libraries.
|
||||
@ -656,6 +667,10 @@ case "$host_os" in
|
||||
AC_MSG_RESULT(cygwin)
|
||||
PLATFORM=cygwin
|
||||
;;
|
||||
*haiku*)
|
||||
AC_MSG_RESULT(haiku)
|
||||
PLATFORM=haiku
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(unknown)
|
||||
PLATFORM=unknown
|
||||
@ -671,6 +686,7 @@ AM_CONDITIONAL(IS_NETBSD, test "x$PLATFORM" = xnetbsd)
|
||||
AM_CONDITIONAL(IS_OPENBSD, test "x$PLATFORM" = xopenbsd)
|
||||
AM_CONDITIONAL(IS_SUNOS, test "x$PLATFORM" = xsunos)
|
||||
AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
|
||||
AM_CONDITIONAL(IS_HAIKU, test "x$PLATFORM" = xhaiku)
|
||||
AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
|
||||
|
||||
# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
|
||||
|
53
osdep-haiku.c
Normal file
53
osdep-haiku.c
Normal file
@ -0,0 +1,53 @@
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* 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 <event.h>
|
||||
#include <unistd.h>
|
||||
#include <kernel/OS.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
char *
|
||||
osdep_get_name(int fd, __unused char *tty)
|
||||
{
|
||||
pid_t tid;
|
||||
team_info tinfo;
|
||||
|
||||
if ((tid = tcgetpgrp(fd)) == -1)
|
||||
return (NULL);
|
||||
|
||||
if (get_team_info(tid, &tinfo) != B_OK)
|
||||
return (NULL);
|
||||
|
||||
/* Up to the first 64 characters. */
|
||||
return (xstrdup(tinfo.args));
|
||||
}
|
||||
|
||||
char *
|
||||
osdep_get_cwd(int fd)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
struct event_base *
|
||||
osdep_event_init(void)
|
||||
{
|
||||
return (event_init());
|
||||
}
|
Loading…
Reference in New Issue
Block a user