maug
Quick and dirty C mini-augmentation library.
Data Structures | Macros | Typedefs | Functions
Command Line API

Tools for parsing command line arguments. More...

Data Structures

struct  MARGE_ARG
 

Macros

#define MAUG_CLI_SIGIL_SZ   1
 
#define MAUG_CLI_SIGIL   "-"
 Default flag to prepend to CLI arguments. Is "/" on Windows/DOS and "-" on other platforms. Can be overridden with a -D flag or define.
 
#define MAUG_CLI_ARG_C_DEFAULT   -1
 
#define MAUG_CLI_ARG_HELP_SZ_MAX   127
 
#define MAUG_CLI_ARG_SZ_MAX   20
 
#define MAUG_CLI_TRACE_LVL   0
 

Typedefs

typedef MERROR_RETVAL(* maug_cli_cb) (const char *arg, ssize_t arg_c, void *data)
 

Functions

MERROR_RETVAL maug_cli_h (const char *arg, ssize_t arg_c, void *args)
 
MERROR_RETVAL maug_parse_args (int argc, char *argv[])
 
MERROR_RETVAL maug_add_arg (const char *arg, int arg_sz, const char *help, int help_sz, maug_cli_cb arg_cb, void *data)
 Add a command-line argument to the built-in parser. More...
 

Detailed Description

Tools for parsing command line arguments.

Function Documentation

◆ maug_add_arg()

MERROR_RETVAL maug_add_arg ( const char *  arg,
int  arg_sz,
const char *  help,
int  help_sz,
maug_cli_cb  arg_cb,
void *  data 
)

Add a command-line argument to the built-in parser.

Parameters
argString containing the argument to look for.
arg_szLength of arg in chars or 0 to autodetect.
helpHelp text for the arg when -h is invoked.
help_szLength of help in chars or 0 to autodetect.
arg_cb::maug_cli_cb to invoke when arg is found.