c-template
command_line.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <argtable3.h>
#include "../../include/utils/colors.h"
#include "../../include/utils/command_line.h"
#include "../../include/utils/array_len.h"
#include "../../include/utils/logger.h"
#include "../../include/utils/safe_mem.h"
Include dependency graph for command_line.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

command_objectnew_command_object (int argc, char *argv[])
 intializes a new command_object to have commands loaded into More...
 
int load_command (command_object *self, command_handler *command)
 loads command handler and makes it executable More...
 
int execute (command_object *self, char *run)
 checks to see if we have a command named according to run and executes it More...
 
void free_command_object (command_object *self)
 frees memory allocated for the command_object and sets pointer to null for some reason this is causing an address boundary error More...
 
int parse_args (int argc, char *argv[], void *argtable[])
 parses arguments, and checks for any errors More...
 
void print_help (char *program_name, void *argtable[])
 formats output More...
 
void setup_args (const char *version_string)
 setups the default argtable arguments More...
 
char * get_run_command ()
 returns the value of command_to_run More...
 

Function Documentation

◆ execute()

int execute ( command_object self,
char *  run 
)

checks to see if we have a command named according to run and executes it

Definition at line 59 of file command_line.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_command_object()

void free_command_object ( command_object self)

frees memory allocated for the command_object and sets pointer to null for some reason this is causing an address boundary error

frees memory allocated for the command_object and sets pointer to null

Definition at line 74 of file command_line.c.

Here is the caller graph for this function:

◆ get_run_command()

char* get_run_command ( )

returns the value of command_to_run

Definition at line 115 of file command_line.c.

◆ load_command()

int load_command ( command_object self,
command_handler command 
)

loads command handler and makes it executable

Definition at line 47 of file command_line.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_command_object()

command_object* new_command_object ( int  argc,
char *  argv[] 
)

intializes a new command_object to have commands loaded into

Definition at line 14 of file command_line.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_args()

int parse_args ( int  argc,
char *  argv[],
void *  argtable[] 
)

parses arguments, and checks for any errors

Definition at line 82 of file command_line.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_help()

void print_help ( char *  program_name,
void *  argtable[] 
)

formats output

Definition at line 99 of file command_line.c.

Here is the caller graph for this function:

◆ setup_args()

void setup_args ( const char *  version_string)

setups the default argtable arguments

Definition at line 106 of file command_line.c.

Here is the caller graph for this function: