diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-11 19:32:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-11 19:32:26 +0000 |
commit | cb8e2701ce90572189ab471e9877e2aba067cc41 (patch) | |
tree | a96fe2d709dcf816ae94bd3ee4a4911c0e29382b | |
parent | 45443497d1b1837b0f507d85565636f50fa5cecf (diff) |
Drop the no_stop argument to tty_close and tty_free in favour of a flag in the
tty struct.
-rw-r--r-- | usr.bin/tmux/server-msg.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 17 |
4 files changed, 19 insertions, 13 deletions
diff --git a/usr.bin/tmux/server-msg.c b/usr.bin/tmux/server-msg.c index d756dcc587c..5c6a451d01c 100644 --- a/usr.bin/tmux/server-msg.c +++ b/usr.bin/tmux/server-msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-msg.c,v 1.11 2009/08/11 17:18:35 nicm Exp $ */ +/* $OpenBSD: server-msg.c,v 1.12 2009/08/11 19:32:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -90,7 +90,7 @@ server_msg_dispatch(struct client *c) fatalx("bad MSG_EXITING size"); c->session = NULL; - tty_close(&c->tty, c->flags & CLIENT_SUSPENDED); + tty_close(&c->tty); server_write_client(c, MSG_EXITED, NULL, 0); break; case MSG_UNLOCK: diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 86a68d93f5e..c9e79389f6b 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.18 2009/08/11 17:18:35 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.19 2009/08/11 19:32:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -902,7 +902,7 @@ server_lost_client(struct client *c) ARRAY_SET(&clients, i, NULL); } - tty_free(&c->tty, c->flags & CLIENT_SUSPENDED); + tty_free(&c->tty); screen_free(&c->status); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 44ce559e268..c196b802142 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.75 2009/08/11 17:18:35 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.76 2009/08/11 19:32:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -868,6 +868,7 @@ struct tty { #define TTY_FREEZE 0x2 #define TTY_ESCAPE 0x4 #define TTY_UTF8 0x8 +#define TTY_STARTED 0x10 int flags; int term_flags; @@ -1164,8 +1165,8 @@ void tty_set_title(struct tty *, const char *); void tty_update_mode(struct tty *, int); void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int); int tty_open(struct tty *, const char *, char **); -void tty_close(struct tty *, int); -void tty_free(struct tty *, int); +void tty_close(struct tty *); +void tty_free(struct tty *); void tty_write(void (*)(struct tty *, struct tty_ctx *), struct tty_ctx *); void tty_cmd_alignmenttest(struct tty *, struct tty_ctx *); void tty_cmd_cell(struct tty *, struct tty_ctx *); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index fa826e57bd6..514d6140512 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.19 2009/08/08 13:29:27 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.20 2009/08/11 19:32:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -149,6 +149,8 @@ tty_start_tty(struct tty *tty) tty->rupper = UINT_MAX; tty->mode = MODE_CURSOR; + + tty->flags |= TTY_STARTED; } void @@ -156,6 +158,10 @@ tty_stop_tty(struct tty *tty) { struct winsize ws; + if (!(tty->flags & TTY_STARTED)) + return; + tty->flags &= ~TTY_STARTED; + /* * Be flexible about error handling and try not kill the server just * because the fd is invalid. Things like ssh -t can easily leave us @@ -281,7 +287,7 @@ tty_get_acs(struct tty *tty, u_char ch) } void -tty_close(struct tty *tty, int no_stop) +tty_close(struct tty *tty) { if (tty->fd == -1) return; @@ -291,8 +297,7 @@ tty_close(struct tty *tty, int no_stop) tty->log_fd = -1; } - if (!no_stop) - tty_stop_tty(tty); + tty_stop_tty(tty); tty_term_free(tty->term); tty_keys_free(tty); @@ -305,9 +310,9 @@ tty_close(struct tty *tty, int no_stop) } void -tty_free(struct tty *tty, int no_stop) +tty_free(struct tty *tty) { - tty_close(tty, no_stop); + tty_close(tty); if (tty->path != NULL) xfree(tty->path); |