dovecot-1.1: idxview: Support specifying the name of dovecot.ind...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 20 01:40:22 EET 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/45827d813cdb
changeset: 8165:45827d813cdb
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Feb 19 18:40:17 2009 -0500
description:
idxview: Support specifying the name of dovecot.index file.

diffstat:

1 file changed, 8 insertions(+), 1 deletion(-)
src/util/idxview.c |    9 ++++++++-

diffs (26 lines):

diff -r 34cd251c79b3 -r 45827d813cdb src/util/idxview.c
--- a/src/util/idxview.c	Fri Feb 13 17:43:40 2009 -0500
+++ b/src/util/idxview.c	Thu Feb 19 18:40:17 2009 -0500
@@ -418,6 +418,8 @@ int main(int argc, const char *argv[])
 	struct mail_index *index;
 	struct mail_index_view *view;
 	struct mail_cache_view *cache_view;
+	struct stat st;
+	const char *p;
 	unsigned int seq, uid = 0;
 
 	lib_init();
@@ -425,7 +427,12 @@ int main(int argc, const char *argv[])
 	if (argc < 2)
 		i_fatal("Usage: idxview <index dir> [<uid>]");
 
-	index = mail_index_alloc(argv[1], "dovecot.index");
+	if (stat(argv[1], &st) == 0 && S_ISDIR(st.st_mode))
+		index = mail_index_alloc(argv[1], "dovecot.index");
+	else if ((p = strrchr(argv[1], '/')) != NULL)
+		index = mail_index_alloc(t_strdup_until(argv[1], p), p + 1);
+	else
+		index = mail_index_alloc(".", argv[1]);
 	if (mail_index_open(index, MAIL_INDEX_OPEN_FLAG_READONLY,
 			    FILE_LOCK_METHOD_FCNTL) <= 0)
 		i_fatal("Couldn't open index %s", argv[1]);


More information about the dovecot-cvs mailing list