annotate src/plugins/convert/convert-tool.c @ 4851:5255476a24b5 HEAD

Don't #include a .c file. Figured out another way to do it.
author Timo Sirainen <tss@iki.fi>
date Fri, 01 Dec 2006 12:12:18 +0200
parents a506ee4ec31e
children 87ae4d41bc10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3972
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 /* Copyright (C) 2006 Timo Sirainen */
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3 #include "lib.h"
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #include "ioloop.h"
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 #include "randgen.h"
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 #include "lib-signals.h"
4851
5255476a24b5 Don't #include a .c file. Figured out another way to do it.
Timo Sirainen <tss@iki.fi>
parents: 3972
diff changeset
7 #include "mail-storage.h"
3972
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 #include "convert-storage.h"
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 int main(int argc, const char *argv[])
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11 {
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 struct ioloop *ioloop;
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 int ret = 0;
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
15 lib_init();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
16 lib_signals_init();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17 random_init();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18 mail_storage_init();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19 mail_storage_register_all();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
20
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
21 if (argc <= 4) {
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22 i_fatal("Usage: <username> <home dir> "
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
23 "<source mail env> <dest mail env>");
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
24 }
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
26 ioloop = io_loop_create(system_pool);
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
27
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 ret = convert_storage(argv[1], argv[2], argv[3], argv[4]);
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29 if (ret > 0)
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30 i_info("Successfully converted");
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 else if (ret == 0)
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 i_error("Source storage not found");
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33 else
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 i_error("Internal failure");
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 io_loop_destroy(&ioloop);
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 mail_storage_deinit();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38 lib_signals_deinit();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39 lib_deinit();
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40 return ret;
a506ee4ec31e Added "mail storage conversion" plugin. It can be used with IMAP, POP3
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
41 }