|
YAAP - Yet Another Argument Parser
A simple commandline argument parser for C
|
header file for all argparse functions More...

Go to the source code of this file.
Data Structures | |
| struct | arg_base |
| base structure for a command line argument More... | |
| struct | arg_parse_cmd |
| structure representing a command More... | |
| struct | arg_str |
| structure representing a string command line argument More... | |
| struct | arg_flag |
| structure representing a simple flag command line argument More... | |
| struct | arg_int |
| structure representing a simple int command line argument More... | |
| struct | arg_parse_ctx |
| structure for the argparse context, holding argparse specific data structures More... | |
Macros | |
| #define | ARGPARSE_INITIAL_COMMAND_NR 5 |
| initial size for the command array | |
| #define | to_argbase(ptr) ((struct arg_base *) ptr) |
| convert a pointer to an arg_base structure pointer | |
| #define | to_cmd(ptr) ((struct arg_parse_cmd *)ptr) |
| convert a pointer to an arg_parse_cmd structure pointer | |
| #define | to_str(ptr) ((struct arg_str *)ptr) |
| convert a pointer to an arg_str structure pointer | |
| #define | to_flag(ptr) ((struct arg_flag *) ptr) |
| convert a pointer to an arg_flag structure pointer | |
| #define | to_int(ptr) ((struct arg_int *) ptr) |
| convert a pointer to an arg_int structure pointer | |
Enumerations | |
| enum | argtypes { ARG_CMD, ARG_FLAG, ARG_STR, ARG_INT } |
| supported argument types More... | |
Functions | |
| struct arg_parse_ctx * | argparse_init () |
| initialize parsing context More... | |
| void | argparse_free (struct arg_parse_ctx *ctx) |
| free the parsing context at program end More... | |
| int | argparse_add_command (struct arg_parse_ctx *ctx, struct arg_parse_cmd *cmd) |
| add a commandline command to the context More... | |
| int | argparse_add_string (struct arg_parse_ctx *ctx, struct arg_str *str) |
| add a string argument to the context More... | |
| int | argparse_add_flag (struct arg_parse_ctx *ctx, struct arg_flag *flag) |
| add a flag argument to the context More... | |
| int | argparse_add_int (struct arg_parse_ctx *ctx, struct arg_int *integer) |
| add a integer argument to the context More... | |
| int | argparse_parse (struct arg_parse_ctx *ctx, int argc, char **argv) |
| parse the given commandline in the context More... | |
header file for all argparse functions
| enum argtypes |
| int argparse_add_command | ( | struct arg_parse_ctx * | ctx, |
| struct arg_parse_cmd * | cmd | ||
| ) |
add a commandline command to the context
add a commandline command to the context
| ctx | - the context the command should be added to |
| cmd | - the command to add to the context |
| int argparse_add_flag | ( | struct arg_parse_ctx * | ctx, |
| struct arg_flag * | flag | ||
| ) |
| int argparse_add_int | ( | struct arg_parse_ctx * | ctx, |
| struct arg_int * | integer | ||
| ) |
add a integer argument to the context
add a integer argument to the context
| ctx | - the context the command should be added to |
| integer | - the arg_int to add |
| int argparse_add_string | ( | struct arg_parse_ctx * | ctx, |
| struct arg_str * | str | ||
| ) |
add a string argument to the context
add a string argument to the context
| ctx | - the context the command should be added to |
| str | - the arg_str to add |
| void argparse_free | ( | struct arg_parse_ctx * | ctx | ) |
free the parsing context at program end
free the parsing context at program end
this function should be called at the end of the programm
| ctx | - the arg_parse_ctx structure to free |
| struct arg_parse_ctx* argparse_init | ( | ) |
initialize parsing context
initialize parsing context
This function has to be called at every start of the programm and before any other argparse functions are called!!!
| int argparse_parse | ( | struct arg_parse_ctx * | ctx, |
| int | argc, | ||
| char ** | argv | ||
| ) |
parse the given commandline in the context
parse the given commandline in the context
| ctx | - the arg parse context to use |
| argc | - the argument count of the commandline |
| argv | - the argument list of the commandline |
1.8.13