diff options
Diffstat (limited to 'include/grecs/opt.h')
-rw-r--r-- | include/grecs/opt.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/grecs/opt.h b/include/grecs/opt.h new file mode 100644 index 0000000..5153033 --- /dev/null +++ b/include/grecs/opt.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* grecs - Gray's Extensible Configuration System | ||
2 | Copyright (C) 2007-2016 Sergey Poznyakoff | ||
3 | |||
4 | Grecs is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU General Public License as published by the | ||
6 | Free Software Foundation; either version 3 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | Grecs is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with Grecs. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #ifndef _GRECS_OPT_H | ||
18 | #define _GRECS_OPT_H | ||
19 | |||
20 | struct grecs_proginfo { | ||
21 | const char *progname; | ||
22 | char **subcmd; | ||
23 | const char *docstring; | ||
24 | const char *args_doc; | ||
25 | struct grecs_opthelp *opthelp; | ||
26 | size_t optcount; | ||
27 | void (*print_help_hook)(FILE *stream); | ||
28 | void (*print_version_hook)(FILE *stream); | ||
29 | const char *package; | ||
30 | const char *version; | ||
31 | const char *license; | ||
32 | const char *copyright_year; | ||
33 | const char *copyright_holder; | ||
34 | const char **authors; | ||
35 | const char *bug_address; | ||
36 | const char *url; | ||
37 | const char *epilogue; | ||
38 | }; | ||
39 | |||
40 | struct grecs_opthelp { | ||
41 | const char *opt; | ||
42 | const char *arg; | ||
43 | int is_optional; | ||
44 | const char *descr; | ||
45 | }; | ||
46 | |||
47 | #define DESCRCOLUMN 30 | ||
48 | #define RMARGIN 79 | ||
49 | #define GROUPCOLUMN 2 | ||
50 | #define USAGECOLUMN 13 | ||
51 | |||
52 | void grecs_print_help(struct grecs_proginfo *pinfo); | ||
53 | void grecs_print_usage(struct grecs_proginfo *pinfo); | ||
54 | void grecs_print_version_only(struct grecs_proginfo *pinfo, FILE *stream); | ||
55 | void grecs_print_version(struct grecs_proginfo *pinfo, FILE *stream); | ||
56 | |||
57 | #endif | ||
58 | |||