aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/menu.c b/menu.c
index c19bc4b..790282d 100644
--- a/menu.c
+++ b/menu.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: menu.c,v 1.72 2014/01/03 15:29:06 okan Exp $
+ * $OpenBSD: menu.c,v 1.73 2014/01/20 18:58:03 okan Exp $
*/
#include <sys/param.h>
@@ -25,6 +25,7 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -605,6 +606,22 @@ menu_keycode(XKeyEvent *ev, enum ctltype *ctl, char *chr)
}
void
+menuq_add(struct menu_q *mq, void *ctx, const char *fmt, ...)
+{
+ va_list ap;
+ struct menu *mi;
+
+ mi = xcalloc(1, sizeof(*mi));
+ mi->ctx = ctx;
+
+ va_start(ap, fmt);
+ (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap);
+ va_end(ap);
+
+ TAILQ_INSERT_TAIL(mq, mi, entry);
+}
+
+void
menuq_clear(struct menu_q *mq)
{
struct menu *mi;