From 9b0ff4cfc02d5fb5be03d66aba9720971bbf55e2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 18 Jun 2008 20:58:03 +0000 Subject: More Solaris stuff. Use ttyname, use ncurses,h. --- GNUmakefile | 8 ++++---- client.c | 11 ++++++++--- tmux.h | 4 ++-- tty.c | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 8a6ae717..5316126b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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) diff --git a/client.c b/client.c index 5e3e6496..de9b0d07 100644 --- a/client.c +++ b/client.c @@ -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 @@ -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")); diff --git a/tmux.h b/tmux.h index f62196fe..5038d84b 100644 --- a/tmux.h +++ b/tmux.h @@ -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 @@ -36,7 +36,7 @@ #include "compat/tree.h" #endif -#include +#include #include #include #include diff --git a/tty.c b/tty.c index 89df5f33..6f433990 100644 --- a/tty.c +++ b/tty.c @@ -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 @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include -- cgit