diff options
Diffstat (limited to 'src/cmdline.opt')
-rw-r--r-- | src/cmdline.opt | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt new file mode 100644 index 0000000..31fcf20 --- /dev/null +++ b/src/cmdline.opt | |||
@@ -0,0 +1,193 @@ | |||
1 | /* This file is part of GNU Pies. -*- c -*- | ||
2 | Copyright (C) 2008, 2009, 2010, 2011 Sergey Poznyakoff | ||
3 | |||
4 | GNU Pies is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | GNU Pies 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 | ||
15 | along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | OPTIONS_BEGIN("pies", | ||
18 | [<process invocation and execution supervisor>], | ||
19 | [<>], | ||
20 | [<gnu>], | ||
21 | [<copyright_year=2011>], | ||
22 | [<copyright_holder=Sergey Poznyakoff>]) | ||
23 | |||
24 | GROUP(Operation Mode) | ||
25 | |||
26 | OPTION(config-file,c,FILE, | ||
27 | [<use FILE instead of the default configuration>]) | ||
28 | BEGIN | ||
29 | add_config (current_syntax, optarg); | ||
30 | END | ||
31 | |||
32 | OPTION(config-help,,, | ||
33 | [<show configuration file summary>]) | ||
34 | BEGIN | ||
35 | config_help (); | ||
36 | exit (0); | ||
37 | END | ||
38 | |||
39 | OPTION(,E,, | ||
40 | [<preprocess config and exit>]) | ||
41 | BEGIN | ||
42 | preprocess_only = 1; | ||
43 | END | ||
44 | |||
45 | OPTION(force,,, | ||
46 | [<force startup even if another instance may be running>]) | ||
47 | BEGIN | ||
48 | force_option = 1; | ||
49 | END | ||
50 | |||
51 | OPTION(foreground,,, | ||
52 | [<remain in foreground>]) | ||
53 | BEGIN | ||
54 | log_to_stderr_only = 1; | ||
55 | foreground = 1; | ||
56 | END | ||
57 | |||
58 | OPTION(inetd,i,, | ||
59 | [<run in inetd mode>]) | ||
60 | BEGIN | ||
61 | if (!instance) | ||
62 | instance = "inetd"; | ||
63 | current_syntax = CONF_INETD; | ||
64 | inetd_mode = 1; | ||
65 | END | ||
66 | |||
67 | OPTION(instance,,NAME, | ||
68 | [<set instance name>]) | ||
69 | BEGIN | ||
70 | instance = optarg; | ||
71 | END | ||
72 | |||
73 | OPTION(rate,,NUMBER, | ||
74 | [<set default maximum rate for inetd-style components>]) | ||
75 | BEGIN | ||
76 | char *p; | ||
77 | default_max_rate = strtoul (optarg, &p, 10); | ||
78 | if (*p) | ||
79 | { | ||
80 | logmsg (LOG_ERR, _("not a number: %s"), optarg); | ||
81 | exit (EX_USAGE); | ||
82 | } | ||
83 | END | ||
84 | |||
85 | OPTION(stderr,,, | ||
86 | [<log to stderr>]) | ||
87 | BEGIN | ||
88 | log_to_stderr_only = 1; | ||
89 | END | ||
90 | |||
91 | OPTION(syntax,,[<{pies|inetd|meta1}>], | ||
92 | [<expect configuration files in the given syntax>]) | ||
93 | BEGIN | ||
94 | if (str_to_config_syntax (optarg, ¤t_syntax)) | ||
95 | { | ||
96 | logmsg (LOG_ERR, _("unknown syntax type: %s"), optarg); | ||
97 | exit (EX_USAGE); | ||
98 | } | ||
99 | END | ||
100 | |||
101 | OPTION(syslog,,, | ||
102 | [<log to syslog>]) | ||
103 | BEGIN | ||
104 | log_to_stderr_only = 0; | ||
105 | END | ||
106 | |||
107 | OPTION(lint,t,, | ||
108 | [<parse configuration file and exit>]) | ||
109 | BEGIN | ||
110 | log_to_stderr_only = 1; | ||
111 | lint_mode = 1; | ||
112 | END | ||
113 | |||
114 | GROUP(Preprocessor) | ||
115 | |||
116 | OPTION(define,D,[<NAME[=VALUE]>], | ||
117 | [<define a preprocessor symbol NAME as having VALUE or empty>]) | ||
118 | BEGIN | ||
119 | add_pp_option ("-D", optarg); | ||
120 | END | ||
121 | |||
122 | OPTION(undefine,U,NAME, | ||
123 | [<undefine a preprocessor symbol NAME>]) | ||
124 | BEGIN | ||
125 | add_pp_option ("-U", optarg); | ||
126 | END | ||
127 | |||
128 | GROUP(Component Management) | ||
129 | |||
130 | OPTION(reload,r,, | ||
131 | [<reload the running instance of pies>]) | ||
132 | ALIAS(hup) | ||
133 | BEGIN | ||
134 | log_to_stderr_only = 1; | ||
135 | command = COM_RELOAD; | ||
136 | END | ||
137 | |||
138 | OPTION(restart-component,R,, | ||
139 | [<restart components named in the command line>]) | ||
140 | BEGIN | ||
141 | log_to_stderr_only = 1; | ||
142 | command = COM_RESTART; | ||
143 | END | ||
144 | |||
145 | OPTION(status,s,, | ||
146 | [<display info about the running instance>]) | ||
147 | BEGIN | ||
148 | log_to_stderr_only = 1; | ||
149 | command = COM_STATUS; | ||
150 | END | ||
151 | |||
152 | OPTION(stop,S,, | ||
153 | [<stop the running instance>]) | ||
154 | BEGIN | ||
155 | log_to_stderr_only = 1; | ||
156 | command = COM_STOP; | ||
157 | END | ||
158 | |||
159 | GROUP(Debugging and Additional Diagnostics) | ||
160 | |||
161 | OPTION(dump-depmap,,, | ||
162 | [<dump dependency map>]) | ||
163 | BEGIN | ||
164 | log_to_stderr_only = 1; | ||
165 | command = COM_DUMP_DEPMAP; | ||
166 | END | ||
167 | |||
168 | OPTION(dump-prereq,,, | ||
169 | [<dump prerequisite charts>]) | ||
170 | BEGIN | ||
171 | log_to_stderr_only = 1; | ||
172 | command = COM_DUMP_PREREQ; | ||
173 | END | ||
174 | |||
175 | OPTION(source-info,,, | ||
176 | [<show source info with debugging messages>]) | ||
177 | BEGIN | ||
178 | source_info_option = 1; | ||
179 | END | ||
180 | |||
181 | OPTION(debug,x,LEVEL, | ||
182 | [<set debug verbosity level>]) | ||
183 | BEGIN | ||
184 | debug_level = strtoul (optarg, NULL, 0); | ||
185 | END | ||
186 | |||
187 | OPTIONS_END | ||
188 | |||
189 | void | ||
190 | parse_options(int argc, char *argv[], int *index) | ||
191 | { | ||
192 | GETOPT(argc, argv, *index) | ||
193 | } | ||