cctools
console_login.h File Reference

Read a name and password from the console. More...

Go to the source code of this file.

Functions

int console_login (const char *service, char *name, int namelen, char *pass, int passlen)
 Read a name and password from the console.
 
int console_input (const char *prompt, char *buf, int buflen)
 Read a string from the console.
 

Detailed Description

Read a name and password from the console.

Function Documentation

◆ console_login()

int console_login ( const char * service,
char * name,
int namelen,
char * pass,
int passlen )

Read a name and password from the console.

This routine will set the console to no-echo mode, carefully read a name and password, and then set the mode back.

Parameters
serviceThe name of the service to which the user is authenticating, such as a hostname.
nameA pointer to a buffer to hold the user's name.
namelenThe size of the name buffer in bytes.
passA pointer to a buffer to hold the user's password.
passlenThe size of the name buffer in bytes.
Returns
True if the name and password were successfully read, false otherwise.

◆ console_input()

int console_input ( const char * prompt,
char * buf,
int buflen )

Read a string from the console.

This routine will set the console to no-echo mode, carefully read a generic string, and then set the mode back.

Parameters
promptThe prompt to be displayed on the command line.
bufA pointer to a buffer to hold the string.
buflenThe size of the buffer in bytes.
Returns
True if the string was successfully read, false otherwise.