c5d77517 |
1 | #ifndef OPTION_H |
2 | #define OPTION_H |
3 | |
dc877563 |
4 | /* Define a new option with a long name (--long_name), a short |
c5d77517 |
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 |
dc877563 |
8 | option is present. The option hook is called if non NULL. */ |
c5d77517 |
9 | |
dc877563 |
10 | typedef enum _LttvOptionType |
c5d77517 |
11 | {LTTV_OPT_NONE, LTTV_OPT_STRING, LTTV_OPT_INT, LTTV_OPT_LONG } |
dc877563 |
12 | LttvOptionType; |
c5d77517 |
13 | |
dc877563 |
14 | typedef void (*LttvOptionHook)(void *hook_data); |
c5d77517 |
15 | |
f68ad60d |
16 | void lttv_option_add(const char *long_name, const char char_name, |
dc877563 |
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 | |
c5d77517 |
26 | |
dc877563 |
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. */ |
c5d77517 |
30 | |
dc877563 |
31 | void lttv_option_parse(int argc, char **argv); |
c5d77517 |
32 | |
33 | #endif // OPTION_H |