getpassword

Displays a prompt and performs a getstring such that the keyboard input is replaced by asterisks echoed to the screen.

Library:LibC
Classification:Novell
Service:Screen Support

Syntax

  #include <screen.h> 
   
  char *getpassword (
     const char   *prompt,
     char         *password,
     size_t        maxlen);
  

Parameters

prompt

(IN) Points to the string to display as a prompt for entering the password.

password

(OUT) Points to the string read from the keyboard. If you pass NULL for this parameter, the system allocates enough memory for the password string and you are responsible for freeing this memory.

maxlen

(IN) Specifies maximum length of the string. The suggested value is 128 (_PASSWORD_LEN), but any length can be passed. This length is considered to include the null terminator so the usable password length is maxlen-1. As soon as the limit is reached, this function returns with what it has. If Enter or Return are pressed, they also terminate the password entry, but are not returned in the password.

Return Values

If successful, returns a pointer to the password string. Otherwise, returns NULL.