More Solaris stuff. Use ttyname, use ncurses,h.

This commit is contained in:
Nicholas Marriott 2008-06-18 20:58:03 +00:00
parent 50d5239ace
commit 9b0ff4cfc0
4 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.26 2008-06-18 20:33:47 nicm Exp $
# $Id: GNUmakefile,v 1.27 2008-06-18 20:58:03 nicm Exp $
.PHONY: clean
@ -52,13 +52,13 @@ INSTALLBIN= install -g bin -o root -m 555
INSTALLMAN= install -g bin -o root -m 444
ifeq ($(shell uname),SunOS)
INCDIRS+= -Icompat
INCDIRS+= -Icompat -I/usr/local/include/ncurses
SRCS+= compat/strtonum.c compat/daemon.c compat/forkpty-sunos.c \
compat/asprintf.c
CFLAGS+= -DNO_STRTONUM -DNO_TREE_H -DNO_PATHS_H -DNO_SETPROCTITLE \
-DNO_DAEMON -DNO_FORKPTY -DNO_PROGNAME -DNO_ASPRINTF
# Not += since we don't want ncurses.
LIBS= -lsocket -lnsl -lcurses
LDFLAGS+= -L/usr/local/lib
LIBS+= -lsocket -lnsl
endif
ifeq ($(shell uname),Darwin)

View File

@ -1,4 +1,4 @@
/* $Id: client.c,v 1.30 2008-06-18 19:34:50 nicm Exp $ */
/* $Id: client.c,v 1.31 2008-06-18 20:58:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -45,6 +45,7 @@ client_init(const char *path, struct client_ctx *cctx, int start_server)
u_int retries;
struct buffer *b;
pid_t pid;
char *name;
pid = 0;
retries = 0;
@ -96,8 +97,12 @@ retry:
fatal("ioctl(TIOCGWINSZ)");
data.sx = ws.ws_col;
data.sy = ws.ws_row;
if (ttyname_r(STDIN_FILENO, data.tty, sizeof data.tty) != 0)
fatal("ttyname_r failed");
*data.tty = '\0';
if ((name = ttyname(STDIN_FILENO)) == NULL)
fatal("ttyname failed");
if (strlcpy(data.tty, name, sizeof data.tty) >= sizeof data.tty)
fatalx("ttyname failed");
b = buffer_create(BUFSIZ);
cmd_send_string(b, getenv("TERM"));

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.150 2008-06-18 20:12:19 nicm Exp $ */
/* $Id: tmux.h,v 1.151 2008-06-18 20:58:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -36,7 +36,7 @@
#include "compat/tree.h"
#endif
#include <curses.h>
#include <ncurses.h>
#include <limits.h>
#include <poll.h>
#include <signal.h>

4
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.24 2008-06-18 18:52:44 nicm Exp $ */
/* $Id: tty.c,v 1.25 2008-06-18 20:58:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -19,7 +19,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <curses.h>
#include <ncurses.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>