summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2014-04-17 07:51:38 +0000
committernicm <nicm@openbsd.org>2014-04-17 07:51:38 +0000
commit4a95a62eb0d3d7484c82058206b16ba9ce828b3d (patch)
tree01743838a6f67ea250ab4ae44fb92351325c2c40
parentDo not show the -fg, -bg and -attr options. If asked for one explicitly, (diff)
downloadwireguard-openbsd-4a95a62eb0d3d7484c82058206b16ba9ce828b3d.tar.xz
wireguard-openbsd-4a95a62eb0d3d7484c82058206b16ba9ce828b3d.zip
Extend the -q flag to set-option to suppress errors about unknown
options - this will allow options to be removed more easily.
-rw-r--r--usr.bin/tmux/cmd-set-option.c28
-rw-r--r--usr.bin/tmux/tmux.16
2 files changed, 21 insertions, 13 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index d868f0bdf95..696b8a46f9b 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.66 2014/02/17 18:12:47 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.67 2014/04/17 07:51:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index ce4109d2d5f..90b59f25066 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.388 2014/04/17 07:36:45 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.389 2014/04/17 07:51:38 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -2047,9 +2047,7 @@ flag prevents setting an option that is already set.
.Pp
The
.Fl q
-flag suppresses the informational message (as if the
-.Ic quiet
-server option was set).
+flag suppresses errors about unknown options.
.Pp
With
.Fl a ,