wmenu/wmenu.c
adnano c05ab7520b Remove wmenu -P flag
This flag causes some issues with wmenu-run. It will be revisited in the
next release.
2024-05-04 21:41:21 -04:00

26 lines
511 B
C

#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include "menu.h"
#include "wayland.h"
static void read_items(struct menu *menu) {
char buf[sizeof menu->input];
while (fgets(buf, sizeof buf, stdin)) {
char *p = strchr(buf, '\n');
if (p) {
*p = '\0';
}
menu_add_item(menu, strdup(buf), false);
}
}
int main(int argc, char *argv[]) {
struct menu *menu = menu_create();
menu_getopts(menu, argc, argv);
read_items(menu);
int status = menu_run(menu);
menu_destroy(menu);
return status;
}