version 1.60, 2013/03/24 09:54:10 |
version 1.61, 2013/03/24 09:55:02 |
|
|
enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmd_q *); |
enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmd_q *); |
|
|
enum cmd_retval cmd_set_option_user(struct cmd *, struct cmd_q *, |
enum cmd_retval cmd_set_option_user(struct cmd *, struct cmd_q *, |
const char *, const char *); |
const char *, const char *); |
|
|
int cmd_set_option_unset(struct cmd *, struct cmd_q *, |
int cmd_set_option_unset(struct cmd *, struct cmd_q *, |
const struct options_table_entry *, struct options *, |
const struct options_table_entry *, struct options *, |
|
|
|
|
const struct cmd_entry cmd_set_option_entry = { |
const struct cmd_entry cmd_set_option_entry = { |
"set-option", "set", |
"set-option", "set", |
"agqst:uw", 1, 2, |
"agoqst:uw", 1, 2, |
"[-agsquw] [-t target-session|target-window] option [value]", |
"[-agosquw] [-t target-session|target-window] option [value]", |
0, |
0, |
NULL, |
NULL, |
NULL, |
NULL, |
|
|
|
|
const struct cmd_entry cmd_set_window_option_entry = { |
const struct cmd_entry cmd_set_window_option_entry = { |
"set-window-option", "setw", |
"set-window-option", "setw", |
"agqt:u", 1, 2, |
"agoqt:u", 1, 2, |
"[-agqu] " CMD_TARGET_WINDOW_USAGE " option [value]", |
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", |
0, |
0, |
NULL, |
NULL, |
NULL, |
NULL, |
|
|
if (cmd_set_option_unset(self, cmdq, oe, oo, valstr) != 0) |
if (cmd_set_option_unset(self, cmdq, oe, oo, valstr) != 0) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} else { |
} else { |
|
if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) { |
|
if (!args_has(args, 'q')) |
|
cmdq_print(cmdq, "already set: %s", optstr); |
|
return (CMD_RETURN_NORMAL); |
|
} |
if (cmd_set_option_set(self, cmdq, oe, oo, valstr) != 0) |
if (cmd_set_option_set(self, cmdq, oe, oo, valstr) != 0) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
|
|
if (valstr == NULL) { |
if (valstr == NULL) { |
cmdq_error(cmdq, "empty value"); |
cmdq_error(cmdq, "empty value"); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
} |
|
if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) { |
|
if (!args_has(args, 'q')) |
|
cmdq_print(cmdq, "already set: %s", optstr); |
|
return (CMD_RETURN_NORMAL); |
} |
} |
options_set_string(oo, optstr, "%s", valstr); |
options_set_string(oo, optstr, "%s", valstr); |
if (!args_has(args, 'q')) { |
if (!args_has(args, 'q')) { |