getpass(3C) getpass(3C)
NAME
getpass, getpass_r - read a password
SYNOPSIS
#include <unistd.h>
char *getpass(const char *prompt);
char *getpass_r(const char *prompt, char *ret, size_t length);
DESCRIPTION
getpass reads up to a newline or EOF from the file /dev/tty,
after prompting on the standard error output with the null-
terminated string prompt and disabling echoing. A pointer is
returned to a null-terminated string of at most 8 characters.
If /dev/tty cannot be opened, a null pointer is returned. An
interrupt will terminate input and send an interrupt signal to
the calling program before returning.
getpass_r passes a user supplied buffer pointed to by ret of
size length to store the entered password. getpass_r returns
ret upon successful completion.
Files
/dev/tty
Errors
getpass_r returns NULL on failure.
NOTICES
The return value of getpass points to static data whose
content is overwritten by each call.
Use the reentrant function getpass_r for multi-threaded
applications.
Copyright 1994 Novell, Inc. Page 1