| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2003-2004 Michel Dagenais |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation; |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef OPTION_H |
| 20 | #define OPTION_H |
| 21 | |
| 22 | /* Define a new option with a long name (--long_name), a short |
| 23 | one character name (-c), a descriptive text, the argument type, and a |
| 24 | pointer to where the argument value will be stored. For an option of |
| 25 | type LTTV_OPT_NONE, the argument is a boolean value set to true when the |
| 26 | option is present. The option hook is called if non NULL. */ |
| 27 | |
| 28 | typedef enum _LttvOptionType |
| 29 | {LTTV_OPT_NONE, LTTV_OPT_STRING, LTTV_OPT_INT, LTTV_OPT_LONG } |
| 30 | LttvOptionType; |
| 31 | |
| 32 | typedef void (*LttvOptionHook)(void *hook_data); |
| 33 | |
| 34 | void lttv_option_add(const char *long_name, const char char_name, |
| 35 | const char *description, const char *arg_description, |
| 36 | const LttvOptionType t, void *p, |
| 37 | const LttvOptionHook h, void *hook_data); |
| 38 | |
| 39 | |
| 40 | /* Remove an option */ |
| 41 | |
| 42 | void lttv_option_remove(const char *long_name); |
| 43 | |
| 44 | |
| 45 | /* Parse command line options. It is possible to add options (through the |
| 46 | hooks being called) while the parsing is done. The new options will be |
| 47 | used for subsequent command line arguments. */ |
| 48 | |
| 49 | void lttv_option_parse(int argc, char **argv); |
| 50 | |
| 51 | void lttv_option_show_help(void); |
| 52 | |
| 53 | #endif // OPTION_H |