getpass

Prompts the user for a password.

Library:LibC
Classification:Single UNIX
Service:General C Services

Syntax

  #include <unistd.h> 
   
  char  *getpass  (
     const char   *prompt );
  

Parameters

prompt

(IN) Points to the prompt to display to the user.

Return Values

If successful, returns a pointer to the password. Otherwise, returns a NULL pointer and sets errno to one of the following:

Decimal

Constant

Description

5

ENOMEM

Insufficient memory to perform the task.

19

EWRNGKND

The specified screen does not accept input from users.

23

ENO__SCRNS

The NLM has no input screen.

105

ENOCONTEXT

The calling thread has no library context.

Remarks

The getpass function turns off character echoing while the user enters the password.The terminating new line character is discarded as well as any characters beyond the maximum password length.

This function is thread-unsafe.