Fix a format string bug and sprinkle some printflikes.

This commit is contained in:
Nicholas Marriott 2007-11-20 18:11:37 +00:00
parent b04bffc9c9
commit c0572ea992
6 changed files with 24 additions and 20 deletions

View File

@ -1,5 +1,7 @@
20 November 2007 20 November 2007
* Fix format string error with "must specify a client" message. Also
sprinkle some printflike tags.
* tmux 0.1 released. * tmux 0.1 released.
17 November 2007 17 November 2007
@ -231,4 +233,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.74 2007-11-20 17:01:38 nicm Exp $ $Id: CHANGES,v 1.75 2007-11-20 18:11:37 nicm Exp $

View File

@ -1,4 +1,4 @@
/* $Id: key-bindings.c,v 1.15 2007-11-16 22:06:45 nicm Exp $ */ /* $Id: key-bindings.c,v 1.16 2007-11-20 18:11:37 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -26,8 +26,8 @@
struct bindings key_bindings; struct bindings key_bindings;
void key_bindings_error(struct cmd_ctx *, const char *, ...); void printflike2 key_bindings_error(struct cmd_ctx *, const char *, ...);
void key_bindings_print(struct cmd_ctx *, const char *, ...); void printflike2 key_bindings_print(struct cmd_ctx *, const char *, ...);
void void
key_bindings_add(int key, struct cmd *cmd) key_bindings_add(int key, struct cmd *cmd)
@ -141,7 +141,7 @@ key_bindings_free(void)
ARRAY_FREE(&key_bindings); ARRAY_FREE(&key_bindings);
} }
void void printflike2
key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...) key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -152,11 +152,11 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
va_end(ap); va_end(ap);
*msg = toupper((u_char) *msg); *msg = toupper((u_char) *msg);
server_write_message(ctx->client, msg); server_write_message(ctx->client, "%s", msg);
xfree(msg); xfree(msg);
} }
void void printflike2
key_bindings_print(struct cmd_ctx *ctx, const char *fmt, ...) key_bindings_print(struct cmd_ctx *ctx, const char *fmt, ...)
{ {
static u_int line; static u_int line;

View File

@ -1,4 +1,4 @@
/* $Id: server-fn.c,v 1.24 2007-10-30 10:59:43 nicm Exp $ */ /* $Id: server-fn.c,v 1.25 2007-11-20 18:11:37 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -327,7 +327,7 @@ server_status_window_all(struct window *w)
} }
} }
void void printflike2
server_write_message(struct client *c, const char *fmt, ...) server_write_message(struct client *c, const char *fmt, ...)
{ {
struct screen *s = &c->session->curw->window->screen; struct screen *s = &c->session->curw->window->screen;

View File

@ -1,4 +1,4 @@
/* $Id: server-msg.c,v 1.32 2007-11-16 21:31:03 nicm Exp $ */ /* $Id: server-msg.c,v 1.33 2007-11-20 18:11:37 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -29,8 +29,10 @@ int server_msg_fn_identify(struct hdr *, struct client *);
int server_msg_fn_keys(struct hdr *, struct client *); int server_msg_fn_keys(struct hdr *, struct client *);
int server_msg_fn_resize(struct hdr *, struct client *); int server_msg_fn_resize(struct hdr *, struct client *);
void server_msg_fn_command_error(struct cmd_ctx *, const char *, ...); void printflike2 server_msg_fn_command_error(
void server_msg_fn_command_print(struct cmd_ctx *, const char *, ...); struct cmd_ctx *, const char *, ...);
void printflike2 server_msg_fn_command_print(
struct cmd_ctx *, const char *, ...);
struct server_msg { struct server_msg {
enum hdrtype type; enum hdrtype type;
@ -74,7 +76,7 @@ server_msg_dispatch(struct client *c)
} }
} }
void void printflike2
server_msg_fn_command_error(struct cmd_ctx *ctx, const char *fmt, ...) server_msg_fn_command_error(struct cmd_ctx *ctx, const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -88,7 +90,7 @@ server_msg_fn_command_error(struct cmd_ctx *ctx, const char *fmt, ...)
xfree(msg); xfree(msg);
} }
void void printflike2
server_msg_fn_command_print(struct cmd_ctx *ctx, const char *fmt, ...) server_msg_fn_command_print(struct cmd_ctx *ctx, const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -144,7 +146,7 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
} else { } else {
if (client == NULL) { if (client == NULL) {
server_msg_fn_command_error(&ctx, server_msg_fn_command_error(&ctx,
"%s: must specify a client: %s", cmd->entry->name); "%s: must specify a client", cmd->entry->name);
goto out; goto out;
} }
for (i = 0; i < ARRAY_LENGTH(&clients); i++) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) {

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.8 2007-10-30 10:59:43 nicm Exp $ */ /* $Id: status.c,v 1.9 2007-11-20 18:11:37 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -22,7 +22,7 @@
#include "tmux.h" #include "tmux.h"
void status_print(struct buffer *, size_t *, const char *, ...); void printflike3 status_print(struct buffer *, size_t *, const char *, ...);
void void
status_write(struct client *c) status_write(struct client *c)
@ -61,7 +61,7 @@ status_write(struct client *c)
input_store_zero(b, CODE_CURSORON); input_store_zero(b, CODE_CURSORON);
} }
void void printflike3
status_print(struct buffer *b, size_t *size, const char *fmt, ...) status_print(struct buffer *b, size_t *size, const char *fmt, ...)
{ {
va_list ap; va_list ap;

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.81 2007-11-16 21:31:03 nicm Exp $ */ /* $Id: tmux.h,v 1.82 2007-11-20 18:11:37 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -653,7 +653,7 @@ void server_clear_window_cur(struct window *);
void server_clear_window_all(struct window *); void server_clear_window_all(struct window *);
void server_redraw_window_cur(struct window *); void server_redraw_window_cur(struct window *);
void server_redraw_window_all(struct window *); void server_redraw_window_all(struct window *);
void server_write_message(struct client *, const char *, ...); void printflike2 server_write_message(struct client *, const char *, ...);
/* status.c */ /* status.c */
void status_write(struct client *c); void status_write(struct client *c);