]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Add CMD_FLAG_NO_OPTIONS
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 9 Jun 2021 20:44:29 +0000 (23:44 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 21 Jul 2021 09:03:09 +0000 (09:03 +0000)
This allows command to process all parameters, including parameters starting
with "-".

src/doveadm/doveadm-cmd.c
src/doveadm/doveadm-cmd.h

index 7fe9754c6cea2d8f7853d13f746d7f19efe841fe..13ee93d823d7cf66f3b1fb02daada06f45dba653 100644 (file)
@@ -533,6 +533,12 @@ doveadm_cmd_process_options(int argc, const char *const argv[],
        }
        i_assert(pargc == array_count(&opts)-1); /* opts is NULL-terminated */
 
+       if ((cctx->cmd->flags & CMD_FLAG_NO_OPTIONS) != 0) {
+               /* process -parameters as if they were regular parameters */
+               optind = 1;
+               return 0;
+       }
+
        int c, li;
        while ((c = getopt_long(argc, (char *const *)argv, str_c(optbuf),
                                array_front(&opts), &li)) > -1) {
index 5cb2bbce37fcaea60944796411960961f858748d..a8f8ae9bdcbdbc2cd69833cf0550622ed9e9fc18 100644 (file)
@@ -32,6 +32,8 @@ typedef enum {
        CMD_FLAG_NONE                   = 0x0,
        CMD_FLAG_HIDDEN                 = 0x1,
        CMD_FLAG_NO_PRINT               = 0x2,
+       /* Don't parse any -options for the command. */
+       CMD_FLAG_NO_OPTIONS             = 0x4,
 } doveadm_cmd_flag_t;
 
 struct doveadm_cmd_param {