getpass(3) CLIX getpass(3)
NAME
getpass - Reads a password
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
char *getpass(
char *prompt );
PARAMETERS
prompt Pointer to the string with which to prompt the user for input.
DESCRIPTION
The getpass() function reads up to a newline or to the end-of-file (EOF)
marker in the /dev/tty file, after sending a prompt to stderr with the
null-terminated string prompt and disabling echoing. A pointer is
returned to a null-terminated string which contains a maximum of eight
characters.
If /dev/tty cannot be opened, a NULL pointer is returned.
EXAMPLES
This code fragment prompts the user for a password and then reads it.
char *passwd_ptr;
char passwd[9];
/*get a password from the user */
passwd_ptr = getpass("enter your password:");
if (passwd_ptr)
strcpy (passwd, passwd_ptr);
.
.
.
FILES
/dev/tty
stdio.h
NOTES
2/94 - Intergraph Corporation 1
getpass(3) CLIX getpass(3)
An interrupt will terminate input and send an interrupt signal to the
calling program before returning.
CAUTIONS
The above function uses <stdio.h>, which causes it to increase the size of
programs, not otherwise using standard I/O, more than might be expected.
RETURN VALUES
The return value points to static data whose content is overwritten by
each call.
If the /dev/tty file cannot be opened, a NULL pointer is returned.
If no errors occur, a pointer to the string entered by the user (eight
characters maximum) is returned.
2 Intergraph Corporation - 2/94