summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c4
-rw-r--r--usr.bin/tmux/cmd-confirm-before.c4
-rw-r--r--usr.bin/tmux/cmd-select-prompt.c6
-rw-r--r--usr.bin/tmux/key-bindings.c6
-rw-r--r--usr.bin/tmux/status.c11
-rw-r--r--usr.bin/tmux/tmux.h4
6 files changed, 19 insertions, 16 deletions
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index 9f040fd1f63..1e0012e945c 100644
--- a/usr.bin/tmux/cmd-command-prompt.c
+++ b/usr.bin/tmux/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-command-prompt.c,v 1.2 2009/07/13 23:11:35 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.3 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -150,7 +150,7 @@ cmd_command_prompt_callback(void *data, const char *s)
if (cause == NULL)
return (0);
*cause = toupper((u_char) *cause);
- status_message_set(c, cause);
+ status_message_set(c, "%s", cause);
xfree(cause);
cmdlist = NULL;
}
diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c
index e28bcb5f3b9..103f373c350 100644
--- a/usr.bin/tmux/cmd-confirm-before.c
+++ b/usr.bin/tmux/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-confirm-before.c,v 1.2 2009/07/13 23:11:35 nicm Exp $ */
+/* $OpenBSD: cmd-confirm-before.c,v 1.3 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -113,7 +113,7 @@ cmd_confirm_before_callback(void *data, const char *s)
if (cmd_string_parse(cdata->cmd, &cmdlist, &cause) != 0) {
if (cause != NULL) {
*cause = toupper((u_char) *cause);
- status_message_set(c, cause);
+ status_message_set(c, "%s", cause);
xfree(cause);
}
goto out;
diff --git a/usr.bin/tmux/cmd-select-prompt.c b/usr.bin/tmux/cmd-select-prompt.c
index 0512bcdad21..d070a1c8488 100644
--- a/usr.bin/tmux/cmd-select-prompt.c
+++ b/usr.bin/tmux/cmd-select-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-prompt.c,v 1.2 2009/07/13 23:11:35 nicm Exp $ */
+/* $OpenBSD: cmd-select-prompt.c,v 1.3 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -74,14 +74,14 @@ cmd_select_prompt_callback(void *data, const char *s)
idx = strtonum(s, 0, UINT_MAX, &errstr);
if (errstr != NULL) {
xsnprintf(msg, sizeof msg, "Index %s: %s", errstr, s);
- status_message_set(c, msg);
+ status_message_set(c, "%s", msg);
return (0);
}
if (winlink_find_by_index(&c->session->windows, idx) == NULL) {
xsnprintf(msg, sizeof msg,
"Window not found: %s:%d", c->session->name, idx);
- status_message_set(c, msg);
+ status_message_set(c, "%s", msg);
return (0);
}
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index 6f718d8c510..36c1fec780c 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.2 2009/07/12 17:33:18 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.3 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -194,7 +194,7 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
va_end(ap);
*msg = toupper((u_char) *msg);
- status_message_set(ctx->curclient, msg);
+ status_message_set(ctx->curclient, "%s", msg);
xfree(msg);
}
@@ -227,7 +227,7 @@ key_bindings_info(struct cmd_ctx *ctx, const char *fmt, ...)
va_end(ap);
*msg = toupper((u_char) *msg);
- status_message_set(ctx->curclient, msg);
+ status_message_set(ctx->curclient, "%s", msg);
xfree(msg);
}
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 98346f06fd1..a27d9e3c513 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.9 2009/07/15 07:50:34 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.10 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -465,17 +465,20 @@ status_print(struct session *s, struct winlink *wl, struct grid_cell *gc)
return (text);
}
-void
-status_message_set(struct client *c, const char *msg)
+void printflike2
+status_message_set(struct client *c, const char *fmt, ...)
{
struct timeval tv;
+ va_list ap;
int delay;
delay = options_get_number(&c->session->options, "display-time");
tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L;
- c->message_string = xstrdup(msg);
+ va_start(ap, fmt);
+ xvasprintf(&c->message_string, fmt, ap);
+ va_end(ap);
if (gettimeofday(&c->message_timer, NULL) != 0)
fatal("gettimeofday");
timeradd(&c->message_timer, &tv, &c->message_timer);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index bbd32385095..be342780ee9 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.31 2009/07/15 07:50:34 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.32 2009/07/15 17:39:00 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1275,7 +1275,7 @@ int server_unlock(const char *);
/* status.c */
int status_redraw(struct client *);
-void status_message_set(struct client *, const char *);
+void printflike2 status_message_set(struct client *, const char *, ...);
void status_message_clear(struct client *);
int status_message_redraw(struct client *);
void status_prompt_set(struct client *,