mirror of
https://codeberg.org/adnano/wmenu.git
synced 2025-10-29 05:40:20 -04:00
Add wmenu-run executable
This commit is contained in:
parent
1f221a73cf
commit
41e8599392
7 changed files with 103 additions and 1 deletions
28
wmenu.c
Normal file
28
wmenu.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#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));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct menu *menu = menu_create();
|
||||
menu_getopts(menu, argc, argv);
|
||||
if (!menu->passwd) {
|
||||
read_items(menu);
|
||||
}
|
||||
int status = menu_run(menu);
|
||||
menu_destroy(menu);
|
||||
return status;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue