diff options
66 files changed, 484 insertions, 482 deletions
@@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.89 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: client.c,v 1.90 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -129,7 +129,7 @@ client_send_identify(int flags) if (getcwd(data.cwd, sizeof data.cwd) == NULL) *data.cwd = '\0'; - + term = getenv("TERM"); if (term == NULL || strlcpy(data.term, term, sizeof data.term) >= sizeof data.term) @@ -147,7 +147,7 @@ client_send_environ(void) struct msg_environ_data data; char **var; - for (var = environ; *var != NULL; var++) { + for (var = environ; *var != NULL; var++) { if (strlcpy(data.var, *var, sizeof data.var) >= sizeof data.var) continue; client_write_server(MSG_ENVIRON, &data, sizeof data); @@ -157,7 +157,7 @@ client_send_environ(void) void client_write_server(enum msgtype type, void *buf, size_t len) { - imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len); + imsg_compose(&client_ibuf, type, PROTOCOL_VERSION, -1, -1, buf, len); } void @@ -183,7 +183,7 @@ client_main(void) /* Note: event_init() has already been called. */ - /* Set up signals. */ + /* Set up signals. */ memset(&sigact, 0, sizeof sigact); sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; @@ -267,9 +267,9 @@ client_callback(unused int fd, short events, unused void *data) if (client_dispatch() != 0) { event_loopexit(NULL); return; - } + } } - + if (events & EV_WRITE) { if (msgbuf_write(&client_ibuf.w) < 0) goto lost_server; @@ -345,7 +345,7 @@ client_dispatch(void) if (datalen != sizeof lockdata) fatalx("bad MSG_LOCK size"); memcpy(&lockdata, imsg.data, sizeof lockdata); - + lockdata.cmd[(sizeof lockdata.cmd) - 1] = '\0'; system(lockdata.cmd); client_write_server(MSG_UNLOCK, NULL, 0); @@ -1,4 +1,4 @@ -/* $Id: clock.c,v 1.8 2009-11-28 14:57:59 tcunha Exp $ */ +/* $Id: clock.c,v 1.9 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -134,13 +134,13 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style) for (ptr = tim; *ptr != '\0'; ptr++) { if (*ptr >= '0' && *ptr <= '9') idx = *ptr - '0'; - else if (*ptr == ':') + else if (*ptr == ':') idx = 10; - else if (*ptr == 'A') + else if (*ptr == 'A') idx = 11; - else if (*ptr == 'P') + else if (*ptr == 'P') idx = 12; - else if (*ptr == 'M') + else if (*ptr == 'M') idx = 13; else { x += 6; diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 13d0ff54..e55f7c46 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-attach-session.c,v 1.34 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-attach-session.c,v 1.35 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -29,7 +29,7 @@ int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_attach_session_entry = { "attach-session", "attach", "[-d] " CMD_TARGET_SESSION_USAGE, - CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d", + CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, "d", cmd_target_init, cmd_target_parse, cmd_attach_session_exec, @@ -59,7 +59,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) if (ctx->cmdclient == NULL) { if (cmd_check_flag(data->chflags, 'd')) { - /* + /* * Can't use server_write_session in case attaching to * the same session as currently attached to. */ @@ -72,7 +72,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) server_write_client(c, MSG_DETACH, NULL, 0); } } - + ctx->curclient->session = s; server_redraw_client(ctx->curclient); } else { diff --git a/cmd-bind-key.c b/cmd-bind-key.c index e20a75b1..6f292629 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -1,4 +1,4 @@ -/* $Id: cmd-bind-key.c,v 1.26 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-bind-key.c,v 1.27 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -152,7 +152,7 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx) ctx->error(ctx, "unknown command: %s", data->modecmd); return (-1); } - + mtmp.key = data->key & ~KEYC_PREFIX; mtmp.mode = data->command_key ? 1 : 0; if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) { diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 6c01ca4b..dd9bdaf9 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-break-pane.c,v 1.10 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-break-pane.c,v 1.11 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -64,18 +64,18 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx) if (wl->window->active == NULL) wl->window->active = TAILQ_NEXT(wp, entry); } - layout_close_pane(wp); + layout_close_pane(wp); - w = wp->window = window_create1(s->sx, s->sy); - TAILQ_INSERT_HEAD(&w->panes, wp, entry); - w->active = wp; - w->name = default_window_name(w); + w = wp->window = window_create1(s->sx, s->sy); + TAILQ_INSERT_HEAD(&w->panes, wp, entry); + w->active = wp; + w->name = default_window_name(w); layout_init(w); base_idx = options_get_number(&s->options, "base-index"); - wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */ - if (!cmd_check_flag(data->chflags, 'd')) - session_select(s, wl->idx); + wl = session_attach(s, w, -1 - base_idx, &cause); /* can't fail */ + if (!cmd_check_flag(data->chflags, 'd')) + session_select(s, wl->idx); server_redraw_session(s); server_status_session_group(s); diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 9830c444..ef33947e 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-capture-pane.c,v 1.1 2009-12-02 15:10:44 tcunha Exp $ */ +/* $Id: cmd-capture-pane.c,v 1.2 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -48,7 +48,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx) struct screen *s; struct session *sess; u_int i, limit; - size_t len, linelen; + size_t len, linelen; if (cmd_find_pane(ctx, data->target, &sess, &wp) == NULL) return (-1); diff --git a/cmd-choose-window.c b/cmd-choose-window.c index 6cff98c4..ce45dc7a 100644 --- a/cmd-choose-window.c +++ b/cmd-choose-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-choose-window.c,v 1.19 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-choose-window.c,v 1.20 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -116,10 +116,10 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) cdata->client = ctx->curclient; cdata->client->references++; - window_choose_ready(wl->window->active, + window_choose_ready(wl->window->active, cur, cmd_choose_window_callback, cmd_choose_window_free, cdata); - return (0); + return (0); } void @@ -133,7 +133,7 @@ cmd_choose_window_callback(void *data, int idx) if (idx == -1) return; if (cdata->client->flags & CLIENT_DEAD) - return; + return; if (cdata->session->flags & SESSION_DEAD) return; if (cdata->client->session != cdata->session) diff --git a/cmd-generic.c b/cmd-generic.c index 275bbf57..d3845d43 100644 --- a/cmd-generic.c +++ b/cmd-generic.c @@ -1,4 +1,4 @@ -/* $Id: cmd-generic.c,v 1.37 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: cmd-generic.c,v 1.38 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -141,7 +141,7 @@ cmd_fill_argument(int flags, char **arg, char **arg2, int argc, char **argv) if (argc == 2) *arg2 = xstrdup(argv[1]); return (0); - } + } if (argc != 0) return (-1); @@ -225,9 +225,9 @@ cmd_target_print(struct cmd *self, char *buf, size_t len) off += cmd_print_flags(buf, len, off, data->chflags); if (off < len && data->target != NULL) off += cmd_prarg(buf + off, len - off, " -t ", data->target); - if (off < len && data->arg != NULL) + if (off < len && data->arg != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg); - if (off < len && data->arg2 != NULL) + if (off < len && data->arg2 != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg2); return (off); } @@ -317,9 +317,9 @@ cmd_srcdst_print(struct cmd *self, char *buf, size_t len) off += xsnprintf(buf + off, len - off, " -s %s", data->src); if (off < len && data->dst != NULL) off += xsnprintf(buf + off, len - off, " -t %s", data->dst); - if (off < len && data->arg != NULL) + if (off < len && data->arg != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg); - if (off < len && data->arg2 != NULL) + if (off < len && data->arg2 != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg2); return (off); } @@ -415,9 +415,9 @@ cmd_buffer_print(struct cmd *self, char *buf, size_t len) off += xsnprintf(buf + off, len - off, " -b %d", data->buffer); if (off < len && data->target != NULL) off += cmd_prarg(buf + off, len - off, " -t ", data->target); - if (off < len && data->arg != NULL) + if (off < len && data->arg != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg); - if (off < len && data->arg2 != NULL) + if (off < len && data->arg2 != NULL) off += cmd_prarg(buf + off, len - off, " ", data->arg2); return (off); } diff --git a/cmd-kill-session.c b/cmd-kill-session.c index 28b729f5..eb2bde0b 100644 --- a/cmd-kill-session.c +++ b/cmd-kill-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-kill-session.c,v 1.16 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-kill-session.c,v 1.17 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -45,7 +45,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_target_data *data = self->data; struct session *s; - struct client *c; + struct client *c; u_int i; if ((s = cmd_find_session(ctx, data->target)) == NULL) diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index 287736ab..deb1a175 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-buffers.c,v 1.14 2009-11-28 14:54:12 tcunha Exp $ */ +/* $Id: cmd-list-buffers.c,v 1.15 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -70,7 +70,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx) tmp[50 - 3] = '\0'; strlcat(tmp, "...", sizeof tmp); } - + ctx->print(ctx, "%u: %zu bytes: \"%s\"", idx - 1, size, tmp); } diff --git a/cmd-list-keys.c b/cmd-list-keys.c index b0e34272..80845211 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-keys.c,v 1.23 2009-11-19 22:15:58 tcunha Exp $ */ +/* $Id: cmd-list-keys.c,v 1.24 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -75,7 +75,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) if (used >= sizeof tmp) continue; - if (!(bd->key & KEYC_PREFIX)) { + if (!(bd->key & KEYC_PREFIX)) { used = strlcat(tmp, "(no prefix) ", sizeof tmp); if (used >= sizeof tmp) continue; diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 4292786a..a075cf38 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-panes.c,v 1.3 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-list-panes.c,v 1.4 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -23,7 +23,7 @@ #include "tmux.h" /* - * List panes on given window.. + * List panes on given window. */ int cmd_list_panes_exec(struct cmd *, struct cmd_ctx *); @@ -56,7 +56,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx) n = 0; TAILQ_FOREACH(wp, &wl->window->panes, entry) { gd = wp->base.grid; - + size = 0; for (i = 0; i < gd->hsize; i++) { gl = &gd->linedata[i]; @@ -64,7 +64,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx) size += gl->utf8size * sizeof *gl->utf8data; } size += gd->hsize * sizeof *gd->linedata; - + ctx->print(ctx, "%u: [%ux%u] [history %u/%u, %llu bytes]", n, wp->sx, wp->sy, gd->hsize, gd->hlimit, size); n++; diff --git a/cmd-new-session.c b/cmd-new-session.c index 6484dc5e..5d12b267 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-session.c,v 1.72 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: cmd-new-session.c,v 1.73 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -184,8 +184,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->error(ctx, "not a terminal"); return (-1); } - - overrides = + + overrides = options_get_string(&global_s_options, "terminal-overrides"); if (tty_open(&ctx->cmdclient->tty, overrides, &cause) != 0) { ctx->error(ctx, "open terminal failed: %s", cause); @@ -267,13 +267,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) * Set the client to the new session. If a command client exists, it is * taking this session and needs to get MSG_READY and stay around. */ - if (!detached) { + if (!detached) { if (ctx->cmdclient != NULL) { server_write_client(ctx->cmdclient, MSG_READY, NULL, 0); - ctx->cmdclient->session = s; + ctx->cmdclient->session = s; server_redraw_client(ctx->cmdclient); } else { - ctx->curclient->session = s; + ctx->curclient->session = s; server_redraw_client(ctx->curclient); } } diff --git a/cmd-new-window.c b/cmd-new-window.c index 0b537021..a052c273 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-new-window.c,v 1.41 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: cmd-new-window.c,v 1.42 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -166,7 +166,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx) if (!data->flag_detached) { session_select(s, wl->idx); server_redraw_session_group(s); - } else + } else server_status_session_group(s); return (0); diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 7860e3a7..e16d3407 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $Id: cmd-paste-buffer.c,v 1.23 2009-11-28 14:54:12 tcunha Exp $ */ +/* $Id: cmd-paste-buffer.c,v 1.24 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -78,7 +78,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) paste_free_index(&s->buffers, data->buffer); } - return (0); + return (0); } /* Add bytes to a buffer but change every '\n' to '\r'. */ diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index 19f3f018..19611893 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-pipe-pane.c,v 1.9 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: cmd-pipe-pane.c,v 1.10 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -86,7 +86,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx) switch (fork()) { case -1: ctx->error(ctx, "fork error: %s", strerror(errno)); - return (-1); + return (-1); case 0: /* Child process. */ close(pipe_fd[0]); @@ -113,17 +113,17 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_ctx *ctx) wp->pipe_fd = pipe_fd[0]; wp->pipe_off = EVBUFFER_LENGTH(wp->event->input); - + wp->pipe_event = bufferevent_new(wp->pipe_fd, NULL, NULL, cmd_pipe_pane_error_callback, wp); bufferevent_enable(wp->pipe_event, EV_WRITE); - + if ((mode = fcntl(wp->pipe_fd, F_GETFL)) == -1) fatal("fcntl failed"); if (fcntl(wp->pipe_fd, F_SETFL, mode|O_NONBLOCK) == -1) fatal("fcntl failed"); if (fcntl(wp->pipe_fd, F_SETFD, FD_CLOEXEC) == -1) - fatal("fcntl failed"); + fatal("fcntl failed"); return (0); } } diff --git a/cmd-previous-layout.c b/cmd-previous-layout.c index 26435035..1d04c600 100644 --- a/cmd-previous-layout.c +++ b/cmd-previous-layout.c @@ -1,4 +1,4 @@ -/* $Id: cmd-previous-layout.c,v 1.5 2009-11-14 17:56:39 tcunha Exp $ */ +/* $Id: cmd-previous-layout.c,v 1.6 2009-12-04 22:14:47 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -43,7 +43,7 @@ cmd_previous_layout_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct winlink *wl; u_int layout; - + |