|
|
#include <unistd.h>char getpass(const char prompt);
char getpass_r(const char prompt, char ret, size_t length);
getpass reads up to a newline or EOF from the file /dev/tty, after prompting on the standard error output with the null-terminated string prompt and disabling echoing. A pointer is returned to a null-terminated string of at most 80 characters (the value of PASS_MAX in /usr/include/limits.h). If /dev/tty cannot be opened, a null pointer is returned. An interrupt will terminate input and send an interrupt signal to the calling program before returning.
getpass_r passes a user supplied buffer pointed to by ret of size length to store the entered password. getpass_r returns ret upon successful completion.
Use the reentrant function getpass_r for multi-threaded applications.