#include <unistd.h>
#include <stdio.h>
int main() {
char *password = getpass("Password: ");
puts(password);
return 0;
}
I see that getpass can not take input from stdin.
$ ./getpass <<< abc
Password:
xxx
It seems that this is related to termios. Could anybody show me the underlying code equivalent to this program on how this done?