| 1 | #ifndef OPTION_H |
| 2 | #define OPTION_H |
| 3 | |
| 4 | /* Define a new option with a long name (--long_name), a short |
| 5 | one character name (-c), a descriptive text, the argument type, and a |
| 6 | pointer to where the argument value will be stored. For an option of |
| 7 | type LTTV_OPT_NONE, the argument is a boolean value set to true when the |
| 8 | option is present. The option hook is called if non NULL. */ |
| 9 | |
| 10 | typedef enum _LttvOptionType |
| 11 | {LTTV_OPT_NONE, LTTV_OPT_STRING, LTTV_OPT_INT, LTTV_OPT_LONG } |
| 12 | LttvOptionType; |
| 13 | |
| 14 | typedef void (*LttvOptionHook)(void *hook_data); |
| 15 | |
| 16 | void lttv_option_add(const char *long_name, const char char_name, |
| 17 | const char *description, const char *arg_description, |
| 18 | const LttvOptionType t, void *p, |
| 19 | const LttvOptionHook h, void *hook_data); |
| 20 | |
| 21 | |
| 22 | /* Remove an option */ |
| 23 | |
| 24 | void lttv_option_remove(const char *long_name); |
| 25 | |
| 26 | |
| 27 | /* Parse command line options. It is possible to add options (through the |
| 28 | hooks being called) while the parsing is done. The new options will be |
| 29 | used for subsequent command line arguments. */ |
| 30 | |
| 31 | void lttv_option_parse(int argc, char **argv); |
| 32 | |
| 33 | void lttv_option_show_help(void); |
| 34 | |
| 35 | #endif // OPTION_H |