GETPASS(3C) | Standard C Library Functions | GETPASS(3C) |
getpass, getpassphrase - read a string of characters without echo
#include <stdlib.h> char *getpass(const char *prompt);
char *getpassphrase(const char *prompt);
#include <unistd.h> char *getpass(const char *prompt);
The getpass() function opens the process's controlling terminal, writes to that device the null-terminated string prompt, disables echoing, reads a string of characters up to the next newline character or EOF, restores the terminal state and closes the terminal.
The getpassphrase() function is identical to getpass(), except that it reads and returns a string of up to 257 characters in length.
Upon successful completion, getpass() returns a pointer to a null-terminated string of at most 9 bytes that were read from the terminal device. If an error is encountered, the terminal state is restored and a null pointer is returned.
The getpass() and getpassphrase() functions may fail if:
EINTR
EIO
EMFILE
ENFILE
ENXIO
The return value points to static data whose content may be overwritten by each call.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | getpass() is Standard. |
MT-Level | Unsafe |
September 2, 2003 | OmniOS |