OpenVPN
Functions
console_builtin.c File Reference
#include "syshead.h"
#include "console.h"
#include "error.h"
#include "buffer.h"
#include "misc.h"
#include "win32.h"
Include dependency graph for console_builtin.c:

Go to the source code of this file.

Functions

static bool get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity)
 Get input from a Windows console. More...
 
static bool get_console_input (const char *prompt, const bool echo, char *input, const int capacity)
 Core function for getting input from console. More...
 
bool query_user_exec_builtin (void)
 Wrapper function enabling query_user_exec() if no alternative methods have been enabled. More...
 

Function Documentation

◆ get_console_input()

static bool get_console_input ( const char *  prompt,
const bool  echo,
char *  input,
const int  capacity 
)
static

Core function for getting input from console.

prompt The prompt to present to the user echo Should the user see what is being typed input Pointer to the buffer used to save the user input capacity Size of the input buffer

Returns
Returns True if user input was gathered

Definition at line 194 of file console_builtin.c.

References ASSERT, chomp(), get_console_input_win32(), M_FATAL, msg, secure_memzero(), and strncpynt().

Referenced by query_user_exec_builtin().

◆ get_console_input_win32()

static bool get_console_input_win32 ( const char *  prompt,
const bool  echo,
char *  input,
const int  capacity 
)
static

Get input from a Windows console.

Parameters
promptPrompt to display to the user
echoShould the user input be displayed in the console
inputPointer to the buffer the user input will be saved
capacitySize of the buffer for the user input
Returns
Return false on input error, or if service exit event is signaled.

Definition at line 59 of file console_builtin.c.

References ASSERT, chomp(), flags, free, get_orig_stderr(), malloc, status, string_null_terminate(), win32_service_interrupt(), and write.

Referenced by get_console_input().

◆ query_user_exec_builtin()

bool query_user_exec_builtin ( void  )

Wrapper function enabling query_user_exec() if no alternative methods have been enabled.

Executes a configured setup, using the built-in method for querying the user.

Default method for querying user using default stdin/stdout on a console. This needs to be available as a backup interface for the alternative implementations in case they cannot query through their implementation specific methods.

If no alternative implementation is declared, a wrapper in console.h will ensure query_user_exec() will call this function instead.

Definition at line 270 of file console_builtin.c.

References _query_user::echo, get_console_input(), _query_user::prompt, query_user, QUERY_USER_NUMSLOTS, _query_user::response, and _query_user::response_len.

Referenced by query_user_exec().