diff options
author | nicm <nicm> | 2014-04-17 07:51:38 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-04-17 07:51:38 +0000 |
commit | 877bdb46ed91580a3a4c430bc8c550314301352a (patch) | |
tree | 13d29b03a76e1619abf029382297af50828f3978 /cmd-set-option.c | |
parent | ebc5cb447f9ecb8f32e4abd0de639df0fc384402 (diff) | |
download | rtmux-877bdb46ed91580a3a4c430bc8c550314301352a.tar.gz rtmux-877bdb46ed91580a3a4c430bc8c550314301352a.tar.bz2 rtmux-877bdb46ed91580a3a4c430bc8c550314301352a.zip |
Extend the -q flag to set-option to suppress errors about unknown
options - this will allow options to be removed more easily.
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r-- | cmd-set-option.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c index 9882e449..67eb8083 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -117,8 +117,11 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } if (oe == NULL) { - cmdq_error(cmdq, "unknown option: %s", optstr); - return (CMD_RETURN_ERROR); + if (!args_has(args, 'q')) { + cmdq_error(cmdq, "unknown option: %s", optstr); + return (CMD_RETURN_ERROR); + } + return (CMD_RETURN_NORMAL); } /* Work out the tree from the table. */ @@ -163,8 +166,10 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } else { if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) { - if (!args_has(args, 'q')) - cmdq_print(cmdq, "already set: %s", optstr); + if (!args_has(args, 'q')) { + cmdq_error(cmdq, "already set: %s", optstr); + return (CMD_RETURN_ERROR); + } return (CMD_RETURN_NORMAL); } if (cmd_set_option_set(self, cmdq, oe, oo, valstr) != 0) @@ -229,8 +234,11 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char* optstr, if (args_has(args, 'u')) { if (options_find1(oo, optstr) == NULL) { - cmdq_error(cmdq, "unknown option: %s", optstr); - return (CMD_RETURN_ERROR); + if (!args_has(args, 'q')) { + cmdq_error(cmdq, "unknown option: %s", optstr); + return (CMD_RETURN_ERROR); + } + return (CMD_RETURN_NORMAL); } if (valstr != NULL) { cmdq_error(cmdq, "value passed to unset option: %s", @@ -244,8 +252,10 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char* optstr, 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); + if (!args_has(args, 'q')) { + cmdq_error(cmdq, "already set: %s", optstr); + return CMD_RETURN_ERROR; + } return (CMD_RETURN_NORMAL); } options_set_string(oo, optstr, "%s", valstr); |