Hi again,

This is not related to the dry run change, but just something
I noticed...

It seems the verbose mode was always on for ipurge, so this
patch adds a new option -v to enable it.

-- 
Valentin
diff --git a/docsrc/imap/admin/systemcommands/ipurge.rst b/docsrc/imap/admin/systemcommands/ipurge.rst
index 84ccf80..f239a81 100644
--- a/docsrc/imap/admin/systemcommands/ipurge.rst
+++ b/docsrc/imap/admin/systemcommands/ipurge.rst
@@ -13,7 +13,7 @@ Synopsis
 
 .. parsed-literal::
 
-    **ipurge** [ **-f** ] [ **-C** *config-file* ] [ **-x** ] [ **-X** ] [ **-i** ] [ **-s** ] [ **-o** ] [ **-n** ]
+    **ipurge** [ **-f** ] [ **-C** *config-file* ] [ **-x** ] [ **-X** ] [ **-i** ] [ **-s** ] [ **-o** ] [ **-n** ] [ **-v** ]
             [ **-d** *days* | **-b** *bytes* | **-k** *Kbytes* | **-m** *Mbytes* ]
             [ *mailbox-pattern*... ]
 
@@ -89,6 +89,10 @@ Options
 
     Only print messages that would be deleted (dry run).
 
+.. option:: -v
+
+    Enable verbose output/logging.
+
 Examples
 ========
 
diff --git a/imap/ipurge.c b/imap/ipurge.c
index 100b663..6e4fd09 100644
--- a/imap/ipurge.c
+++ b/imap/ipurge.c
@@ -92,7 +92,7 @@ typedef struct mbox_stats_s {
 } mbox_stats_t;
 
 static int dryrun = 0;
-static int verbose = 1;
+static int verbose = 0;
 static int forceall = 0;
 
 static int purge_me(struct findall_data *, void *);
@@ -112,7 +112,7 @@ int main (int argc, char *argv[]) {
       fatal("must run as the Cyrus user", EC_USAGE);
   }
 
-  while ((option = getopt(argc, argv, "C:hxd:b:k:m:fsXion")) != EOF) {
+  while ((option = getopt(argc, argv, "C:hxd:b:k:m:fsXionv")) != EOF) {
     switch (option) {
     case 'C': /* alt config file */
       alt_config = optarg;
@@ -144,6 +144,9 @@ int main (int argc, char *argv[]) {
     case 'n' : {
       dryrun = 1;
     } break;
+    case 'v' : {
+      verbose++;
+    } break;
     case 'x' : {
       exact = 1;
     } break;
@@ -223,6 +226,7 @@ static int usage(const char *name)
   printf("\t -i invert match logic: -x means not equal, date is for newer, size is for smaller.\n");
   printf("\t -o only purge messages that are deleted.\n");
   printf("\t -n only print messages that would be deleted (dry run).\n");
+  printf("\t -v enable verbose output/logging.\n");
   exit(0);
 }
 

Reply via email to