|
VSF Documented
|
#include <stdio.h>#include <time.h>Go to the source code of this file.
Data Structures | |
| struct | arg_hdr |
| struct | arg_rem |
| struct | arg_lit |
| struct | arg_int |
| struct | arg_dbl |
| struct | arg_str |
| struct | arg_rex |
| struct | arg_file |
| struct | arg_date |
| struct | arg_end |
| struct | arg_cmd_info |
Macros | |
| #define | ARG_REX_ICASE 1 |
| #define | ARG_DSTR_SIZE 200 |
| #define | ARG_CMD_NAME_LEN 100 |
| #define | ARG_CMD_DESCRIPTION_LEN 256 |
| #define | ARG_REPLACE_GETOPT 0 /* ESP-IDF-specific: use newlib-provided getopt instead of the embedded one */ |
| #define | ARG_EXTERN |
| #define | ARG_DSTR_STATIC ((arg_dstr_freefn*)0) |
| #define | ARG_DSTR_VOLATILE ((arg_dstr_freefn*)1) |
| #define | ARG_DSTR_DYNAMIC ((arg_dstr_freefn*)3) |
Typedefs | |
| typedef struct _internal_arg_dstr * | arg_dstr_t |
| typedef void * | arg_cmd_itr_t |
| typedef void() | arg_resetfn(void *parent) |
| typedef int() | arg_scanfn(void *parent, const char *argval) |
| typedef int() | arg_checkfn(void *parent) |
| typedef void() | arg_errorfn(void *parent, arg_dstr_t ds, int error, const char *argval, const char *progname) |
| typedef void() | arg_dstr_freefn(char *buf) |
| typedef int() | arg_cmdfn(int argc, char *argv[], arg_dstr_t res) |
| typedef int() | arg_comparefn(const void *k1, const void *k2) |
| typedef struct arg_hdr | arg_hdr_t |
| typedef struct arg_rem | arg_rem_t |
| typedef struct arg_lit | arg_lit_t |
| typedef struct arg_int | arg_int_t |
| typedef struct arg_dbl | arg_dbl_t |
| typedef struct arg_str | arg_str_t |
| typedef struct arg_rex | arg_rex_t |
| typedef struct arg_file | arg_file_t |
| typedef struct arg_date | arg_date_t |
| typedef struct arg_end | arg_end_t |
| typedef struct arg_cmd_info | arg_cmd_info_t |
Enumerations | |
| enum | { ARG_TERMINATOR = 0x1 , ARG_HASVALUE = 0x2 , ARG_HASOPTVALUE = 0x4 } |
| enum | { ARG_ELIMIT = 1 , ARG_EMALLOC , ARG_ENOMATCH , ARG_ELONGOPT , ARG_EMISSARG } |
Functions | |
| ARG_EXTERN struct arg_rem * | arg_rem (const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_lit * | arg_lit0 (const char *shortopts, const char *longopts, const char *glossary) |
| ARG_EXTERN struct arg_lit * | arg_lit1 (const char *shortopts, const char *longopts, const char *glossary) |
| ARG_EXTERN struct arg_lit * | arg_litn (const char *shortopts, const char *longopts, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_int * | arg_int0 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_int * | arg_int1 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_int * | arg_intn (const char *shortopts, const char *longopts, const char *datatype, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_dbl * | arg_dbl0 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_dbl * | arg_dbl1 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_dbl * | arg_dbln (const char *shortopts, const char *longopts, const char *datatype, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_str * | arg_str0 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_str * | arg_str1 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_str * | arg_strn (const char *shortopts, const char *longopts, const char *datatype, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_rex * | arg_rex0 (const char *shortopts, const char *longopts, const char *pattern, const char *datatype, int flags, const char *glossary) |
| ARG_EXTERN struct arg_rex * | arg_rex1 (const char *shortopts, const char *longopts, const char *pattern, const char *datatype, int flags, const char *glossary) |
| ARG_EXTERN struct arg_rex * | arg_rexn (const char *shortopts, const char *longopts, const char *pattern, const char *datatype, int mincount, int maxcount, int flags, const char *glossary) |
| ARG_EXTERN struct arg_file * | arg_file0 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_file * | arg_file1 (const char *shortopts, const char *longopts, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_file * | arg_filen (const char *shortopts, const char *longopts, const char *datatype, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_date * | arg_date0 (const char *shortopts, const char *longopts, const char *format, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_date * | arg_date1 (const char *shortopts, const char *longopts, const char *format, const char *datatype, const char *glossary) |
| ARG_EXTERN struct arg_date * | arg_daten (const char *shortopts, const char *longopts, const char *format, const char *datatype, int mincount, int maxcount, const char *glossary) |
| ARG_EXTERN struct arg_end * | arg_end (int maxcount) |
| ARG_EXTERN int | arg_nullcheck (void **argtable) |
| ARG_EXTERN int | arg_parse (int argc, char **argv, void **argtable) |
| ARG_EXTERN void | arg_print_option (FILE *fp, const char *shortopts, const char *longopts, const char *datatype, const char *suffix) |
| ARG_EXTERN void | arg_print_syntax (FILE *fp, void **argtable, const char *suffix) |
| ARG_EXTERN void | arg_print_syntaxv (FILE *fp, void **argtable, const char *suffix) |
| ARG_EXTERN void | arg_print_glossary (FILE *fp, void **argtable, const char *format) |
| ARG_EXTERN void | arg_print_glossary_gnu (FILE *fp, void **argtable) |
| ARG_EXTERN void | arg_print_formatted (FILE *fp, const unsigned lmargin, const unsigned rmargin, const char *text) |
| ARG_EXTERN void | arg_print_errors (FILE *fp, struct arg_end *end, const char *progname) |
| ARG_EXTERN void | arg_print_option_ds (arg_dstr_t ds, const char *shortopts, const char *longopts, const char *datatype, const char *suffix) |
| ARG_EXTERN void | arg_print_syntax_ds (arg_dstr_t ds, void **argtable, const char *suffix) |
| ARG_EXTERN void | arg_print_syntaxv_ds (arg_dstr_t ds, void **argtable, const char *suffix) |
| ARG_EXTERN void | arg_print_glossary_ds (arg_dstr_t ds, void **argtable, const char *format) |
| ARG_EXTERN void | arg_print_glossary_gnu_ds (arg_dstr_t ds, void **argtable) |
| ARG_EXTERN void | arg_print_errors_ds (arg_dstr_t ds, struct arg_end *end, const char *progname) |
| ARG_EXTERN void | arg_freetable (void **argtable, size_t n) |
| ARG_EXTERN arg_dstr_t | arg_dstr_create (void) |
| ARG_EXTERN void | arg_dstr_destroy (arg_dstr_t ds) |
| ARG_EXTERN void | arg_dstr_reset (arg_dstr_t ds) |
| ARG_EXTERN void | arg_dstr_free (arg_dstr_t ds) |
| ARG_EXTERN void | arg_dstr_set (arg_dstr_t ds, char *str, arg_dstr_freefn *free_proc) |
| ARG_EXTERN void | arg_dstr_cat (arg_dstr_t ds, const char *str) |
| ARG_EXTERN void | arg_dstr_catc (arg_dstr_t ds, char c) |
| ARG_EXTERN void | arg_dstr_catf (arg_dstr_t ds, const char *fmt,...) |
| ARG_EXTERN char * | arg_dstr_cstr (arg_dstr_t ds) |
| ARG_EXTERN void | arg_cmd_init (void) |
| ARG_EXTERN void | arg_cmd_uninit (void) |
| ARG_EXTERN void | arg_cmd_register (const char *name, arg_cmdfn *proc, const char *description) |
| ARG_EXTERN void | arg_cmd_unregister (const char *name) |
| ARG_EXTERN int | arg_cmd_dispatch (const char *name, int argc, char *argv[], arg_dstr_t res) |
| ARG_EXTERN unsigned int | arg_cmd_count (void) |
| ARG_EXTERN arg_cmd_info_t * | arg_cmd_info (const char *name) |
| ARG_EXTERN arg_cmd_itr_t | arg_cmd_itr_create (void) |
| ARG_EXTERN void | arg_cmd_itr_destroy (arg_cmd_itr_t itr) |
| ARG_EXTERN int | arg_cmd_itr_advance (arg_cmd_itr_t itr) |
| ARG_EXTERN char * | arg_cmd_itr_key (arg_cmd_itr_t itr) |
| ARG_EXTERN arg_cmd_info_t * | arg_cmd_itr_value (arg_cmd_itr_t itr) |
| ARG_EXTERN int | arg_cmd_itr_search (arg_cmd_itr_t itr, void *k) |
| ARG_EXTERN void | arg_mgsort (void *data, int size, int esize, int i, int k, arg_comparefn *comparefn) |
| ARG_EXTERN void | arg_make_get_help_msg (arg_dstr_t res) |
| ARG_EXTERN void | arg_make_help_msg (arg_dstr_t ds, char *cmd_name, void **argtable) |
| ARG_EXTERN void | arg_make_syntax_err_msg (arg_dstr_t ds, void **argtable, struct arg_end *end) |
| ARG_EXTERN int | arg_make_syntax_err_help_msg (arg_dstr_t ds, char *name, int help, int nerrors, void **argtable, struct arg_end *end, int *exitcode) |
| ARG_EXTERN void | arg_set_module_name (const char *name) |
| ARG_EXTERN void | arg_set_module_version (int major, int minor, int patch, const char *tag) |
| ARG_EXTERN void | arg_free (void **argtable) |
| #define ARG_REX_ICASE 1 |
| #define ARG_DSTR_SIZE 200 |
| #define ARG_CMD_NAME_LEN 100 |
| #define ARG_CMD_DESCRIPTION_LEN 256 |
| #define ARG_REPLACE_GETOPT 0 /* ESP-IDF-specific: use newlib-provided getopt instead of the embedded one */ |
| #define ARG_EXTERN |
| #define ARG_DSTR_STATIC ((arg_dstr_freefn*)0) |
| #define ARG_DSTR_VOLATILE ((arg_dstr_freefn*)1) |
| #define ARG_DSTR_DYNAMIC ((arg_dstr_freefn*)3) |
| typedef struct _internal_arg_dstr* arg_dstr_t |
| typedef void* arg_cmd_itr_t |
| typedef void() arg_resetfn(void *parent) |
| typedef int() arg_scanfn(void *parent, const char *argval) |
| typedef int() arg_checkfn(void *parent) |
| typedef void() arg_errorfn(void *parent, arg_dstr_t ds, int error, const char *argval, const char *progname) |
| typedef void() arg_dstr_freefn(char *buf) |
| typedef int() arg_cmdfn(int argc, char *argv[], arg_dstr_t res) |
| typedef int() arg_comparefn(const void *k1, const void *k2) |
| typedef struct arg_file arg_file_t |
| typedef struct arg_date arg_date_t |
| typedef struct arg_cmd_info arg_cmd_info_t |
| ARG_EXTERN struct arg_rem * arg_rem | ( | const char * | datatype, |
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_lit * arg_lit0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_lit * arg_lit1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_lit * arg_litn | ( | const char * | shortopts, |
| const char * | longopts, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_int * arg_int0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_int * arg_int1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_int * arg_intn | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_dbl * arg_dbl0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_dbl * arg_dbl1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_dbl * arg_dbln | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_str * arg_str0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_str * arg_str1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_str * arg_strn | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_rex * arg_rex0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | pattern, | ||
| const char * | datatype, | ||
| int | flags, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_rex * arg_rex1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | pattern, | ||
| const char * | datatype, | ||
| int | flags, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_rex * arg_rexn | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | pattern, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| int | flags, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_file * arg_file0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_file * arg_file1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_file * arg_filen | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_date * arg_date0 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | format, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_date * arg_date1 | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | format, | ||
| const char * | datatype, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_date * arg_daten | ( | const char * | shortopts, |
| const char * | longopts, | ||
| const char * | format, | ||
| const char * | datatype, | ||
| int | mincount, | ||
| int | maxcount, | ||
| const char * | glossary | ||
| ) |
| ARG_EXTERN struct arg_end * arg_end | ( | int | maxcount | ) |
| ARG_EXTERN int arg_nullcheck | ( | void ** | argtable | ) |
Checks the argtable[] array for NULL entries and returns 1 if any are found, zero otherwise.
| ARG_EXTERN int arg_parse | ( | int | argc, |
| char ** | argv, | ||
| void ** | argtable | ||
| ) |
| ARG_EXTERN void arg_print_option | ( | FILE * | fp, |
| const char * | shortopts, | ||
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_syntax | ( | FILE * | fp, |
| void ** | argtable, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_syntaxv | ( | FILE * | fp, |
| void ** | argtable, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_glossary | ( | FILE * | fp, |
| void ** | argtable, | ||
| const char * | format | ||
| ) |
| ARG_EXTERN void arg_print_glossary_gnu | ( | FILE * | fp, |
| void ** | argtable | ||
| ) |
| ARG_EXTERN void arg_print_formatted | ( | FILE * | fp, |
| const unsigned | lmargin, | ||
| const unsigned | rmargin, | ||
| const char * | text | ||
| ) |
Print a piece of text formatted, which means in a column with a left and a right margin. The lines are wrapped at whitespaces next to right margin. The function does not indent the first line, but only the following ones.
Example: arg_print_formatted( fp, 0, 5, "Some text that doesn't fit." ) will result in the following output:
Some text that doesn' t fit.
Too long lines will be wrapped in the middle of a word.
arg_print_formatted( fp, 2, 7, "Some text that doesn't fit." ) will result in the following output:
Some text that doesn' t fit.
As you see, the first line is not indented. This enables output of lines, which start in a line where output already happened.
Author: Uli Fouquet
| ARG_EXTERN void arg_print_errors | ( | FILE * | fp, |
| struct arg_end * | end, | ||
| const char * | progname | ||
| ) |
| ARG_EXTERN void arg_print_option_ds | ( | arg_dstr_t | ds, |
| const char * | shortopts, | ||
| const char * | longopts, | ||
| const char * | datatype, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_syntax_ds | ( | arg_dstr_t | ds, |
| void ** | argtable, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_syntaxv_ds | ( | arg_dstr_t | ds, |
| void ** | argtable, | ||
| const char * | suffix | ||
| ) |
| ARG_EXTERN void arg_print_glossary_ds | ( | arg_dstr_t | ds, |
| void ** | argtable, | ||
| const char * | format | ||
| ) |
| ARG_EXTERN void arg_print_glossary_gnu_ds | ( | arg_dstr_t | ds, |
| void ** | argtable | ||
| ) |
Prints the glossary in strict GNU format. Differences to arg_print_glossary() are:
Contributed by Uli Fouquet
| ARG_EXTERN void arg_print_errors_ds | ( | arg_dstr_t | ds, |
| struct arg_end * | end, | ||
| const char * | progname | ||
| ) |
| ARG_EXTERN void arg_freetable | ( | void ** | argtable, |
| size_t | n | ||
| ) |
| ARG_EXTERN arg_dstr_t arg_dstr_create | ( | void | ) |
| ARG_EXTERN void arg_dstr_destroy | ( | arg_dstr_t | ds | ) |
| ARG_EXTERN void arg_dstr_reset | ( | arg_dstr_t | ds | ) |
| ARG_EXTERN void arg_dstr_free | ( | arg_dstr_t | ds | ) |
| ARG_EXTERN void arg_dstr_set | ( | arg_dstr_t | ds, |
| char * | str, | ||
| arg_dstr_freefn * | free_proc | ||
| ) |
| ARG_EXTERN void arg_dstr_cat | ( | arg_dstr_t | ds, |
| const char * | str | ||
| ) |
| ARG_EXTERN void arg_dstr_catc | ( | arg_dstr_t | ds, |
| char | c | ||
| ) |
| ARG_EXTERN void arg_dstr_catf | ( | arg_dstr_t | ds, |
| const char * | fmt, | ||
| ... | |||
| ) |
| ARG_EXTERN char * arg_dstr_cstr | ( | arg_dstr_t | ds | ) |
| ARG_EXTERN void arg_cmd_init | ( | void | ) |
| ARG_EXTERN void arg_cmd_uninit | ( | void | ) |
| ARG_EXTERN void arg_cmd_register | ( | const char * | name, |
| arg_cmdfn * | proc, | ||
| const char * | description | ||
| ) |
| ARG_EXTERN void arg_cmd_unregister | ( | const char * | name | ) |
| ARG_EXTERN int arg_cmd_dispatch | ( | const char * | name, |
| int | argc, | ||
| char * | argv[], | ||
| arg_dstr_t | res | ||
| ) |
| ARG_EXTERN unsigned int arg_cmd_count | ( | void | ) |
| ARG_EXTERN arg_cmd_info_t * arg_cmd_info | ( | const char * | name | ) |
| ARG_EXTERN arg_cmd_itr_t arg_cmd_itr_create | ( | void | ) |
| ARG_EXTERN void arg_cmd_itr_destroy | ( | arg_cmd_itr_t | itr | ) |
| ARG_EXTERN int arg_cmd_itr_advance | ( | arg_cmd_itr_t | itr | ) |
| ARG_EXTERN char * arg_cmd_itr_key | ( | arg_cmd_itr_t | itr | ) |
| ARG_EXTERN arg_cmd_info_t * arg_cmd_itr_value | ( | arg_cmd_itr_t | itr | ) |
| ARG_EXTERN int arg_cmd_itr_search | ( | arg_cmd_itr_t | itr, |
| void * | k | ||
| ) |
| ARG_EXTERN void arg_mgsort | ( | void * | data, |
| int | size, | ||
| int | esize, | ||
| int | i, | ||
| int | k, | ||
| arg_comparefn * | comparefn | ||
| ) |
| ARG_EXTERN void arg_make_get_help_msg | ( | arg_dstr_t | res | ) |
| ARG_EXTERN void arg_make_help_msg | ( | arg_dstr_t | ds, |
| char * | cmd_name, | ||
| void ** | argtable | ||
| ) |
| ARG_EXTERN void arg_make_syntax_err_msg | ( | arg_dstr_t | ds, |
| void ** | argtable, | ||
| struct arg_end * | end | ||
| ) |
| ARG_EXTERN int arg_make_syntax_err_help_msg | ( | arg_dstr_t | ds, |
| char * | name, | ||
| int | help, | ||
| int | nerrors, | ||
| void ** | argtable, | ||
| struct arg_end * | end, | ||
| int * | exitcode | ||
| ) |
| ARG_EXTERN void arg_set_module_name | ( | const char * | name | ) |
| ARG_EXTERN void arg_set_module_version | ( | int | major, |
| int | minor, | ||
| int | patch, | ||
| const char * | tag | ||
| ) |
| ARG_EXTERN void arg_free | ( | void ** | argtable | ) |