summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-07-07 19:49:20 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-07-07 19:49:20 +0000
commit636728068cd05bf10a07b9d593f55990c458a6e9 (patch)
tree3a57ec7124dd030e1a314d58abd6b85685d3285f
parent540531a12acafaaf1a8bb16ed85a6f3487f89908 (diff)
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.
-rw-r--r--usr.bin/tmux/cmd-new-session.c8
-rw-r--r--usr.bin/tmux/cmd-set-option.c4
-rw-r--r--usr.bin/tmux/cmd-set-window-option.c4
-rw-r--r--usr.bin/tmux/cmd-show-options.c4
-rw-r--r--usr.bin/tmux/cmd-show-window-options.c4
-rw-r--r--usr.bin/tmux/server.c14
-rw-r--r--usr.bin/tmux/session.c4
-rw-r--r--usr.bin/tmux/tmux.c107
-rw-r--r--usr.bin/tmux/tmux.h6
-rw-r--r--usr.bin/tmux/window.c4
10 files changed, 78 insertions, 81 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index fbf8c286074..18ea73cd4f4 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.1 2009/06/01 22:58:49 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
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index f6a161b29fb..41d5201247a 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.2 2009/06/03 16:54:26 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);
diff --git a/usr.bin/tmux/cmd-set-window-option.c b/usr.bin/tmux/cmd-set-window-option.c
index 64c14c06df4..ddd364fa3f3 100644
--- a/usr.bin/tmux/cmd-set-window-option.c
+++ b/usr.bin/tmux/cmd-set-window-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-window-option.c,v 1.2 2009/06/25 06:00:45 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);
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c
index 862e666bbfd..654f27fa6bf 100644
--- a/usr.bin/tmux/cmd-show-options.c
+++ b/usr.bin/tmux/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-options.c,v 1.1 2009/06/01 22:58:49 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);
diff --git a/usr.bin/tmux/cmd-show-window-options.c b/usr.bin/tmux/cmd-show-window-options.c
index 02aa4472343..52cfa25fc05 100644
--- a/usr.bin/tmux/cmd-show-window-options.c
+++ b/usr.bin/tmux/cmd-show-window-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-window-options.c,v 1.1 2009/06/01 22:58:49 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);
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index a1f908b7ac1..8112a9443d0 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.5 2009/06/26 22:12:19 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>
@@ -373,8 +373,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);
@@ -573,10 +573,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);
@@ -1062,7 +1060,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();
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c
index 8ae08a772ab..0ce96dac295 100644
--- a/usr.bin/tmux/session.c
+++ b/usr.bin/tmux/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.1 2009/06/01 22:58:49 nicm 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;
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 36329665b71..993119e0b0c 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.11 2009/06/25 06:54:32 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>
@@ -42,8 +42,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;
@@ -267,54 +267,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_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);
-
- 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);
+ &global_s_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
+ options_set_number(&global_s_options, "status-utf8", 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)) {
/*
@@ -368,7 +367,7 @@ main(int argc, char **argv)
shell = _PATH_BSHELL;
}
options_set_string(
- &global_options, "default-command", "exec %s -l", shell);
+ &global_s_options, "default-command", "exec %s -l", shell);
if (getcwd(cwd, sizeof cwd) == NULL) {
pw = getpwuid(getuid());
@@ -377,7 +376,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) {
@@ -481,8 +480,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);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 12ccfd5b88c..0b8d004b753 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.15 2009/06/26 19:44:36 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>
@@ -945,8 +945,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;
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 98926724b83..dbd9915558b 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.6 2009/06/25 06:15:04 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>
@@ -204,7 +204,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) {