Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (g - h) getpass(3)
NAME
getpass - Reads a string of characters (such as a password) without echoing
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossesrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zossedll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yossedll |
SYNOPSIS
#include <unistd.h>
char *getpass(
const char *prompt);
PARAMETERS
prompt Points to the prompt string that is written to the controlling terminal.
DESCRIPTION
The getpass( ) function does the following:
Opens the controlling terminal file
Writes the contents of the prompt parameter to the controlling terminal file
Disables echoing
Reads up to a newline character or an EOF (end-of-file) character from the controlling
terminal file
Restores the terminal state
Closes the controlling terminal file
If the getpass( ) function is interrupted by the SIGINT signal, the terminal state of the control-
ling terminal is restored before the signal is delivered to the calling process.
NOTES
The getpass( ) function returns a pointer to a static buffer whose content may be overwritten by a
subsequent call.
RETURN VALUES
Upon successful completion, the getpass( ) function returns a pointer to a string of no more than
PASS_MAX bytes plus a terminating null value. This return value points to data that is overwrit-
ten by successive calls to the getpass( ) function.
If the controlling terminal file cannot be opened, a null pointer is returned.
ERRORS
If any of the following conditions occurs as a result of the getpass( ) function calling the
fopen("/dev/tty", "w+") function, the getpass( ) function sets errno to the corresponding value:
[EACCES] One of the following conditions exists:
Search permission is denied on /dev.
The controlling terminal exists but it cannot be written to.
527187-017 Hewlett-Packard Company 3103