diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-18 20:58:03 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-18 20:58:03 +0000 |
commit | 9b0ff4cfc02d5fb5be03d66aba9720971bbf55e2 (patch) | |
tree | 8e41a0ab0396f4dbfe566b07c0c01cbad1af721b /client.c | |
parent | 50d5239ace422b80e9f10948b42ddd773810c8c4 (diff) |
More Solaris stuff. Use ttyname, use ncurses,h.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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")); |