#include <stdio.h>

Go to the source code of this file.
Classes | |
| struct | option |
| struct | option_alternative |
Defines | |
| #define | OPTIONS_NAME_MAXSIZE 32 |
| #define | OPTIONS_VALUE_MAXSIZE 256 |
Enumerations | |
| enum | option_type { OPTION_STRING = 0, OPTION_INT = 1, OPTION_DOUBLE = 2, OPTION_ALTERNATIVE = 3 } |
Functions | |
| int | get_double (double *p, const char *s) |
| int | get_int (int *p, const char *s) |
| struct option * | options_allocate (int n) |
| void | options_alternative (struct option *, const char *name, struct option_alternative *alt, int *value, const char *desc) |
| void | options_banner (const char *message) |
| void | options_double (struct option *, const char *name, double *p, double def_value, const char *desc) |
| void | options_dump (struct option *options, FILE *f, int write_desc) |
| struct option * | options_find (struct option *ops, const char *name) |
| void | options_int (struct option *, const char *name, int *p, int def_value, const char *desc) |
| struct option * | options_next_empty (struct option *ops) |
| int | options_parse_args (struct option *ops, int argc, const char *argv[]) |
| int | options_parse_file (struct option *ops, const char *pwd, const char *file) |
| int | options_parse_stream (struct option *ops, const char *pwd, FILE *file) |
| void | options_print_help (struct option *ops, FILE *where) |
| int | options_requires_argument (struct option *o) |
| int | options_set (struct option *op, const char *value) |
| void | options_set_passed (struct option *o) |
| void | options_string (struct option *, const char *name, const char **p, const char *def_balue, const char *desc) |
| int | options_try_pair (struct option *ops, const char *name, const char *value) |
| int | options_valid (struct option *op) |
| char * | strdup_ (const char *s) |
| enum option_type |
| int get_double | ( | double * | p, | |
| const char * | s | |||
| ) |
Return 1 if ok.
| int get_int | ( | int * | p, | |
| const char * | s | |||
| ) |
Return 1 if ok.
| struct option* options_allocate | ( | int | n | ) | [read] |
| void options_alternative | ( | struct option * | , | |
| const char * | name, | |||
| struct option_alternative * | alt, | |||
| int * | value, | |||
| const char * | desc | |||
| ) |
| void options_banner | ( | const char * | message | ) |
User-friendly interface
| void options_double | ( | struct option * | , | |
| const char * | name, | |||
| double * | p, | |||
| double | def_value, | |||
| const char * | desc | |||
| ) |
| void options_dump | ( | struct option * | options, | |
| FILE * | f, | |||
| int | write_desc | |||
| ) |
Finds an option in the array. Returns 0 if not found.
| void options_int | ( | struct option * | , | |
| const char * | name, | |||
| int * | p, | |||
| int | def_value, | |||
| const char * | desc | |||
| ) |
| int options_parse_args | ( | struct option * | ops, | |
| int | argc, | |||
| const char * | argv[] | |||
| ) |
Returns 0 on error
| int options_parse_file | ( | struct option * | ops, | |
| const char * | pwd, | |||
| const char * | file | |||
| ) |
Returns 0 on error
| int options_parse_stream | ( | struct option * | ops, | |
| const char * | pwd, | |||
| FILE * | file | |||
| ) |
| void options_print_help | ( | struct option * | ops, | |
| FILE * | where | |||
| ) |
| int options_requires_argument | ( | struct option * | o | ) |
Returns true if the option needs an argument
| int options_set | ( | struct option * | op, | |
| const char * | value | |||
| ) |
Returns 0 on error.
| void options_set_passed | ( | struct option * | o | ) |
Flags the option as passed
| void options_string | ( | struct option * | , | |
| const char * | name, | |||
| const char ** | p, | |||
| const char * | def_balue, | |||
| const char * | desc | |||
| ) |
| int options_try_pair | ( | struct option * | ops, | |
| const char * | name, | |||
| const char * | value | |||
| ) |
Returns 0 on error
| int options_valid | ( | struct option * | op | ) |
| char* strdup_ | ( | const char * | s | ) |
Our version of strdup.