25 |
char *confile = NULL; /* Configuration file. */ |
char *confile = NULL; /* Configuration file. */ |
26 |
account_t *ca; /* Current account. */ |
account_t *ca; /* Current account. */ |
27 |
mbox_t *cm; /* Current mailbox. */ |
mbox_t *cm; /* Current mailbox. */ |
28 |
|
|
29 |
options = OPTION_DETAILS_NORMAL; |
options = OPTION_DETAILS_NORMAL; |
30 |
logfile[0] = 0; |
*logfile = 0; |
31 |
|
|
32 |
while ((c = getopt(argc, argv, "c:hl:qv")) != -1) { |
while ((c = getopt(argc, argv, "c:hl:qv")) != -1) { |
33 |
switch (c) { |
switch (c) { |
36 |
break; |
break; |
37 |
case 'h': |
case 'h': |
38 |
usage(); |
usage(); |
39 |
exit(1); |
exit(ERROR_UNDEFINED); |
40 |
break; |
break; |
41 |
case 'l': |
case 'l': |
42 |
strncpy(logfile, optarg, PATH_MAX); |
strncat(logfile, optarg, PATH_MAX - 1); |
43 |
break; |
break; |
44 |
case 'q': |
case 'q': |
45 |
options &= OPTION_DETAILS_CLEAR; |
options &= OPTION_DETAILS_CLEAR; |
51 |
break; |
break; |
52 |
default: |
default: |
53 |
usage(); |
usage(); |
54 |
exit(1); |
exit(ERROR_UNDEFINED); |
55 |
break; |
break; |
56 |
} |
} |
57 |
} |
} |
58 |
|
|
59 |
if (read_config(confile) || open_logfile()) |
read_config(confile); |
60 |
exit(2); |
open_logfile(); |
61 |
|
|
62 |
for (ca = accounts; ca; ca = ca->next) { |
for (ca = accounts; ca; ca = ca->next) { |
63 |
|
|
64 |
if (init_connection(ca->server, ca->port)) { |
if (init_connection(ca->server, ca->port)) { |
65 |
close_logfile(); |
close_logfile(); |
66 |
exit(3); |
exit(ERROR_NETWORK); |
67 |
} |
} |
68 |
|
|
69 |
server_response(); |
server_response("\0"); |
70 |
|
|
71 |
#ifdef DEBUG |
#ifdef DEBUG |
72 |
test(); |
test(); |
77 |
for (cm = ca->mboxes; cm; cm = cm->next) { |
for (cm = ca->mboxes; cm; cm = cm->next) { |
78 |
if (!*cm->filters) |
if (!*cm->filters) |
79 |
continue; |
continue; |
80 |
|
|
81 |
examine_mailbox(cm->name); |
select_mailbox(cm->name); |
82 |
|
|
83 |
apply_filters(cm->filters, cm->name); |
apply_filters(cm->filters, cm->name); |
84 |
|
|