getpass(3C)


getpass -- 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_r- read a password

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.


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.