maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
Command Line API

Tools for parsing command line arguments. More...

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_LIST_SZ_MAX   20
 
#define MAUG_CLI_ARG_HELP_SZ_MAX   127
 
#define MAUG_CLI_ARG_SZ_MAX   20
 
#define MAUG_CLI(f)
 Default CLI arguments for all RetroFlat programs.
 

Typedefs

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

Functions

int 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.
 

Detailed Description

Tools for parsing command line arguments.

Macro Definition Documentation

◆ MAUG_CLI

#define MAUG_CLI ( f)
Value:
f( MAUG_CLI_SIGIL "h", 3, "Display help and exit.", maug_cli_h )
#define MAUG_CLI_SIGIL
Default flag to prepend to CLI arguments. Is "/" on Windows/DOS and "-" on other platforms....
Definition marge.h:39

Default CLI arguments for all RetroFlat programs.

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_cbmaug_cli_cb to invoke when arg is found.