getpass(S-osr5)
getpass --
read a password
Syntax
cc . . . -lc
char *getpass (prompt)
char *prompt;
Description
The getpass function opens /dev/tty,
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 /dev/tty.
Return value
Upon successful completion,
getpass returns a pointer to a null-terminated string
of at most [PASS_MAX] characters
that were read from the terminal device.
If an error is encountered, for example
if /dev/tty cannot be opened,
the terminal state is restored and a NULL pointer is returned.
An interrupt terminates input and sends
an interrupt signal to the calling program before returning.
Diagnostics
If the following condition occurs,
the getpass routine may fail and
errno is set to the following value:
[EINTR]-
The getpass routine was interrupted by a signal.
[ENXIO]-
The process does not have a controlling terminal.
Note
The return value points to static data
whose content is overwritten by each call.
Files
/dev/tty
Standards conformance
getpass conforms with:
X/Open Portability Guide, Issue 3, 1989
.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005