mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options changes easier.
This commit is contained in:
parent
1825609d8d
commit
86504af149
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-session.c,v 1.41 2009-05-04 17:58:26 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-new-session.c,v 1.2 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -137,9 +137,9 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
|
||||
cmd = data->cmd;
|
||||
if (cmd == NULL)
|
||||
cmd = options_get_string(&global_options, "default-command");
|
||||
cmd = options_get_string(&global_s_options, "default-command");
|
||||
if (c == NULL || c->cwd == NULL)
|
||||
cwd = options_get_string(&global_options, "default-path");
|
||||
cwd = options_get_string(&global_s_options, "default-path");
|
||||
else
|
||||
cwd = c->cwd;
|
||||
|
||||
@ -150,7 +150,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
sy = c->tty.sy;
|
||||
}
|
||||
|
||||
if (options_get_number(&global_options, "status")) {
|
||||
if (options_get_number(&global_s_options, "status")) {
|
||||
if (sy == 0)
|
||||
sy = 1;
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-option.c,v 1.62 2009-06-25 16:21:32 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-set-option.c,v 1.3 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -87,7 +87,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
u_int i;
|
||||
|
||||
if (data->flags & CMD_GFLAG)
|
||||
oo = &global_options;
|
||||
oo = &global_s_options;
|
||||
else {
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-window-option.c,v 1.28 2009-06-25 16:21:32 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-set-window-option.c,v 1.3 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -82,7 +82,7 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
u_int i;
|
||||
|
||||
if (data->flags & CMD_GFLAG)
|
||||
oo = &global_window_options;
|
||||
oo = &global_w_options;
|
||||
else {
|
||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-show-options.c,v 1.11 2009-01-27 20:22:33 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-show-options.c,v 1.2 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -54,7 +54,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
long long vn;
|
||||
|
||||
if (data->flags & CMD_GFLAG)
|
||||
oo = &global_options;
|
||||
oo = &global_s_options;
|
||||
else {
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-show-window-options.c,v 1.7 2009-01-27 20:22:33 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-show-window-options.c,v 1.2 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -54,7 +54,7 @@ cmd_show_window_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
long long vn;
|
||||
|
||||
if (data->flags & CMD_GFLAG)
|
||||
oo = &global_window_options;
|
||||
oo = &global_w_options;
|
||||
else {
|
||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
||||
return (-1);
|
||||
|
14
server.c
14
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.153 2009-07-01 23:06:32 nicm Exp $ */
|
||||
/* $OpenBSD: server.c,v 1.6 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -378,8 +378,8 @@ server_main(int srv_fd)
|
||||
unlink(socket_path);
|
||||
xfree(socket_path);
|
||||
|
||||
options_free(&global_options);
|
||||
options_free(&global_window_options);
|
||||
options_free(&global_s_options);
|
||||
options_free(&global_w_options);
|
||||
if (server_password != NULL)
|
||||
xfree(server_password);
|
||||
|
||||
@ -578,10 +578,8 @@ server_redraw_locked(struct client *c)
|
||||
yy = c->tty.sy - 1;
|
||||
if (xx == 0 || yy == 0)
|
||||
return;
|
||||
colour = options_get_number(
|
||||
&global_window_options, "clock-mode-colour");
|
||||
style = options_get_number(
|
||||
&global_window_options, "clock-mode-style");
|
||||
colour = options_get_number(&global_w_options, "clock-mode-colour");
|
||||
style = options_get_number(&global_w_options, "clock-mode-style");
|
||||
|
||||
screen_init(&screen, xx, yy, 0);
|
||||
|
||||
@ -1067,7 +1065,7 @@ server_second_timers(void)
|
||||
time_t t;
|
||||
|
||||
t = time(NULL);
|
||||
xtimeout = options_get_number(&global_options, "lock-after-time");
|
||||
xtimeout = options_get_number(&global_s_options, "lock-after-time");
|
||||
if (xtimeout > 0 && t > server_activity + xtimeout)
|
||||
server_lock();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: session.c,v 1.57 2009-05-19 13:32:55 tcunha Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.2 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -127,7 +127,7 @@ session_create(const char *name,
|
||||
RB_INIT(&s->windows);
|
||||
SLIST_INIT(&s->alerts);
|
||||
paste_init_stack(&s->buffers);
|
||||
options_init(&s->options, &global_options);
|
||||
options_init(&s->options, &global_s_options);
|
||||
|
||||
s->sx = sx;
|
||||
s->sy = sy;
|
||||
|
104
tmux.c
104
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.138 2009-07-01 19:42:55 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.c,v 1.12 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -47,8 +47,8 @@ volatile sig_atomic_t sigusr1;
|
||||
volatile sig_atomic_t sigusr2;
|
||||
|
||||
char *cfg_file;
|
||||
struct options global_options;
|
||||
struct options global_window_options;
|
||||
struct options global_s_options; /* session options */
|
||||
struct options global_w_options; /* window options */
|
||||
|
||||
int server_locked;
|
||||
char *server_password;
|
||||
@ -275,55 +275,53 @@ main(int argc, char **argv)
|
||||
log_open_tty(debug_level);
|
||||
siginit();
|
||||
|
||||
options_init(&global_options, NULL);
|
||||
options_set_number(&global_options, "bell-action", BELL_ANY);
|
||||
options_set_number(&global_options, "buffer-limit", 9);
|
||||
options_set_string(&global_options, "default-command", "%s", "");
|
||||
options_set_number(&global_options, "display-time", 750);
|
||||
options_set_number(&global_options, "history-limit", 2000);
|
||||
options_set_number(&global_options, "lock-after-time", 0);
|
||||
options_set_number(&global_options, "message-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_options, "message-bg", 3);
|
||||
options_set_number(&global_options, "message-fg", 0);
|
||||
options_set_number(&global_options, "prefix", '\002');
|
||||
options_set_number(&global_options, "repeat-time", 500);
|
||||
options_set_number(&global_options, "set-remain-on-exit", 0);
|
||||
options_set_number(&global_options, "set-titles", 0);
|
||||
options_set_number(&global_options, "status", 1);
|
||||
options_set_number(&global_options, "status-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_options, "status-bg", 2);
|
||||
options_set_number(&global_options, "status-fg", 0);
|
||||
options_set_number(&global_options, "status-interval", 15);
|
||||
options_set_number(&global_options, "status-keys", MODEKEY_EMACS);
|
||||
options_set_number(&global_options, "status-left-length", 10);
|
||||
options_set_number(&global_options, "status-right-length", 40);
|
||||
options_set_string(&global_options, "status-left", "[#S]");
|
||||
options_init(&global_s_options, NULL);
|
||||
options_set_number(&global_s_options, "bell-action", BELL_ANY);
|
||||
options_set_number(&global_s_options, "buffer-limit", 9);
|
||||
options_set_number(&global_s_options, "display-time", 750);
|
||||
options_set_number(&global_s_options, "history-limit", 2000);
|
||||
options_set_number(&global_s_options, "lock-after-time", 0);
|
||||
options_set_number(&global_s_options, "message-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_s_options, "message-bg", 3);
|
||||
options_set_number(&global_s_options, "message-fg", 0);
|
||||
options_set_number(&global_s_options, "prefix", '\002');
|
||||
options_set_number(&global_s_options, "repeat-time", 500);
|
||||
options_set_number(&global_s_options, "set-remain-on-exit", 0);
|
||||
options_set_number(&global_s_options, "set-titles", 0);
|
||||
options_set_number(&global_s_options, "status", 1);
|
||||
options_set_number(&global_s_options, "status-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_s_options, "status-bg", 2);
|
||||
options_set_number(&global_s_options, "status-fg", 0);
|
||||
options_set_number(&global_s_options, "status-interval", 15);
|
||||
options_set_number(&global_s_options, "status-keys", MODEKEY_EMACS);
|
||||
options_set_number(&global_s_options, "status-left-length", 10);
|
||||
options_set_number(&global_s_options, "status-right-length", 40);
|
||||
options_set_string(&global_s_options, "status-left", "[#S]");
|
||||
options_set_string(
|
||||
&global_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
|
||||
options_set_number(&global_options, "status-utf8", 0);
|
||||
&global_s_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
|
||||
options_set_number(&global_s_options, "status-utf8", 0);
|
||||
|
||||
options_init(&global_window_options, NULL);
|
||||
options_set_number(&global_window_options, "aggressive-resize", 0);
|
||||
options_set_number(&global_window_options, "automatic-rename", 1);
|
||||
options_set_number(&global_window_options, "clock-mode-colour", 4);
|
||||
options_set_number(&global_window_options, "clock-mode-style", 1);
|
||||
options_set_number(&global_window_options, "force-height", 0);
|
||||
options_set_number(&global_window_options, "force-width", 0);
|
||||
options_set_number(
|
||||
&global_window_options, "mode-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_window_options, "main-pane-width", 81);
|
||||
options_set_number(&global_window_options, "main-pane-height", 24);
|
||||
options_set_number(&global_window_options, "mode-bg", 3);
|
||||
options_set_number(&global_window_options, "mode-fg", 0);
|
||||
options_set_number(&global_window_options, "mode-keys", MODEKEY_EMACS);
|
||||
options_set_number(&global_window_options, "monitor-activity", 0);
|
||||
options_set_string(&global_window_options, "monitor-content", "%s", "");
|
||||
options_set_number(&global_window_options, "utf8", 0);
|
||||
options_set_number(&global_window_options, "window-status-attr", 0);
|
||||
options_set_number(&global_window_options, "window-status-bg", 8);
|
||||
options_set_number(&global_window_options, "window-status-fg", 8);
|
||||
options_set_number(&global_window_options, "xterm-keys", 0);
|
||||
options_set_number(&global_window_options, "remain-on-exit", 0);
|
||||
options_init(&global_w_options, NULL);
|
||||
options_set_number(&global_w_options, "aggressive-resize", 0);
|
||||
options_set_number(&global_w_options, "automatic-rename", 1);
|
||||
options_set_number(&global_w_options, "clock-mode-colour", 4);
|
||||
options_set_number(&global_w_options, "clock-mode-style", 1);
|
||||
options_set_number(&global_w_options, "force-height", 0);
|
||||
options_set_number(&global_w_options, "force-width", 0);
|
||||
options_set_number(&global_w_options, "mode-attr", GRID_ATTR_REVERSE);
|
||||
options_set_number(&global_w_options, "main-pane-width", 81);
|
||||
options_set_number(&global_w_options, "main-pane-height", 24);
|
||||
options_set_number(&global_w_options, "mode-bg", 3);
|
||||
options_set_number(&global_w_options, "mode-fg", 0);
|
||||
options_set_number(&global_w_options, "mode-keys", MODEKEY_EMACS);
|
||||
options_set_number(&global_w_options, "monitor-activity", 0);
|
||||
options_set_string(&global_w_options, "monitor-content", "%s", "");
|
||||
options_set_number(&global_w_options, "utf8", 0);
|
||||
options_set_number(&global_w_options, "window-status-attr", 0);
|
||||
options_set_number(&global_w_options, "window-status-bg", 8);
|
||||
options_set_number(&global_w_options, "window-status-fg", 8);
|
||||
options_set_number(&global_w_options, "xterm-keys", 0);
|
||||
options_set_number(&global_w_options, "remain-on-exit", 0);
|
||||
|
||||
if (!(flags & IDENTIFY_UTF8)) {
|
||||
/*
|
||||
@ -375,7 +373,7 @@ main(int argc, char **argv)
|
||||
else
|
||||
strlcpy(cwd, "/", sizeof cwd);
|
||||
}
|
||||
options_set_string(&global_options, "default-path", "%s", cwd);
|
||||
options_set_string(&global_s_options, "default-path", "%s", cwd);
|
||||
|
||||
if (unlock) {
|
||||
if (argc != 0) {
|
||||
@ -479,8 +477,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
out:
|
||||
options_free(&global_options);
|
||||
options_free(&global_window_options);
|
||||
options_free(&global_s_options);
|
||||
options_free(&global_w_options);
|
||||
|
||||
close(cctx.srv_fd);
|
||||
buffer_destroy(cctx.srv_in);
|
||||
|
6
tmux.h
6
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.349 2009-07-02 18:17:46 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.16 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -944,8 +944,8 @@ extern volatile sig_atomic_t sigcont;
|
||||
extern volatile sig_atomic_t sigchld;
|
||||
extern volatile sig_atomic_t sigusr1;
|
||||
extern volatile sig_atomic_t sigusr2;
|
||||
extern struct options global_options;
|
||||
extern struct options global_window_options;
|
||||
extern struct options global_s_options;
|
||||
extern struct options global_w_options;
|
||||
extern char *cfg_file;
|
||||
extern int server_locked;
|
||||
extern char *server_password;
|
||||
|
4
window.c
4
window.c
@ -1,4 +1,4 @@
|
||||
/* $Id: window.c,v 1.87 2009-07-02 18:17:46 nicm Exp $ */
|
||||
/* $OpenBSD: window.c,v 1.7 2009/07/07 19:49:19 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -220,7 +220,7 @@ window_create1(u_int sx, u_int sy)
|
||||
w->sx = sx;
|
||||
w->sy = sy;
|
||||
|
||||
options_init(&w->options, &global_window_options);
|
||||
options_init(&w->options, &global_w_options);
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
||||
if (ARRAY_ITEM(&windows, i) == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user