149{
150 if ((argc < 1) || !argv || !cli)
151 return false;
152
153
154 for (int i = 1; i < argc; i++)
155 {
156 if ((argv[i][0] == '-') && (argv[i][1] != '\0'))
157 {
158 const char *equals = strchr(argv[i], '=');
159 if (equals)
160 {
161
162
163 mutt_warning(
_(
"Invalid option syntax: %s (use space instead of '=')"), argv[i]);
166 return false;
167 }
168 }
169 }
170
171
173 if (count > 0)
174 {
176 argc -= count;
177 argv += count;
178 }
179
180 bool rc = true;
181
182 opterr = 0;
183
184#if defined(BSD) || defined(__APPLE__)
185 optreset = 1;
186 optind = 1;
187#else
188 optind = 0;
189#endif
190
191 while (rc && (argc > 1) && (optind < argc))
192 {
193 int opt = getopt_long(argc, argv, "+:A:a:b:Cc:Dd:Ee:F:f:Gg:H:hi:l:m:nOpQ:RSs:vyZz",
195 switch (opt)
196 {
197
198
199 case 'F':
200 {
203 break;
204 }
205 case 'n':
206 {
209 break;
210 }
211 case 'e':
212 {
215 break;
216 }
217 case 'm':
218 {
221 break;
222 }
223 case 'd':
224 {
227 break;
228 }
229 case 'l':
230 {
233 break;
234 }
235
236
237
238 case 'h':
239 {
240 if (optind < argc)
241 {
244 optind++;
245 }
248 break;
249 }
250 case 'L':
251 {
254 break;
255 }
256 case 'v':
257 {
260 else
262
264 break;
265 }
266
267
268
269 case 'A':
270 {
272
275 break;
276 }
277 case 'D':
278 {
281 else
283
285 break;
286 }
287 case 'O':
288 {
291 break;
292 }
293 case 'Q':
294 {
296
299 break;
300 }
301 case 'S':
302 {
305 break;
306 }
307 case 'X':
308 {
312 break;
313 }
314
315
316
317 case 'a':
318 {
320
323 break;
324 }
325 case 'b':
326 {
329 break;
330 }
331 case 'C':
332 {
335 break;
336 }
337 case 'c':
338 {
341 break;
342 }
343 case 'E':
344 {
347 break;
348 }
349 case 'H':
350 {
353 break;
354 }
355 case 'i':
356 {
359 break;
360 }
361 case 's':
362 {
365 break;
366 }
367
368
369
370 case 'f':
371 {
374 break;
375 }
376 case 'G':
377 {
380 break;
381 }
382 case 'g':
383 {
387 break;
388 }
389 case 'p':
390 {
393 break;
394 }
395 case 'R':
396 {
399 break;
400 }
401 case 'y':
402 {
405 break;
406 }
407 case 'Z':
408 {
411 break;
412 }
413 case 'z':
414 {
417 break;
418 }
419
420
421 case -1:
422 {
423 for (int i = optind; i < argc; i++)
424 {
426 }
428 optind = argc;
429 break;
430 }
431 default:
432 {
433 if (opt == '?')
434 {
435
437 }
438 else if (opt == ':')
439 {
440
442 }
443
446 rc = false;
447 break;
448 }
449 }
450 }
451
452 return rc;
453}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static const struct option LongOptions[]
Long option definitions for getopt_long()
static int mop_up(int argc, char *const *argv, int index, struct StringArray *sa)
Eat multiple arguments.
int check_help_mode(const char *mode)
Check for help mode.
#define mutt_warning(...)
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool version
-v Print version
bool license
-vv Print license
enum HelpMode mode
Display detailed help.
bool is_set
This struct has been used.
bool show_help
-O Show one-liner help
bool is_set
This struct has been used.
struct StringArray queries
-Q Query a config option
struct StringArray alias_queries
-A Lookup an alias
bool dump_config
-D Dump the config options
bool dump_changed
-DD Dump the changed config options
bool hide_sensitive
-S Hide sensitive config
struct Buffer draft_file
-H Use this draft file
bool is_set
This struct has been used.
struct Buffer include_file
-i Use this include file
struct StringArray cc_list
-c Add a Cc:
struct StringArray attach
-a Attach a file
bool use_crypto
-C Use CLI crypto
bool edit_infile
-E Edit the draft/include
struct StringArray bcc_list
-b Add a Bcc:
struct StringArray addresses
Send to these addresses.
struct Buffer subject
-s Use this Subject:
struct Buffer log_level
-d Debug log level
struct Buffer log_file
-l Debug log file
struct StringArray commands
-e Run these commands
bool is_set
This struct has been used.
bool disable_system
-n Don't read the system config file
struct StringArray user_files
-F Use these user config files
struct Buffer mbox_type
-m Set the default Mailbox type
bool read_only
-R Open Mailbox read-only
bool start_any_mail
-z Check for Any Mail
bool start_nntp
-G Open an NNTP Mailbox
struct Buffer nntp_server
-g Open this NNTP Mailbox
bool is_set
This struct has been used.
struct Buffer folder
-f Open this Mailbox
bool start_postponed
-p Open Postponed emails
bool start_new_mail
-Z Check for New Mail
bool start_browser
-y Open the Mailbox Browser
struct CliSend send
Send Mode command line options.
struct CliShared shared
Shared command line options.
struct CliHelp help
Help Mode command line options.
struct CliInfo info
Info Mode command line options.
struct CliTui tui
Tui Mode command line options.