getpass - get a password
#include <unistd.h>
[[deprecated]] char *getpass(const char *prompt);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
This function is obsolete. Do not use it. See NOTES. If you want to
read input without terminal echoing enabled, see the description of the
ECHO
flag in termios(3).
The getpass() function opens /dev/tty
(the
controlling terminal of the process), outputs the string
prompt
, turns off echoing, reads one line (the "password"),
restores the terminal state and closes /dev/tty
again.
The function getpass() returns a pointer to a static
buffer containing (the first PASS_MAX bytes of) the
password without the trailing newline, terminated by a null byte ('\0').
This buffer may be overwritten by a following call. On error, the
terminal state is restored, errno
is set to indicate the error,
and NULL is returned.
crypt(3)