Sync OpenBSD patchset 831:

Now that parsing is common, merge some of the small, related commands
together to use the same code.

Also add some arguments (such as -n and -p) to some commands to match
existing commands.
This commit is contained in:
Tiago Cunha
2011-01-07 15:02:38 +00:00
parent b2b5d88f3f
commit ca413cf270
17 changed files with 239 additions and 588 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-option.c,v 1.106 2011-01-07 14:51:54 tcunha Exp $ */
/* $Id: cmd-set-option.c,v 1.107 2011-01-07 15:02:38 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -68,6 +68,16 @@ const struct cmd_entry cmd_set_option_entry = {
cmd_set_option_exec
};
const struct cmd_entry cmd_set_window_option_entry = {
"set-window-option", "setw",
"agt:u", 1, 2,
"[-agu] " CMD_TARGET_WINDOW_USAGE " option [value]",
0,
NULL,
NULL,
cmd_set_option_exec
};
int
cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
{
@ -87,7 +97,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
if (args_has(self->args, 's')) {
oo = &global_options;
table = server_options_table;
} else if (args_has(self->args, 'w')) {
} else if (args_has(self->args, 'w') ||
self->entry == &cmd_set_window_option_entry) {
table = window_options_table;
if (args_has(self->args, 'g'))
oo = &global_w_options;