From 7f6133c3b9c0cbe727568dc385e733fed31272d8 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 17 Apr 2014 07:55:43 +0000 Subject: [PATCH] Remove the "info" message mechanism, this was only used for about five mostly useless and annoying messages. Change those commands to silence on success like all the others. Still accept the -q command line flag and "quiet" server option for now. --- usr.bin/tmux/cmd-queue.c | 33 +------------------------------- usr.bin/tmux/cmd-run-shell.c | 12 ++++-------- usr.bin/tmux/cmd-select-layout.c | 5 +---- usr.bin/tmux/cmd-set-option.c | 14 +------------- usr.bin/tmux/cmd-switch-client.c | 9 +++------ usr.bin/tmux/key-bindings.c | 4 ++-- usr.bin/tmux/options-table.c | 4 ++-- usr.bin/tmux/tmux.1 | 14 ++------------ usr.bin/tmux/tmux.c | 11 +++++------ usr.bin/tmux/tmux.h | 3 +-- 10 files changed, 22 insertions(+), 87 deletions(-) diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index 7506a25c583..66620fdccd2 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.15 2014/01/09 13:46:12 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.16 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -86,37 +86,6 @@ cmdq_print(struct cmd_q *cmdq, const char *fmt, ...) va_end(ap); } -/* Show info from command. */ -void printflike2 -cmdq_info(struct cmd_q *cmdq, const char *fmt, ...) -{ - struct client *c = cmdq->client; - va_list ap; - char *msg; - - if (options_get_number(&global_options, "quiet")) - return; - - va_start(ap, fmt); - - if (c == NULL) - /* nothing */; - else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) { - evbuffer_add_vprintf(c->stdout_data, fmt, ap); - - evbuffer_add(c->stdout_data, "\n", 1); - server_push_stdout(c); - } else { - xvasprintf(&msg, fmt, ap); - *msg = toupper((u_char) *msg); - status_message_set(c, "%s", msg); - free(msg); - } - - va_end(ap); - -} - /* Show error from command. */ void printflike2 cmdq_error(struct cmd_q *cmdq, const char *fmt, ...) diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index aaafc47e30c..2a291e60294 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.24 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.25 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -161,13 +161,9 @@ cmd_run_shell_callback(struct job *job) retcode = WTERMSIG(job->status); xasprintf(&msg, "'%s' terminated by signal %d", cmd, retcode); } - if (msg != NULL) { - if (lines == 0) - cmdq_info(cmdq, "%s", msg); - else - cmd_run_shell_print(job, msg); - free(msg); - } + if (msg != NULL) + cmd_run_shell_print(job, msg); + free(msg); } void diff --git a/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c index 648fe38f56f..19eb0882e4b 100644 --- a/usr.bin/tmux/cmd-select-layout.c +++ b/usr.bin/tmux/cmd-select-layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-layout.c,v 1.21 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-select-layout.c,v 1.22 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -104,7 +104,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) else layout = layout_set_previous(wl->window); server_redraw_window(wl->window); - cmdq_info(cmdq, "arranging in: %s", layout_set_name(layout)); return (CMD_RETURN_NORMAL); } @@ -115,7 +114,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) if (layout != -1) { layout = layout_set_select(wl->window, layout); server_redraw_window(wl->window); - cmdq_info(cmdq, "arranging in: %s", layout_set_name(layout)); return (CMD_RETURN_NORMAL); } @@ -126,7 +124,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } server_redraw_window(wl->window); - cmdq_info(cmdq, "arranging in: %s", layoutname); } return (CMD_RETURN_NORMAL); } diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index 696b8a46f9b..86a659d9b4b 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.67 2014/04/17 07:51:38 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.68 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -259,10 +259,6 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char* optstr, return (CMD_RETURN_NORMAL); } options_set_string(oo, optstr, "%s", valstr); - if (!args_has(args, 'q')) { - cmdq_info(cmdq, "set option: %s -> %s", optstr, - valstr); - } } return (CMD_RETURN_NORMAL); } @@ -285,8 +281,6 @@ cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq, } options_remove(oo, oe->name); - if (!args_has(args, 'q')) - cmdq_info(cmdq, "unset option: %s", oe->name); return (0); } @@ -295,9 +289,7 @@ int cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { - struct args *args = self->args; struct options_entry *o; - const char *s; if (oe->type != OPTIONS_TABLE_FLAG && value == NULL) { cmdq_error(cmdq, "empty value"); @@ -337,10 +329,6 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq, } if (o == NULL) return (-1); - - s = options_table_print_entry(oe, o, 0); - if (!args_has(args, 'q')) - cmdq_info(cmdq, "set option: %s -> %s", oe->name, s); return (0); } diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index 621fff729e1..a32c64e892f 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.20 2014/02/12 20:26:13 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.21 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -71,13 +71,10 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); if (args_has(args, 'r')) { - if (c->flags & CLIENT_READONLY) { + if (c->flags & CLIENT_READONLY) c->flags &= ~CLIENT_READONLY; - cmdq_info(cmdq, "made client writable"); - } else { + else c->flags |= CLIENT_READONLY; - cmdq_info(cmdq, "made client read-only"); - } } tflag = args_get(args, 't'); diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index a9d7976aab2..23260b61873 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.39 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.40 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -212,7 +212,7 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c) readonly = 0; } if (!readonly && (c->flags & CLIENT_READONLY)) { - cmdq_info(c->cmdq, "client is read-only"); + cmdq_error(c->cmdq, "client is read-only"); return; } diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 5d90c20239d..3209ca5d253 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.47 2014/04/17 07:36:45 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.48 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -90,7 +90,7 @@ const struct options_table_entry server_options_table[] = { { .name = "quiet", .type = OPTIONS_TABLE_FLAG, - .default_num = 0 /* overridden in main() */ + .default_num = 0 }, { .name = "set-clipboard", diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 90b59f25066..371906597ff 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.389 2014/04/17 07:51:38 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.390 2014/04/17 07:55:43 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -23,7 +23,7 @@ .Sh SYNOPSIS .Nm tmux .Bk -words -.Op Fl 2lCquv +.Op Fl 2lCuv .Op Fl c Ar shell-command .Op Fl f Ar file .Op Fl L Ar socket-name @@ -168,10 +168,6 @@ server process to recreate it. Behave as a login shell. This flag currently has no effect and is for compatibility with other shells when using tmux as a login shell. -.It Fl q -Set the -.Ic quiet -server option to prevent the server sending various informational messages. .It Fl S Ar socket-path Specify a full alternative path to the server socket. If @@ -2110,12 +2106,6 @@ option. Set the number of error or information messages to save in the message log for each client. The default is 100. -.It Xo Ic quiet -.Op Ic on | off -.Xc -Enable or disable the display of various informational messages (see also the -.Fl q -command line flag). .It Xo Ic set-clipboard .Op Ic on | off .Xc diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 457d0f4497e..689463195c1 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.130 2014/03/31 21:42:45 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.131 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -206,7 +206,7 @@ main(int argc, char **argv) char in[256]; const char *home; long long pid; - int opt, flags, quiet, keys, session; + int opt, flags, keys, session; #ifdef DEBUG malloc_options = (char *) "AFGJPX"; @@ -214,7 +214,7 @@ main(int argc, char **argv) setlocale(LC_TIME, ""); - quiet = flags = 0; + flags = 0; label = path = NULL; login_shell = (**argv == '-'); while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) { @@ -244,7 +244,6 @@ main(int argc, char **argv) label = xstrdup(optarg); break; case 'q': - quiet = 1; break; case 'S': free(path); @@ -291,11 +290,11 @@ main(int argc, char **argv) options_init(&global_options, NULL); options_table_populate_tree(server_options_table, &global_options); - options_set_number(&global_options, "quiet", quiet); options_init(&global_s_options, NULL); options_table_populate_tree(session_options_table, &global_s_options); - options_set_string(&global_s_options, "default-shell", "%s", getshell()); + options_set_string(&global_s_options, "default-shell", "%s", + getshell()); options_init(&global_w_options, NULL); options_table_populate_tree(window_options_table, &global_w_options); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index e58e161ec78..4c776082b30 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.451 2014/04/17 07:36:45 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.452 2014/04/17 07:55:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1851,7 +1851,6 @@ size_t cmd_list_print(struct cmd_list *, char *, size_t); struct cmd_q *cmdq_new(struct client *); int cmdq_free(struct cmd_q *); void printflike2 cmdq_print(struct cmd_q *, const char *, ...); -void printflike2 cmdq_info(struct cmd_q *, const char *, ...); void printflike2 cmdq_error(struct cmd_q *, const char *, ...); int cmdq_guard(struct cmd_q *, const char *, int); void cmdq_run(struct cmd_q *, struct cmd_list *); -- 2.20.1