From 8569003872e6eacad82d2c60e94e732cc4b8ea27 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 17 Nov 2024 22:35:04 +0100 Subject: [PATCH] not echoing password on prompt --- src/chat/flags.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/chat/flags.c b/src/chat/flags.c index 6126dca..7855ee1 100644 --- a/src/chat/flags.c +++ b/src/chat/flags.c @@ -18,11 +18,27 @@ along with this program. If not, see . #include +#include +#include + why2_bool asking_password = 0; void __why2_set_asking_password(why2_bool value) { asking_password = value; + + struct termios tty; + tcgetattr(STDIN_FILENO, &tty); //GET ATTRS + + if (!value) + { + tty.c_lflag |= ECHO; //DISABLE + } else + { + tty.c_lflag &= ~ECHO; //ENABLE + } + + tcsetattr(STDIN_FILENO, TCSANOW, &tty); //SET ATTRS } why2_bool __why2_get_asking_password()