Don't ignore stdin in password mode

This makes password mode work for wmenu and wmenu-run without special
cases.
This commit is contained in:
adnano 2024-05-05 10:13:01 -04:00
parent 15d7c7bcc2
commit 30abca4f30
3 changed files with 3 additions and 5 deletions

View file

@ -37,7 +37,7 @@ $PATH and runs the result.
*-P*
wmenu will not directly display the keyboard input, but instead replace it
with asterisks. All data from stdin will be ignored.
with asterisks.
*-v*
prints version information to stdout, then exits.

2
menu.c
View file

@ -85,7 +85,7 @@ static bool parse_color(const char *color, uint32_t *result) {
// Parse menu options from command line arguments.
void menu_getopts(struct menu *menu, int argc, char *argv[]) {
const char *usage =
"Usage: wmenu [-biPvx] [-f font] [-l lines] [-o output] [-p prompt]\n"
"Usage: wmenu [-biPv] [-f font] [-l lines] [-o output] [-p prompt]\n"
"\t[-N color] [-n color] [-M color] [-m color] [-S color] [-s color]\n";
int opt;

View file

@ -19,9 +19,7 @@ static void read_items(struct menu *menu) {
int main(int argc, char *argv[]) {
struct menu *menu = menu_create();
menu_getopts(menu, argc, argv);
if (!menu->passwd) {
read_items(menu);
}
read_items(menu);
int status = menu_run(menu);
menu_destroy(menu);
return status;