mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-22 23:00:51 +01:00
Trimify.
This commit is contained in:
parent
28aefe4162
commit
99df48d70f
16
arg.c
16
arg.c
@ -1,4 +1,4 @@
|
||||
/* $Id: arg.c,v 1.2 2008-06-05 21:54:47 nicm Exp $ */
|
||||
/* $Id: arg.c,v 1.3 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -51,7 +51,7 @@ arg_lookup_session(const char *name)
|
||||
|
||||
ts = NULL;
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
if (s == NULL || fnmatch(name, s->name, 0) != 0)
|
||||
continue;
|
||||
|
||||
@ -133,7 +133,7 @@ arg_parse_window(const char *arg, struct session **s, int *idx)
|
||||
*s = arg_parse_session(NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* Find the separator if any. */
|
||||
arg2 = xstrdup(arg);
|
||||
ptr = strrchr(arg2, ':');
|
||||
@ -147,7 +147,7 @@ arg_parse_window(const char *arg, struct session **s, int *idx)
|
||||
if (errstr != NULL) {
|
||||
xfree(arg2);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
xfree(arg2);
|
||||
*s = arg_parse_session(NULL);
|
||||
@ -162,25 +162,25 @@ arg_parse_window(const char *arg, struct session **s, int *idx)
|
||||
xfree(arg2);
|
||||
*s = arg_parse_session(NULL);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
*idx = -1;
|
||||
goto lookup;
|
||||
}
|
||||
}
|
||||
|
||||
/* If last, strip it and look up as a session. */
|
||||
if (ptr[1] == '\0') {
|
||||
*ptr = '\0';
|
||||
goto lookup;
|
||||
}
|
||||
|
||||
|
||||
/* Present but not first and not last. Break and convert both. */
|
||||
*ptr = '\0';
|
||||
*idx = strtonum(ptr + 1, 0, INT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
xfree(arg2);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
lookup:
|
||||
/* Look up as session. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: buffer-poll.c,v 1.6 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: buffer-poll.c,v 1.7 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -60,7 +60,7 @@ buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
|
||||
buffer_add(in, n);
|
||||
}
|
||||
if (BUFFER_USED(out) > 0 && pfd->revents & POLLOUT) {
|
||||
n = write(pfd->fd, BUFFER_OUT(out), BUFFER_USED(out));
|
||||
n = write(pfd->fd, BUFFER_OUT(out), BUFFER_USED(out));
|
||||
log_debug("buffer_poll: fd=%d, write=%zd", pfd->fd, n);
|
||||
if (n == -1) {
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-attach-session.c,v 1.18 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-attach-session.c,v 1.19 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -50,7 +50,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
|
||||
if (ctx->flags & CMD_KEY)
|
||||
return;
|
||||
|
||||
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-copy-mode.c,v 1.10 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-copy-mode.c,v 1.11 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -27,7 +27,7 @@
|
||||
void cmd_copy_mode_exec(struct cmd *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_copy_mode_entry = {
|
||||
"copy-mode", NULL,
|
||||
"copy-mode", NULL,
|
||||
CMD_TARGET_WINDOW_USAGE,
|
||||
0,
|
||||
cmd_target_init,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-generic.c,v 1.9 2008-06-05 23:17:03 nicm Exp $ */
|
||||
/* $Id: cmd-generic.c,v 1.10 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -43,7 +43,7 @@ cmd_target_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
/* Don't use the entry version since it may be dependent on key. */
|
||||
cmd_target_init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
|
||||
while ((opt = getopt(argc, argv, "dkt:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
@ -124,7 +124,7 @@ cmd_target_print(struct cmd *self, char *buf, size_t len)
|
||||
{
|
||||
struct cmd_target_data *data = self->data;
|
||||
size_t off = 0;
|
||||
|
||||
|
||||
off += xsnprintf(buf, len, "%s", self->entry->name);
|
||||
if (data == NULL)
|
||||
return;
|
||||
@ -155,7 +155,7 @@ cmd_srcdst_parse(struct cmd *self, int argc, char **argv, char **cause)
|
||||
{
|
||||
struct cmd_srcdst_data *data;
|
||||
int opt;
|
||||
|
||||
|
||||
cmd_srcdst_init(self, 0);
|
||||
data = self->data;
|
||||
|
||||
@ -247,7 +247,7 @@ cmd_srcdst_print(struct cmd *self, char *buf, size_t len)
|
||||
{
|
||||
struct cmd_srcdst_data *data = self->data;
|
||||
size_t off = 0;
|
||||
|
||||
|
||||
off += xsnprintf(buf, len, "%s", self->entry->name);
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-last-window.c,v 1.12 2008-06-06 20:02:27 nicm Exp $ */
|
||||
/* $Id: cmd-last-window.c,v 1.13 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -27,7 +27,7 @@
|
||||
void cmd_last_window_exec(struct cmd *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_last_window_entry = {
|
||||
"last-window", "last",
|
||||
"last-window", "last",
|
||||
CMD_TARGET_SESSION_USAGE,
|
||||
0,
|
||||
cmd_target_init,
|
||||
@ -44,7 +44,7 @@ cmd_last_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_target_data *data = self->data;
|
||||
struct session *s;
|
||||
|
||||
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-link-window.c,v 1.22 2008-06-06 20:02:27 nicm Exp $ */
|
||||
/* $Id: cmd-link-window.c,v 1.23 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -80,7 +80,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
*/
|
||||
session_alert_cancel(s, wl_dst);
|
||||
winlink_remove(&s->windows, wl_dst);
|
||||
|
||||
|
||||
/* Force select/redraw if current. */
|
||||
if (wl_dst == s->curw) {
|
||||
data->flags &= ~CMD_DFLAG;
|
||||
@ -88,7 +88,7 @@ cmd_link_window_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
}
|
||||
if (wl_dst == s->lastw)
|
||||
s->lastw = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Can't error out after this or there could be an
|
||||
* empty session!
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-refresh-client.c,v 1.6 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-refresh-client.c,v 1.7 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -47,7 +47,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
|
||||
if ((c = cmd_find_client(ctx, data->target)) == NULL)
|
||||
return;
|
||||
|
||||
|
||||
server_redraw_client(c);
|
||||
|
||||
if (ctx->cmdclient != NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-rename-session.c,v 1.11 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-rename-session.c,v 1.12 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -32,7 +32,7 @@ void cmd_rename_session_exec(struct cmd *, struct cmd_ctx *);
|
||||
const struct cmd_entry cmd_rename_session_entry = {
|
||||
"rename-session", "rename",
|
||||
CMD_TARGET_SESSION_USAGE " new-name",
|
||||
CMD_ONEARG,
|
||||
CMD_ONEARG,
|
||||
cmd_target_init,
|
||||
cmd_target_parse,
|
||||
cmd_rename_session_exec,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-option.c,v 1.30 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: cmd-set-option.c,v 1.31 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -338,5 +338,5 @@ cmd_set_option_print(struct cmd *self, char *buf, size_t len)
|
||||
if (off < len && data->option != NULL)
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->option);
|
||||
if (off < len && data->value != NULL)
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->value);
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->value);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-window-option.c,v 1.9 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: cmd-set-window-option.c,v 1.10 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -141,7 +141,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
else {
|
||||
if (flag)
|
||||
wl->window->flags |= WINDOW_MONITOR;
|
||||
else
|
||||
else
|
||||
wl->window->flags &= ~WINDOW_MONITOR;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
if (s != NULL)
|
||||
session_alert_cancel(s, wl);
|
||||
}
|
||||
@ -169,7 +169,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
else {
|
||||
if (flag)
|
||||
wl->window->flags |= WINDOW_AGGRESSIVE;
|
||||
else
|
||||
else
|
||||
wl->window->flags &= ~WINDOW_AGGRESSIVE;
|
||||
}
|
||||
|
||||
@ -278,5 +278,5 @@ cmd_set_window_option_print(struct cmd *self, char *buf, size_t len)
|
||||
if (off < len && data->option != NULL)
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->option);
|
||||
if (off < len && data->value != NULL)
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->value);
|
||||
off += xsnprintf(buf + off, len - off, " %s", data->value);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-show-options.c,v 1.2 2008-06-16 06:33:50 nicm Exp $ */
|
||||
/* $Id: cmd-show-options.c,v 1.3 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -119,7 +119,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
ctx->print(ctx, "%s %lld", o->name, o->value.number);
|
||||
break;
|
||||
case OPTIONS_KEY:
|
||||
ctx->print(ctx, "%s %s", o->name,
|
||||
ctx->print(ctx, "%s %s", o->name,
|
||||
key_string_lookup_key(o->value.key));
|
||||
break;
|
||||
case OPTIONS_COLOURS:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-switch-client.c,v 1.9 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-switch-client.c,v 1.10 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -103,7 +103,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
return;
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return;
|
||||
|
||||
|
||||
c->session = s;
|
||||
|
||||
recalculate_sizes();
|
||||
|
8
cmd.c
8
cmd.c
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd.c,v 1.48 2008-06-16 22:03:27 nicm Exp $ */
|
||||
/* $Id: cmd.c,v 1.49 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -262,10 +262,10 @@ cmd_current_session(struct cmd_ctx *ctx)
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
|
||||
ts = NULL;
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
if (s != NULL && (ts == NULL || timespeccmp(&s->ts, ts, >))) {
|
||||
newest = ARRAY_ITEM(&sessions, i);
|
||||
ts = &s->ts;
|
||||
@ -278,7 +278,7 @@ struct client *
|
||||
cmd_find_client(struct cmd_ctx *ctx, const char *arg)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
|
||||
if ((c = arg_parse_client(arg)) == NULL)
|
||||
c = ctx->curclient;
|
||||
if (c == NULL) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: asprintf.c,v 1.1 2008-06-18 20:12:19 nicm Exp $ */
|
||||
/* $Id: asprintf.c,v 1.2 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -47,7 +47,7 @@ vasprintf(char **ret, const char *format, va_list ap)
|
||||
xfree(*ret);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
return (n);
|
||||
|
||||
error:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: forkpty-sunos.c,v 1.4 2008-06-18 22:00:49 nicm Exp $ */
|
||||
/* $Id: forkpty-sunos.c,v 1.5 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -39,12 +39,12 @@ forkpty(int *master,
|
||||
goto out;
|
||||
if (unlockpt(*master) != 0)
|
||||
goto out;
|
||||
|
||||
|
||||
if ((path = ptsname(*master)) == NULL)
|
||||
goto out;
|
||||
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
|
||||
goto out;
|
||||
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
goto out;
|
||||
@ -59,10 +59,10 @@ forkpty(int *master,
|
||||
fatal("ioctl failed");
|
||||
if (ioctl(slave, I_PUSH, "ldterm") == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
|
||||
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
|
||||
fatal("ioctl failed");
|
||||
|
||||
|
||||
dup2(slave, 0);
|
||||
dup2(slave, 1);
|
||||
dup2(slave, 2);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: input-keys.c,v 1.7 2008-06-06 17:20:29 nicm Exp $ */
|
||||
/* $Id: input-keys.c,v 1.8 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -108,7 +108,7 @@ input_key(struct window *w, int key)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
for (i = 0; i < NINPUTKEYS; i++) {
|
||||
if (input_keys[i].key == key)
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: screen-display.c,v 1.16 2008-06-04 19:20:09 nicm Exp $ */
|
||||
/* $Id: screen-display.c,v 1.17 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -439,7 +439,7 @@ screen_display_copy_area(struct screen *dst, struct screen *src,
|
||||
}
|
||||
if (!screen_in_x(dst, px) || !screen_in_y(dst, py)) {
|
||||
SCREEN_DEBUG4(dst, px, py, nx, ny);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (!screen_in_x(dst, px + nx - 1) || !screen_in_y(dst, py + ny - 1)) {
|
||||
SCREEN_DEBUG4(dst, px, py, nx, ny);
|
||||
|
6
screen.c
6
screen.c
@ -1,4 +1,4 @@
|
||||
/* $Id: screen.c,v 1.61 2008-06-14 12:05:06 nicm Exp $ */
|
||||
/* $Id: screen.c,v 1.62 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -45,7 +45,7 @@
|
||||
* ----------- array base + hsize + dy
|
||||
*
|
||||
* The screen_x/screen_y macros are used to convert a cell on the displayed
|
||||
* area to an absolute position in the arrays.
|
||||
* area to an absolute position in the arrays.
|
||||
*
|
||||
* Screen handling code is split into four files:
|
||||
*
|
||||
@ -54,7 +54,7 @@
|
||||
* screen-display.c: Basic functions for manipulating the displayed
|
||||
* part of the screen. x,y coordinates passed to these
|
||||
* are relative to the display. These are largely
|
||||
* utility functions for screen-write.c.
|
||||
* utility functions for screen-write.c.
|
||||
* screen-redraw.c: Functions for redrawing all or part of a screen to
|
||||
* one or more ttys. A context is filled via one of the
|
||||
* screen_redraw_start* variants which sets up (removes
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: server-msg.c,v 1.46 2008-06-16 17:35:40 nicm Exp $ */
|
||||
/* $Id: server-msg.c,v 1.47 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -222,7 +222,7 @@ server_msg_fn_exiting(struct hdr *hdr, struct client *c)
|
||||
log_debug("exiting msg from client");
|
||||
|
||||
c->session = NULL;
|
||||
|
||||
|
||||
tty_close(&c->tty);
|
||||
|
||||
server_write_client(c, MSG_EXITED, NULL, 0);
|
||||
|
22
server.c
22
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.67 2008-06-18 19:34:50 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.68 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -97,7 +97,7 @@ server_start(const char *path)
|
||||
xmalloc_clear();
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* Must daemonise before loading configuration as the PID changes so
|
||||
* $TMUX would be wrong for sessions created in the config file.
|
||||
*/
|
||||
@ -169,7 +169,7 @@ server_main(const char *srv_path, int srv_fd)
|
||||
u_int i, n;
|
||||
|
||||
siginit();
|
||||
|
||||
|
||||
pfds = NULL;
|
||||
while (!sigterm) {
|
||||
/* Initialise pollfd array. */
|
||||
@ -308,10 +308,10 @@ server_check_redraw(struct client *c)
|
||||
if (c == NULL || c->session == NULL)
|
||||
return;
|
||||
s = c->session;
|
||||
|
||||
|
||||
if (options_get_number(&s->options, "set-titles")) {
|
||||
xsnprintf(title, sizeof title,
|
||||
"%s:%u:%s - \"%s\"", s->name, s->curw->idx,
|
||||
xsnprintf(title, sizeof title,
|
||||
"%s:%u:%s - \"%s\"", s->name, s->curw->idx,
|
||||
s->curw->window->name, s->curw->window->base.title);
|
||||
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
||||
if (c->title != NULL)
|
||||
@ -328,7 +328,7 @@ server_check_redraw(struct client *c)
|
||||
sy = screen_size_y(s->curw->window->screen);
|
||||
if (sx < xx || sy < yy) {
|
||||
/*
|
||||
* Fake up a blank(ish) screen and use it to draw the
|
||||
* Fake up a blank(ish) screen and use it to draw the
|
||||
* empty regions. NOTE: because this uses
|
||||
* tty_write_client but doesn't write the client's
|
||||
* screen, this can't use anything which relies on
|
||||
@ -339,7 +339,7 @@ server_check_redraw(struct client *c)
|
||||
if (sx < xx)
|
||||
screen_redraw_columns(&ctx, sx, xx - sx);
|
||||
if (sy < yy) {
|
||||
screen_fill_area(&screen,
|
||||
screen_fill_area(&screen,
|
||||
0, sy, xx, 1, '-', 0, 0x70);
|
||||
screen_redraw_lines(&ctx, sy, yy - sy);
|
||||
}
|
||||
@ -372,11 +372,11 @@ server_check_status(struct client *c)
|
||||
interval = options_get_number(&c->session->options, "status-interval");
|
||||
if (nlines == 0 || interval == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts) != 0)
|
||||
fatal("clock_gettime");
|
||||
ts.tv_sec -= interval;
|
||||
|
||||
|
||||
if (timespeccmp(&c->status_ts, &ts, <))
|
||||
c->flags |= CLIENT_STATUS;
|
||||
}
|
||||
@ -428,7 +428,7 @@ server_handle_clients(struct pollfd **pfd)
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
|
||||
if (c != NULL) {
|
||||
if (c != NULL) {
|
||||
log_debug("testing client %d (%d)", (*pfd)->fd, c->fd);
|
||||
if (buffer_poll(*pfd, c->in, c->out) != 0) {
|
||||
server_lost_client(c);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: session.c,v 1.37 2008-06-07 07:27:28 nicm Exp $ */
|
||||
/* $Id: session.c,v 1.38 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -121,7 +121,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
|
||||
RB_INIT(&s->windows);
|
||||
TAILQ_INIT(&s->alerts);
|
||||
options_init(&s->options, &global_options);
|
||||
|
||||
|
||||
s->sx = sx;
|
||||
s->sy = sy;
|
||||
|
||||
|
18
status.c
18
status.c
@ -1,4 +1,4 @@
|
||||
/* $Id: status.c,v 1.29 2008-06-18 17:28:17 nicm Exp $ */
|
||||
/* $Id: status.c,v 1.30 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -47,7 +47,7 @@ status_redraw(struct client *c)
|
||||
larrow = rarrow = 0;
|
||||
|
||||
if (clock_gettime(CLOCK_REALTIME, &c->status_ts) != 0)
|
||||
fatal("clock_gettime failed");
|
||||
fatal("clock_gettime failed");
|
||||
colr = options_get_colours(&s->options, "status-colour");
|
||||
|
||||
yy = c->sy - yy;
|
||||
@ -74,7 +74,7 @@ status_redraw(struct client *c)
|
||||
goto blank;
|
||||
xx = c->sx - xx;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Right. We have xx characters to fill. Find out how much is to go in
|
||||
* them and the offset of the current window (it must be on screen).
|
||||
*/
|
||||
@ -125,7 +125,7 @@ status_redraw(struct client *c)
|
||||
xx--;
|
||||
}
|
||||
width = xx;
|
||||
|
||||
|
||||
draw:
|
||||
/* Bail here if anything is too small too. XXX. */
|
||||
if (width == 0 || xx == 0)
|
||||
@ -159,7 +159,7 @@ draw:
|
||||
larrow = -1;
|
||||
}
|
||||
|
||||
for (ptr = text; *ptr != '\0'; ptr++) {
|
||||
for (ptr = text; *ptr != '\0'; ptr++) {
|
||||
if (offset >= start && offset < start + width)
|
||||
ctx.write(ctx.data, TTY_CHARACTER, *ptr);
|
||||
offset++;
|
||||
@ -205,7 +205,7 @@ draw:
|
||||
else
|
||||
screen_redraw_move_cursor(&ctx, 0, yy);
|
||||
ctx.write(ctx.data, TTY_CHARACTER, '<');
|
||||
}
|
||||
}
|
||||
if (rarrow != 0) {
|
||||
if (rarrow == -1)
|
||||
screen_redraw_set_attributes(&ctx, ATTR_REVERSE, colr);
|
||||
@ -218,7 +218,7 @@ draw:
|
||||
ctx.write(ctx.data, TTY_CHARACTER, '>');
|
||||
}
|
||||
|
||||
screen_redraw_stop(&ctx);
|
||||
screen_redraw_stop(&ctx);
|
||||
return;
|
||||
|
||||
blank:
|
||||
@ -226,9 +226,9 @@ blank:
|
||||
screen_redraw_start_client(&ctx, c);
|
||||
screen_redraw_set_attributes(&ctx, 0, colr);
|
||||
screen_redraw_move_cursor(&ctx, 0, yy);
|
||||
for (offset = 0; offset < c->sx; offset++)
|
||||
for (offset = 0; offset < c->sx; offset++)
|
||||
ctx.write(ctx.data, TTY_CHARACTER, ' ');
|
||||
screen_redraw_stop(&ctx);
|
||||
screen_redraw_stop(&ctx);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
8
tmux.c
8
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.60 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.61 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -58,12 +58,12 @@ __dead void usage(void);
|
||||
|
||||
#ifdef NO_PROGNAME
|
||||
const char *__progname = "tmux";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__dead void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"usage: %s [-v] [-f file] [-S socket-path] [command [flags]]\n",
|
||||
__progname);
|
||||
exit(1);
|
||||
@ -240,7 +240,7 @@ main(int argc, char **argv)
|
||||
if (access(cfg_file, R_OK) != 0) {
|
||||
log_warn("%s", cfg_file);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path == NULL) {
|
||||
|
8
tty.c
8
tty.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tty.c,v 1.27 2008-06-18 22:18:08 nicm Exp $ */
|
||||
/* $Id: tty.c,v 1.28 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -90,7 +90,7 @@ tty_open(struct tty *tty, char **cause)
|
||||
tio.c_iflag |= IGNBRK;
|
||||
tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET|OLCUC);
|
||||
tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHONL|ECHOCTL|ECHOPRT|ECHOKE|ECHOCTL|ISIG);
|
||||
tio.c_cc[VMIN] = 1;
|
||||
tio.c_cc[VMIN] = 1;
|
||||
tio.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(tty->fd, TCSANOW, &tio) != 0)
|
||||
fatal("tcsetattr failed");
|
||||
@ -136,7 +136,7 @@ tty_close(struct tty *tty)
|
||||
} else {
|
||||
if (tcsetattr(tty->fd, TCSANOW, &tty->tio) != 0)
|
||||
fatal("tcsetattr failed");
|
||||
|
||||
|
||||
tty_raw(tty, tparm(change_scroll_region, 0, ws.ws_row - 1));
|
||||
if (keypad_local != NULL)
|
||||
tty_raw(tty, keypad_local);
|
||||
@ -175,7 +175,7 @@ tty_find_term(char *name, int fd, char **cause)
|
||||
{
|
||||
struct tty_term *term;
|
||||
int error;
|
||||
|
||||
|
||||
TAILQ_FOREACH(term, &tty_terms, entry) {
|
||||
if (strcmp(term->name, name) == 0) {
|
||||
term->references++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: window-copy.c,v 1.17 2008-06-04 18:50:35 nicm Exp $ */
|
||||
/* $Id: window-copy.c,v 1.18 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -71,7 +71,7 @@ struct window_copy_mode_data {
|
||||
|
||||
u_int selx;
|
||||
u_int sely;
|
||||
|
||||
|
||||
u_int cx;
|
||||
u_int cy;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: window-more.c,v 1.11 2008-06-03 21:42:37 nicm Exp $ */
|
||||
/* $Id: window-more.c,v 1.12 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -94,7 +94,7 @@ window_more_init(struct window *w)
|
||||
s = &data->screen;
|
||||
screen_create(s, screen_size_x(&w->base), screen_size_y(&w->base), 0);
|
||||
s->mode &= ~MODE_CURSOR;
|
||||
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
|
6
window.c
6
window.c
@ -1,4 +1,4 @@
|
||||
/* $Id: window.c,v 1.43 2008-06-18 20:11:25 nicm Exp $ */
|
||||
/* $Id: window.c,v 1.44 2008-06-18 22:21:51 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -165,7 +165,7 @@ winlink_previous(unused struct winlinks *wwl, struct winlink *wl)
|
||||
}
|
||||
|
||||
struct window *
|
||||
window_create(const char *name,
|
||||
window_create(const char *name,
|
||||
const char *cmd, const char **env, u_int sx, u_int sy, u_int hlimit)
|
||||
{
|
||||
struct window *w;
|
||||
@ -189,7 +189,7 @@ window_create(const char *name,
|
||||
sigreset();
|
||||
log_debug("started child: cmd=%s; pid=%d", cmd, (int) getpid());
|
||||
log_close();
|
||||
|
||||
|
||||
execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
|
||||
fatal("execl failed");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user