Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/plugins/convert/convert-tool.c @ 5534:c69786bd2017 HEAD
Added convert_skip_dotfiles and convert_alt_hierarchy_char settings.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 10 Apr 2007 17:30:30 +0300 |
parents | 784dc7224718 |
children | 7aa36ab24c3b |
comparison
equal
deleted
inserted
replaced
5533:e607f517d08b | 5534:c69786bd2017 |
---|---|
7 #include "mail-storage.h" | 7 #include "mail-storage.h" |
8 #include "convert-storage.h" | 8 #include "convert-storage.h" |
9 | 9 |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 | 11 |
12 #define USAGE_STRING \ | |
13 "Usage: <username> <home dir> <source mail env> <dest mail env>\n" \ | |
14 " [skip_broken_mailboxes] [skip_dotfiles] [alt_hierarchy_char=<c>]" | |
15 | |
12 int main(int argc, const char *argv[]) | 16 int main(int argc, const char *argv[]) |
13 { | 17 { |
14 struct ioloop *ioloop; | 18 struct ioloop *ioloop; |
15 int ret = 0; | 19 struct convert_settings set; |
20 int i, ret = 0; | |
16 | 21 |
17 lib_init(); | 22 lib_init(); |
18 lib_signals_init(); | 23 lib_signals_init(); |
19 random_init(); | 24 random_init(); |
20 mail_storage_init(); | 25 mail_storage_init(); |
21 mail_storage_register_all(); | 26 mail_storage_register_all(); |
22 mailbox_list_register_all(); | 27 mailbox_list_register_all(); |
23 | 28 |
24 if (argc <= 4) { | 29 if (argc <= 4) |
25 i_fatal("Usage: <username> <home dir> " | 30 i_fatal(USAGE_STRING); |
26 "<source mail env> <dest mail env> " | |
27 "[<1=skip broken mailboxes>]"); | |
28 } | |
29 | 31 |
30 ioloop = io_loop_create(); | 32 ioloop = io_loop_create(); |
31 | 33 |
32 ret = convert_storage(argv[1], argv[2], argv[3], argv[4], | 34 memset(&set, 0, sizeof(set)); |
33 argv[5] != NULL && atoi(argv[5]) == 1); | 35 set.user = argv[1]; |
36 set.home = argv[2]; | |
37 | |
38 for (i = 5; i < argc; i++) { | |
39 if (strcmp(argv[i], "skip_broken_mailboxes") != 0) | |
40 set.skip_broken_mailboxes = TRUE; | |
41 else if (strcmp(argv[i], "skip_dotfiles") != 0) | |
42 set.skip_dotfiles = TRUE; | |
43 else if (strncmp(argv[i], "alt_hierarchy_char=", 19) != 0) | |
44 set.alt_hierarchy_char = argv[i][19]; | |
45 } | |
46 | |
47 ret = convert_storage(argv[3], argv[4], &set); | |
34 if (ret > 0) | 48 if (ret > 0) |
35 i_info("Successfully converted"); | 49 i_info("Successfully converted"); |
36 else if (ret == 0) | 50 else if (ret == 0) |
37 i_error("Source storage not found"); | 51 i_error("Source storage not found"); |
38 else | 52 else |