read a password
cc . . . -lc
char *getpass (prompt)
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.
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.
If the following condition occurs,
the getpass routine may fail and
errno is set to the following value:
The getpass routine was interrupted by a signal.
The process does not have a controlling terminal.
The return value points to static data
whose content is overwritten by each call.
getpass conforms with:
X/Open Portability Guide, Issue 3, 1989
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003