summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-set-option.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-02-25 12:57:42 +0000
committernicm <nicm@openbsd.org>2012-02-25 12:57:42 +0000
commitcd0b65335c3be19a758f4bc8c0e556e482d6c2ff (patch)
treefeadcfb285dab59cd0f6d89095565d025c258392 /usr.bin/tmux/cmd-set-option.c
parentApply a bit more consistency in the ordering of functions in each (diff)
downloadwireguard-openbsd-cd0b65335c3be19a758f4bc8c0e556e482d6c2ff.tar.xz
wireguard-openbsd-cd0b65335c3be19a758f4bc8c0e556e482d6c2ff.zip
Allow a single option to be specified to show-options to show just that
option.
Diffstat (limited to 'usr.bin/tmux/cmd-set-option.c')
-rw-r--r--usr.bin/tmux/cmd-set-option.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 22ccccc3420..72edb6626f4 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.52 2012/01/21 08:40:09 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.53 2012/02/25 12:57:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,9 +29,6 @@
int cmd_set_option_exec(struct cmd *, struct cmd_ctx *);
-int cmd_set_option_find(const char *, const struct options_table_entry **,
- const struct options_table_entry **);
-
int cmd_set_option_unset(struct cmd *, struct cmd_ctx *,
const struct options_table_entry *, struct options *,
const char *);
@@ -81,39 +78,6 @@ const struct cmd_entry cmd_set_window_option_entry = {
cmd_set_option_exec
};
-/* Look for an option in all three tables. */
-int
-cmd_set_option_find(
- const char *optstr, const struct options_table_entry **table,
- const struct options_table_entry **oe)
-{
- static const struct options_table_entry *tables[] = {
- server_options_table,
- window_options_table,
- session_options_table
- };
- const struct options_table_entry *oe_loop;
- u_int i;
-
- for (i = 0; i < nitems(tables); i++) {
- for (oe_loop = tables[i]; oe_loop->name != NULL; oe_loop++) {
- if (strncmp(oe_loop->name, optstr, strlen(optstr)) != 0)
- continue;
-
- /* If already found, ambiguous. */
- if (*oe != NULL)
- return (-1);
- *oe = oe_loop;
- *table = tables[i];
-
- /* Bail now if an exact match. */
- if (strcmp((*oe)->name, optstr) == 0)
- break;
- }
- }
- return (0);
-}
-
int
cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
{
@@ -139,7 +103,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
/* Find the option entry, try each table. */
table = oe = NULL;
- if (cmd_set_option_find(optstr, &table, &oe) != 0) {
+ if (options_table_find(optstr, &table, &oe) != 0) {
ctx->error(ctx, "ambiguous option: %s", optstr);
return (-1);
}