On Wed, Sep 05, Lawrence Greenfield wrote:
> I'd recommend adding a '-f' option (force) to skip this check, and
> send cyrus-bugs a patch and we'll commit it.
Patch attached to this mail.
--
With best regards,
Carsten Hoeger
SuSE, The Linux Experts, http://www.suse.com
Key fingerprint = E3B6 7FDB 4800 0F22 DC09 EB2B 7988 B6A8 6691 C94A
diff -urN cyrus-imapd-2.0.16/imap/ipurge.c cyrus-imapd-2.0.16.SuSE/imap/ipurge.c
--- cyrus-imapd-2.0.16/imap/ipurge.c Sat Jul 7 21:37:26 2001
+++ cyrus-imapd-2.0.16.SuSE/imap/ipurge.c Thu Sep 6 09:07:13 2001
@@ -91,6 +91,7 @@
} mbox_stats_t;
int verbose = 1;
+int forceall = 0;
int purge_me(char *, int, int);
int purge_check(struct mailbox *, void *, char *);
@@ -107,7 +108,7 @@
usage(argv[0]);
}
- while ((option = getopt(argc, argv, "C:hxd:b:k:m:")) != EOF) {
+ while ((option = getopt(argc, argv, "C:hxd:b:k:m:f")) != EOF) {
switch (option) {
case 'C': /* alt config file */
alt_config = optarg;
@@ -139,6 +140,9 @@
case 'x' : {
exact = 1;
} break;
+ case 'f' : {
+ forceall = 1;
+ } break;
case 'h':
default: usage(argv[0]);
}
@@ -172,10 +176,11 @@
int
usage(char *name) {
- printf("usage: %s [-C <alt_config>] [-x] {-d days &| -b bytes|-k Kbytes|-m
Mbytes}\n\t[mboxpattern1 ... [mboxpatternN]]\n", name);
+ printf("usage: %s [-f] [-C <alt_config>] [-x] {-d days &| -b bytes|-k Kbytes|-m
+Mbytes}\n\t[mboxpattern1 ... [mboxpatternN]]\n", name);
printf("\tthere are no defaults and at least one of -d, -b, -k, -m\n\tmust be
specified\n");
printf("\tif no mboxpattern is given %s works on all mailboxes\n", name);
printf("\t -x specifies an exact match for days or size\n");
+ printf("\t -f force also to delete mail below user.* and INBOX.*\n");
exit(0);
}
@@ -186,9 +191,11 @@
int error;
mbox_stats_t stats;
- /* DON'T purge INBOX* and user.* */
- if ((strncasecmp(name,"INBOX",5)==0) || (strncasecmp(name,"user.",5)==0))
+ if( ! forceall ) {
+ /* DON'T purge INBOX* and user.* */
+ if ((strncasecmp(name,"INBOX",5)==0) || (strncasecmp(name,"user.",5)==0))
return 0;
+ }
memset(&stats, '\0', sizeof(mbox_stats_t));
diff -urN cyrus-imapd-2.0.16/man/ipurge.8 cyrus-imapd-2.0.16.SuSE/man/ipurge.8
--- cyrus-imapd-2.0.16/man/ipurge.8 Thu Feb 22 20:27:22 2001
+++ cyrus-imapd-2.0.16.SuSE/man/ipurge.8 Thu Sep 6 09:16:06 2001
@@ -44,6 +44,9 @@
.SH SYNOPSIS
.B ipurge
[
+.B \-f
+]
+[
.B \-C
.I config-file
]
@@ -76,10 +79,18 @@
\fB-m\fR MUST be specified.
.PP
.I Ipurge
+by default only deletes mail below shared folders, which means that mails
+in mailbox(es) below INBOX.* and user.* stay untouched. Use the option
+\fB-f\fR to also delete mail in mailbox(es) below these folders.
+.PP
+.I Ipurge
reads its configuration options out of the
.IR imapd.conf (5)
file unless specified otherwise by \fB-C\fR.
.SH OPTIONS
+.TP
+.BI \-f
+Force deletion of mail in \fIall\fR mailboxes.
.TP
.BI \-C " config-file"
Read configuration options from \fIconfig-file\fR.
PGP signature