Mercurial > masqmail
annotate src/parse.c @ 392:c5fd796ea06e
Heavy refactoring in parts of conf.c.
init_conf()
parse_boolean()
parse_list_file()
Re-arrangement of code.
parse_address_glob_list()
Removed unneccessary parameter.
parse_list()
parse_interface():
Use strtok()/strchr() instead of doing is all by hand.
Removed limitation of fixed size buffer.
eat_comments()
Use a state machine.
eat_line_trailing()
eat_spaces()
read_lval()
Better structured code.
read_conf()
read_route()
Removed magic numbers.
Made all list type in the config files accept pathname entries,
except for `permanent_routes' and `query_routes.' for which this
is impossible.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 18 Feb 2012 18:07:55 +0100 |
parents | b27f66555ba8 |
children | cff967b2f51e |
rev | line source |
---|---|
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
1 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
2 ** MasqMail |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
3 ** Copyright (C) 1999-2001 Oliver Kurth |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
4 ** Copyright (C) 2010 markus schnalke <meillo@marmaro.de> |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
5 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
6 ** This program is free software; you can redistribute it and/or modify |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
7 ** it under the terms of the GNU General Public License as published by |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
8 ** the Free Software Foundation; either version 2 of the License, or |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
9 ** (at your option) any later version. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
10 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
11 ** This program is distributed in the hope that it will be useful, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
14 ** GNU General Public License for more details. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
15 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
16 ** You should have received a copy of the GNU General Public License |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
17 ** along with this program; if not, write to the Free Software |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
18 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0 | 19 */ |
20 | |
21 #ifndef PARSE_TEST | |
22 #include "masqmail.h" | |
23 #endif | |
24 | |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
25 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
26 ** This is really dangerous. I hope that I was careful enough, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
27 ** but maybe there is some malformed address possible that causes |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
28 ** this to segfault or be caught in endless loops. |
0 | 29 |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
30 ** If you find something like that, PLEASE mail the string to me |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
31 ** (no matter how idiotic it is), so that I can debug that. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
32 ** Those things really should not happen. |
0 | 33 */ |
34 | |
35 static gchar *specials = "()<>@,;:\\\".[]`"; | |
36 | |
37 char *parse_error = NULL; | |
38 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
39 static gchar* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
40 skip_comment(gchar *p) |
0 | 41 { |
42 | |
43 #ifdef PARSE_TEST | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
44 g_print("skip_comment: %s\n", p); |
0 | 45 #endif |
46 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
47 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
48 while (*p && *p != ')') { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
49 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
50 if (*p == '(') { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
51 p = skip_comment(p); |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
52 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
53 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
54 p++; |
0 | 55 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
56 return p; |
0 | 57 } |
58 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
59 static gboolean |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
60 read_word(gchar *p, gchar **b, gchar **e) |
0 | 61 { |
62 #ifdef PARSE_TEST | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
63 g_print("read_word: %s\n", p); |
0 | 64 #endif |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
65 /* eat leading spaces */ |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
66 while (*p && isspace(*p)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
67 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
68 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
69 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
70 *b = p; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
71 /* b = &p; */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
72 if (*p == '\"') { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
73 /* quoted-string */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
74 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
75 while (*p && (*p != '\"')) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
76 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
77 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
78 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
79 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
80 /* atom */ |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
81 while (*p && !strchr(specials, *p) && !iscntrl(*p) && !isspace(*p)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
82 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
83 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
84 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
85 *e = p; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
86 return TRUE; |
0 | 87 } |
88 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
89 static gboolean |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
90 read_word_with_dots(gchar *p, gchar **b, gchar **e) |
0 | 91 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
92 gchar *b0 = p; |
0 | 93 |
94 #ifdef PARSE_TEST | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
95 g_print("read_word_with_dots: %s\n", p); |
0 | 96 #endif |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
97 while (TRUE) { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
98 if (!read_word(p, b, e)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
99 return FALSE; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
100 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
101 p = *e; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
102 if (*p != '.') { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
103 break; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
104 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
105 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
106 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
107 *b = b0; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
108 *e = p; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
109 return TRUE; |
0 | 110 } |
111 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
112 static gboolean |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
113 read_domain(gchar *p, gchar **b, gchar **e) |
0 | 114 { |
115 #ifdef PARSE_TEST | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
116 g_print("read_domain: %s\n", p); |
0 | 117 #endif |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
118 *b = p; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
119 if (*p != '[') { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
120 while (isalnum(*p) || (*p == '-') || (*p == '.')) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
121 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
122 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
123 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
124 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
125 while (isalpha(*p) || (*p == '.')) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
126 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
127 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
128 if (*p != ']') { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
129 parse_error = g_strdup_printf("']' expected at end of literal address %s", *b); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
130 return FALSE; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
131 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
132 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
133 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
134 *e = p; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
135 return TRUE; |
0 | 136 } |
137 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
138 gboolean |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
139 parse_address_rfc822(gchar *string, gchar **local_begin, gchar **local_end, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
140 gchar **domain_begin, gchar **domain_end, gchar **address_end) |
0 | 141 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
142 gint angle_brackets = 0; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
143 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
144 gchar *p = string; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
145 gchar *b, *e; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
146 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
147 *local_begin = *local_end = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
148 *domain_begin = *domain_end = NULL; |
0 | 149 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
150 /* might be some memory left from previous call: */ |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
151 if (parse_error) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
152 g_free(parse_error); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
153 parse_error = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
154 } |
0 | 155 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
156 /* leading spaces and angle brackets */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
157 while (*p && (isspace(*p) || (*p == '<'))) { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
158 if (*p == '<') { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
159 angle_brackets++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
160 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
161 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
162 } |
0 | 163 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
164 if (!*p) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
165 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
166 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
167 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
168 while (TRUE) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
169 if (!read_word_with_dots(p, &b, &e)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
170 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
171 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
172 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
173 p = e; |
0 | 174 #ifdef PARSE_TEST |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
175 g_print("after read_word_with_dots: %s\n", p); |
0 | 176 #endif |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
177 /* eat white spaces and comments */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
178 while ((*p && (isspace(*p))) || (*p == '(')) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
179 if (*p == '(') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
180 if (!(p = skip_comment(p))) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
181 parse_error = g_strdup("missing right bracket ')'"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
182 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
183 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
184 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
185 p++; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
186 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
187 } |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
188 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
189 ** we now have a non-space char that is not |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
190 ** the beginning of a comment |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
191 */ |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
192 |
274
89199eda6144
fixed `To: alice, bob' with -t
markus schnalke <meillo@marmaro.de>
parents:
273
diff
changeset
|
193 if (*p == '@' || *p == ',') { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
194 /* the last word was the local_part of an addr-spec */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
195 *local_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
196 *local_end = e; |
0 | 197 #ifdef PARSE_TEST |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
198 g_print("found local part: %s\n", *local_begin); |
0 | 199 #endif |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
200 if (*p == '@') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
201 p++; /* skip @ */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
202 /* now the domain */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
203 if (!read_domain(p, &b, &e)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
204 return FALSE; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
205 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
206 p = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
207 *domain_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
208 *domain_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
209 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
210 /* unqualified? */ |
274
89199eda6144
fixed `To: alice, bob' with -t
markus schnalke <meillo@marmaro.de>
parents:
273
diff
changeset
|
211 /* something like `To: alice, bob' with -t */ |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
212 *domain_begin = *domain_end = NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
213 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
214 break; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
215 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
216 } else if (*p == '<') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
217 /* addr-spec follows */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
218 while (isspace(*p) || (*p == '<')) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
219 if (*p == '<') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
220 angle_brackets++; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
221 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
222 p++; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
223 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
224 if (!read_word_with_dots(p, &b, &e)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
225 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
226 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
227 p = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
228 *local_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
229 *local_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
230 #ifdef PARSE_TEST |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
231 g_print("found local part: %s\n", *local_begin); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
232 #endif |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
233 if (*p == '@') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
234 p++; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
235 if (!read_domain(p, &b, &e)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
236 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
237 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
238 p = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
239 *domain_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
240 *domain_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
241 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
242 /* may be unqualified address */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
243 *domain_begin = *domain_end = NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
244 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
245 break; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
246 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
247 } else if (!*p || *p == '>') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
248 *local_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
249 *local_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
250 #ifdef PARSE_TEST |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
251 g_print("found local part: %s\n", *local_begin); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
252 #endif |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
253 *domain_begin = *domain_end = NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
254 break; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
255 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
256 } else if (strchr(specials, *p) || iscntrl(*p) || isspace(*p)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
257 parse_error = g_strdup_printf("unexpected character: %c", *p); |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
258 #ifdef PARSE_TEST |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
259 g_print("unexpected character: %c", *p); |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
260 #endif |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
261 return FALSE; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
262 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
263 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
264 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
265 /* trailing spaces and angle brackets */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
266 #ifdef PARSE_TEST |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
267 g_print("down counting trailing '>'\n"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
268 #endif |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
269 while (*p && (isspace(*p) || (*p == '>'))) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
270 if (*p == '>') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
271 angle_brackets--; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
272 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
273 p++; |
0 | 274 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
275 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
276 *address_end = p; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
277 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
278 if (angle_brackets > 0) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
279 parse_error = g_strdup("missing '>' at end of string"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
280 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
281 } else if (angle_brackets < 0) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
282 parse_error = g_strdup("superfluous '>' at end of string"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
283 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
284 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
285 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
286 /* we successfully parsed the address */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
287 return TRUE; |
0 | 288 } |
289 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
290 gboolean |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
291 parse_address_rfc821(gchar *string, gchar **local_begin, gchar **local_end, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
292 gchar **domain_begin, gchar **domain_end, gchar **address_end) |
0 | 293 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
294 gint angle_brackets = 0; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
295 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
296 gchar *p = string; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
297 gchar *b, *e; |
0 | 298 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
299 *local_begin = *local_end = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
300 *domain_begin = *domain_end = NULL; |
0 | 301 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
302 /* might be some memory left from previous call: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
303 if (parse_error != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
304 g_free(parse_error); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
305 parse_error = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
306 } |
0 | 307 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
308 /* leading spaces and angle brackets */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
309 while (*p && (isspace(*p) || (*p == '<'))) { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
310 if (*p == '<') { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
311 angle_brackets++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
312 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
313 p++; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
314 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
315 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
316 if (!*p) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
317 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
318 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
319 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
320 while (TRUE) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
321 if (!read_word_with_dots(p, &b, &e)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
322 return FALSE; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
323 } |
0 | 324 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
325 p = e; |
0 | 326 #ifdef PARSE_TEST |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
327 g_print("after read_word_with_dots: %s\n", p); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
328 #endif |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
329 *local_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
330 *local_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
331 #ifdef PARSE_TEST |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
332 g_print("found local part: %s\n", *local_begin); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
333 g_print("local_end = %s\n", *local_end); |
0 | 334 #endif |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
335 if (!(*p) || isspace(*p) || (*p == '>')) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
336 /* unqualified ? */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
337 domain_begin = domain_end = NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
338 break; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
339 } else if (*p == '@') { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
340 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
341 if (read_domain(p, &b, &e)) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
342 p = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
343 *domain_begin = b; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
344 *domain_end = e; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
345 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
346 break; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
347 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
348 parse_error = g_strdup_printf ("unexpected character after local part '%c'", *p); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
349 return FALSE; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
350 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
351 } |
0 | 352 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
353 /* trailing spaces and angle brackets */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
354 #ifdef PARSE_TEST |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
355 g_print("down counting trailing '>'\n"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
356 #endif |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
357 while (*p && (isspace(*p) || (*p == '>'))) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
358 if (*p == '>') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
359 angle_brackets--; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
360 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
361 p++; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
362 } |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
363 *address_end = p; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
364 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
365 if (angle_brackets > 0) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
366 parse_error = g_strdup("missing '>' at end of string"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
367 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
368 } else if (angle_brackets < 0) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
369 parse_error = g_strdup("superfluous '>' at end of string"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
370 return FALSE; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
371 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
372 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
373 /* we successfully parsed the address */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
374 return TRUE; |
0 | 375 } |
376 | |
377 /* | |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
378 ** allocate address, reading from string. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
379 ** On failure, returns NULL. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
380 ** after call, end contains a pointer to the end of the parsed string |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
381 ** end may be NULL, if we are not interested. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
382 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
383 ** parses both rfc 821 and rfc 822 addresses, depending on flag is_rfc821 |
0 | 384 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
385 address* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
386 _create_address(gchar *string, gchar **end, gboolean is_rfc821) |
0 | 387 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
388 gchar *loc_beg, *loc_end; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
389 gchar *dom_beg, *dom_end; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
390 gchar *addr_end; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
391 gboolean ret; |
0 | 392 |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
393 /* TODO: what about (string == NULL)? */ |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
394 if (string && (string[0] == '\0')) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
395 address *addr = g_malloc(sizeof(address)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
396 addr->address = g_strdup(""); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
397 addr->local_part = g_strdup(""); |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
398 /* 'NULL' address (failure notice), |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
399 "" makes sure it will not be qualified with a hostname */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
400 addr->domain = g_strdup(""); |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
401 return addr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
402 } |
0 | 403 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
404 if (is_rfc821) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
405 ret = parse_address_rfc821(string, &loc_beg, &loc_end, &dom_beg, &dom_end, &addr_end); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
406 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
407 ret = parse_address_rfc822(string, &loc_beg, &loc_end, &dom_beg, &dom_end, &addr_end); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
408 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
409 if (!ret) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
410 return NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
411 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
412 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
413 address *addr = g_malloc(sizeof(address)); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
414 gchar *p = addr_end; |
0 | 415 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
416 memset(addr, 0, sizeof(address)); |
0 | 417 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
418 if (loc_beg[0] == '|') { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
419 parse_error = g_strdup("no pipe allowed for RFC 822/821 address"); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
420 return NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
421 } |
0 | 422 |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
423 while (*p && (*p != ',')) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
424 p++; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
425 } |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
426 addr->address = g_strndup(string, p - string); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
427 addr->local_part = g_strndup(loc_beg, loc_end - loc_beg); |
0 | 428 |
429 #ifdef PARSE_TEST | |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
430 g_print("addr->local_part = %s\n", addr->local_part); |
0 | 431 #endif |
432 | |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
433 if (dom_beg != NULL) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
434 addr->domain = g_strndup(dom_beg, dom_end - dom_beg); |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
435 } else if (addr->local_part[0] == '\0') { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
436 /* 'NULL' address (failure notice), |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
437 "" makes sure it will not be qualified with a hostname */ |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
438 addr->domain = g_strdup(""); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
439 } else { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
440 addr->domain = NULL; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
441 } |
0 | 442 |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
443 if (end) { |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
444 *end = p; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
445 } |
0 | 446 |
447 #ifndef PARSE_TEST | |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
448 addr_unmark_delivered(addr); |
0 | 449 #endif |
450 | |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
451 return addr; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
452 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
453 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
454 address* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
455 create_address_rfc822(gchar *string, gchar **end) |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
456 { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
457 return _create_address(string, end, FALSE); |
0 | 458 } |
459 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
460 address* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
461 create_address_rfc821(gchar *string, gchar **end) |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
462 { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
463 return _create_address(string, end, TRUE); |
0 | 464 } |
465 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
466 GList* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
274
diff
changeset
|
467 addr_list_append_rfc822(GList *addr_list, gchar *string, gchar *domain) |
0 | 468 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
469 gchar *p = string; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
470 gchar *end; |
0 | 471 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
472 while (*p) { |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
473 #ifdef PARSE_TEST |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
474 g_print("string: %s\n", p); |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
475 #endif |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
476 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
477 address *addr = _create_address(p, &end, FALSE); |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
478 if (!addr) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
479 break; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
480 } |
0 | 481 |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
482 #ifdef PARSE_TEST |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
483 g_print("addr: %s (%s<@>%s)", addr->address, addr->local_part, addr->domain); |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
484 #endif |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
485 if (domain && !addr->domain) { |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
486 addr->domain = g_strdup(domain); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
487 } |
273
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
488 #ifdef PARSE_TEST |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
489 g_print(" (%s<@>%s)\n", addr->local_part, addr->domain); |
00724782b6c9
parse.c: comments, better debugging, tiny refactoring
markus schnalke <meillo@marmaro.de>
parents:
271
diff
changeset
|
490 #endif |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
491 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
492 addr_list = g_list_append(addr_list, addr); |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
493 p = end; |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
494 |
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
495 while (*p == ',' || isspace(*p)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
496 p++; |
271
899175e8dff0
heavy refactoring in the small of parse.c
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
497 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
498 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
499 return addr_list; |
0 | 500 } |