evo-crypter
 
Loading...
Searching...
No Matches
cli.c File Reference
#include "cli.h"

Classes

struct  FlagHandler
 

Functions

void handle_input_flag (Config *config, const char *value)
 Handles the input file flag (-i or –input).
 
void handle_threads_flag (Config *config, const char *value)
 Handles the threads flag (-t or –threads).
 
void handle_generations_flag (Config *config, const char *value)
 Handles the generations flag (-g or –generations).
 
void handle_decrypt_flag (Config *config, const char *value)
 Handles the decrypt flag (-d or –decrypt).
 
void handle_help_flag (Config *config, const char *value)
 Handles the help flag (-h or –help).
 
Config parse_command_line_args (int argc, char *argv[])
 Parses command-line arguments and populates the Config struct.
 

Variables

FlagHandler flag_handlers []
 Array of FlagHandler structs, mapping flag names to handler functions.
 

Function Documentation

◆ handle_decrypt_flag()

void handle_decrypt_flag ( Config config,
const char *  value 
)

Handles the decrypt flag (-d or –decrypt).

Parameters
configThe Config struct to update.
valueThe value associated with the flag (NULL in this case).

◆ handle_generations_flag()

void handle_generations_flag ( Config config,
const char *  value 
)

Handles the generations flag (-g or –generations).

Parameters
configThe Config struct to update.
valueThe value associated with the flag (generations string).

◆ handle_help_flag()

void handle_help_flag ( Config config,
const char *  value 
)

Handles the help flag (-h or –help).

Parameters
configThe Config struct to update.
valueThe value associated with the flag (NULL in this case).

◆ handle_input_flag()

void handle_input_flag ( Config config,
const char *  value 
)

Handles the input file flag (-i or –input).

Parameters
configThe Config struct to update.
valueThe value associated with the flag (input file path).

◆ handle_threads_flag()

void handle_threads_flag ( Config config,
const char *  value 
)

Handles the threads flag (-t or –threads).

Parameters
configThe Config struct to update.
valueThe value associated with the flag (number of threads).

◆ parse_command_line_args()

Config parse_command_line_args ( int  argc,
char *  argv[] 
)

Parses command-line arguments and populates the Config struct.

This function handles the initial parsing of command-line arguments. It identifies flags and their associated values, and it stores them in a preliminary Config object. Further validation and processing of the configuration is done in initialize_config.

Parameters
argcThe number of command-line arguments.
argvAn array of strings containing the command-line arguments.
Returns
A Config struct populated with the parsed arguments. The error field will be set to true if any errors are encountered during parsing.

Variable Documentation

◆ flag_handlers

FlagHandler flag_handlers[]
Initial value:
= {
{"-i", "--input", handle_input_flag},
{"-t", "--threads", handle_threads_flag},
{"-g", "--generations", handle_generations_flag},
{"-d", "--decrypt", handle_decrypt_flag},
{"-h", "--help", handle_help_flag},
{NULL, NULL, NULL}
}
void handle_help_flag(Config *config, const char *value)
Handles the help flag (-h or –help).
Definition cli.c:65
void handle_input_flag(Config *config, const char *value)
Handles the input file flag (-i or –input).
Definition cli.c:9
void handle_threads_flag(Config *config, const char *value)
Handles the threads flag (-t or –threads).
Definition cli.c:23
void handle_decrypt_flag(Config *config, const char *value)
Handles the decrypt flag (-d or –decrypt).
Definition cli.c:54
void handle_generations_flag(Config *config, const char *value)
Handles the generations flag (-g or –generations).
Definition cli.c:40

Array of FlagHandler structs, mapping flag names to handler functions.