=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-queue.c,v retrieving revision 1.44 retrieving revision 1.45 diff -c -r1.44 -r1.45 *** src/usr.bin/tmux/cmd-queue.c 2016/10/16 19:04:05 1.44 --- src/usr.bin/tmux/cmd-queue.c 2016/10/16 19:36:37 1.45 *************** *** 1,4 **** ! /* $OpenBSD: cmd-queue.c,v 1.44 2016/10/16 19:04:05 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-queue.c,v 1.45 2016/10/16 19:36:37 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott *************** *** 102,108 **** static void cmdq_remove(struct cmdq_item *item) { ! free((void *)item->hook); if (item->client != NULL) server_client_unref(item->client); --- 102,109 ---- static void cmdq_remove(struct cmdq_item *item) { ! if (item->formats != NULL) ! format_free(item->formats); if (item->client != NULL) server_client_unref(item->client); *************** *** 240,245 **** --- 241,268 ---- { return (item->cb(item, item->data)); } + + /* Add a format to command queue. */ + void + cmdq_format(struct cmdq_item *item, const char *key, const char *fmt, ...) + { + va_list ap; + struct cmdq_item *loop; + char *value; + + va_start(ap, fmt); + xvasprintf(&value, fmt, ap); + va_end(ap); + + for (loop = item; loop != NULL; loop = item->next) { + if (loop->formats == NULL) + loop->formats = format_create(NULL, 0); + format_add(loop->formats, key, "%s", value); + } + + free(value); + } + /* Process next item on command queue. */ u_int