GVM User Suite
User tools for the GVM open source project.
|
Go to the source code of this file.
Macros | |
#define | CAG_OPTION_PRINT_DISTANCE 4 |
#define | CAG_OPTION_PRINT_MIN_INDENTION 20 |
Functions | |
static void | cag_option_print_value (const cag_option *option, size_t *accessor_length, FILE *destination) |
static void | cag_option_print_letters (const cag_option *option, bool *first, size_t *accessor_length, FILE *destination) |
static void | cag_option_print_name (const cag_option *option, bool *first, size_t *accessor_length, FILE *destination) |
static size_t | cag_option_get_print_indention (const cag_option *options, size_t option_count) |
void | cag_option_print (const cag_option *options, size_t option_count, FILE *destination) |
Prints all options to the terminal. More... | |
void | cag_option_prepare (cag_option_context *context, const cag_option *options, size_t option_count, int argc, char **argv) |
Prepare argument options context for parsing. More... | |
static const cag_option * | cag_option_find_by_name (cag_option_context *context, char *name, size_t name_size) |
static const cag_option * | cag_option_find_by_letter (cag_option_context *context, char letter) |
static void | cag_option_parse_value (cag_option_context *context, const cag_option *option, char **c) |
static void | cag_option_parse_access_name (cag_option_context *context, char **c) |
static void | cag_option_parse_access_letter (cag_option_context *context, char **c) |
static void | cag_option_shift (cag_option_context *context, int start, int option, int end) |
static bool | cag_option_is_argument_string (const char *c) |
static int | cag_option_find_next (cag_option_context *context) |
bool | cag_option_fetch (cag_option_context *context) |
Fetches an option from the argument list. More... | |
char | cag_option_get (const cag_option_context *context) |
Gets the identifier of the option. More... | |
const char * | cag_option_get_value (const cag_option_context *context) |
Gets the value from the option. More... | |
int | cag_option_get_index (const cag_option_context *context) |
Gets the current index of the context. More... | |
bool cag_option_fetch | ( | cag_option_context * | context | ) |
Fetches an option from the argument list.
This function fetches a single option from the argument list. The context will be moved to that item. Information can be extracted from the context after the item has been fetched. The arguments will be re-ordered, which means that non-option arguments will be moved to the end of the argument list. After all options have been fetched, all non-option arguments will be positioned after the index of the context.
context | The context from which we will fetch the option. |
Definition at line 389 of file cargs.c.
|
static |
|
static |
|
static |
char cag_option_get | ( | const cag_option_context * | context | ) |
Gets the identifier of the option.
This function gets the identifier of the option, which should be unique to this option and can be used to determine what kind of option this is.
context | The context from which the option was fetched. |
Definition at line 444 of file cargs.c.
int cag_option_get_index | ( | const cag_option_context * | context | ) |
Gets the current index of the context.
This function gets the index within the argv arguments of the context. The context always points to the next item which it will inspect. This is particularly useful to inspect the original argument array, or to get non-option arguments after option fetching has finished.
context | The context from which the option was fetched. |
|
static |
const char* cag_option_get_value | ( | const cag_option_context * | context | ) |
Gets the value from the option.
This function gets the value from the option, if any. If the option does not contain a value, this function will return NULL.
context | The context from which the option was fetched. |
Definition at line 450 of file cargs.c.
|
static |
|
static |
|
static |
|
static |
void cag_option_prepare | ( | cag_option_context * | context, |
const cag_option * | options, | ||
size_t | option_count, | ||
int | argc, | ||
char ** | argv | ||
) |
Prepare argument options context for parsing.
This function prepares the context for iteration and initializes the context with the supplied options and arguments. After the context has been prepared, it can be used to fetch arguments from it.
context | The context which will be initialized. |
options | The registered options which are available for the program. |
option_count | The amount of options which are available for the program. |
argc | The amount of arguments the user supplied in the main function. |
argv | A pointer to the arguments of the main function. |
Definition at line 134 of file cargs.c.
void cag_option_print | ( | const cag_option * | options, |
size_t | option_count, | ||
FILE * | destination | ||
) |
Prints all options to the terminal.
This function prints all options to the terminal. This can be used to generate the output for a "--help" option.
options | The options which will be printed. |
option_count | The option count which will be printed. |
destination | The destination where the output will be printed. |
Definition at line 103 of file cargs.c.
|
static |
|
static |
|
static |
|
static |