[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Base Operating System and Extensions, Volume 1
getpass Subroutine
Purpose
Reads a password.
Library
Standard C Library (libc.a)
Syntax
#include <stdlib.h>
char *getpass ( Prompt)
char *Prompt;
Description
Attention: The characters are returned in a static data area. Subsequent calls
to this subroutine overwrite the static data area.
The getpass subroutine
does the following:
- Opens the controlling terminal of the current
process.
- Writes the characters specified by the Prompt parameter to that device.
- Reads from that device the number of characters
up to the value of the PASS_MAX constant until a new-line
or end-of-file (EOF) character is detected.
- Restores the terminal state and closes the
controlling terminal.
During the read operation, character echoing is disabled.
The getpass subroutine is not
safe in a multithreaded environment. To use the getpass
subroutine in a threaded application, the application must keep the integrity
of each thread.
Parameters
Prompt |
Specifies a prompt to display on the terminal. |
Return Values
If this subroutine is successful, it returns a pointer
to the string. If an error occurs, the subroutine returns a null pointer and
sets the errno global variable to indicate the error.
Error Codes
If the getpass subroutine is unsuccessful,
it returns one or more of the following error codes:
EINTR |
Indicates that an interrupt occurred while the getpass subroutine was reading the terminal device. If a SIGINT or SIGQUIT signal is received, the getpass subroutine terminates input and sends the signal to the calling
process. |
ENXIO |
Indicates that the process does not have a controlling terminal. |
Note: Any subroutines
called by the getpass subroutine may set other error
codes.
Related Information
The getuserpw (getuserpw, putuserpw, or putuserpwhist Subroutine)
subroutine, newpass (newpass Subroutine) subroutine.
List of Security and Auditing
Subroutines, Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]