aboutsummaryrefslogtreecommitdiff
path: root/wmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'wmenu.c')
-rw-r--r--wmenu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/wmenu.c b/wmenu.c
index e7d37d9..0ce9d08 100644
--- a/wmenu.c
+++ b/wmenu.c
@@ -1,5 +1,6 @@
#define _POSIX_C_SOURCE 200809L
+#include <stdio.h>
#include <string.h>
#include "menu.h"
@@ -16,8 +17,16 @@ static void read_items(struct menu *menu) {
}
}
+static void print_item(struct menu *menu, char *text, bool exit) {
+ puts(text);
+ fflush(stdout);
+ if (exit) {
+ menu->exit = true;
+ }
+}
+
int main(int argc, char *argv[]) {
- struct menu *menu = menu_create();
+ struct menu *menu = menu_create(print_item);
menu_getopts(menu, argc, argv);
read_items(menu);
int status = menu_run(menu);