aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: be21e33f3cc3d478dfa84390986a0dcc8de6c809 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#define _POSIX_C_SOURCE 200809L

#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));
	}
}

int main(int argc, char *argv[]) {
	struct menu *menu = menu_create();
	menu_getopts(menu, argc, argv);
	if (!menu->passwd) {
		read_items(menu);
	}
	return menu_run(menu);
}