comparison src/parse.c @ 367:b27f66555ba8

Reformated multiline comments to have leading asterisks on each line Now we use: /* ** comment */ This makes the indent style simpler, too.
author markus schnalke <meillo@marmaro.de>
date Thu, 20 Oct 2011 10:20:59 +0200
parents 41958685480d
children cff967b2f51e
comparison
equal deleted inserted replaced
366:41958685480d 367:b27f66555ba8
1 /* MasqMail 1 /*
2 Copyright (C) 1999-2001 Oliver Kurth 2 ** MasqMail
3 Copyright (C) 2010 markus schnalke <meillo@marmaro.de> 3 ** Copyright (C) 1999-2001 Oliver Kurth
4 4 ** Copyright (C) 2010 markus schnalke <meillo@marmaro.de>
5 This program is free software; you can redistribute it and/or modify 5 **
6 it under the terms of the GNU General Public License as published by 6 ** This program is free software; you can redistribute it and/or modify
7 the Free Software Foundation; either version 2 of the License, or 7 ** it under the terms of the GNU General Public License as published by
8 (at your option) any later version. 8 ** the Free Software Foundation; either version 2 of the License, or
9 9 ** (at your option) any later version.
10 This program is distributed in the hope that it will be useful, 10 **
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 ** This program is distributed in the hope that it will be useful,
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 GNU General Public License for more details. 13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 ** GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License 15 **
16 along with this program; if not, write to the Free Software 16 ** You should have received a copy of the GNU General Public License
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 19 */
19 20
20 #ifndef PARSE_TEST 21 #ifndef PARSE_TEST
21 #include "masqmail.h" 22 #include "masqmail.h"
22 #endif 23 #endif
23 24
24 /* This is really dangerous. I hope that I was careful enough, 25 /*
25 but maybe there is some malformed address possible that causes 26 ** This is really dangerous. I hope that I was careful enough,
26 this to segfault or be caught in endless loops. 27 ** but maybe there is some malformed address possible that causes
27 28 ** this to segfault or be caught in endless loops.
28 If you find something like that, PLEASE mail the string to me 29
29 (no matter how idiotic it is), so that I can debug that. 30 ** If you find something like that, PLEASE mail the string to me
30 Those things really should not happen. 31 ** (no matter how idiotic it is), so that I can debug that.
32 ** Those things really should not happen.
31 */ 33 */
32 34
33 static gchar *specials = "()<>@,;:\\\".[]`"; 35 static gchar *specials = "()<>@,;:\\\".[]`";
34 36
35 char *parse_error = NULL; 37 char *parse_error = NULL;
132 *e = p; 134 *e = p;
133 return TRUE; 135 return TRUE;
134 } 136 }
135 137
136 gboolean 138 gboolean
137 parse_address_rfc822(gchar *string, gchar **local_begin, gchar **local_end, gchar **domain_begin, 139 parse_address_rfc822(gchar *string, gchar **local_begin, gchar **local_end,
138 gchar **domain_end, gchar **address_end) 140 gchar **domain_begin, gchar **domain_end, gchar **address_end)
139 { 141 {
140 gint angle_brackets = 0; 142 gint angle_brackets = 0;
141 143
142 gchar *p = string; 144 gchar *p = string;
143 gchar *b, *e; 145 gchar *b, *e;
181 } 183 }
182 } else { 184 } else {
183 p++; 185 p++;
184 } 186 }
185 } 187 }
186 /* we now have a non-space char that is not 188 /*
187 the beginning of a comment */ 189 ** we now have a non-space char that is not
190 ** the beginning of a comment
191 */
188 192
189 if (*p == '@' || *p == ',') { 193 if (*p == '@' || *p == ',') {
190 /* the last word was the local_part of an addr-spec */ 194 /* the last word was the local_part of an addr-spec */
191 *local_begin = b; 195 *local_begin = b;
192 *local_end = e; 196 *local_end = e;
282 /* we successfully parsed the address */ 286 /* we successfully parsed the address */
283 return TRUE; 287 return TRUE;
284 } 288 }
285 289
286 gboolean 290 gboolean
287 parse_address_rfc821(gchar *string, gchar **local_begin, gchar **local_end, gchar **domain_begin, 291 parse_address_rfc821(gchar *string, gchar **local_begin, gchar **local_end,
288 gchar **domain_end, gchar **address_end) 292 gchar **domain_begin, gchar **domain_end, gchar **address_end)
289 { 293 {
290 gint angle_brackets = 0; 294 gint angle_brackets = 0;
291 295
292 gchar *p = string; 296 gchar *p = string;
293 gchar *b, *e; 297 gchar *b, *e;
369 /* we successfully parsed the address */ 373 /* we successfully parsed the address */
370 return TRUE; 374 return TRUE;
371 } 375 }
372 376
373 /* 377 /*
374 allocate address, reading from string. 378 ** allocate address, reading from string.
375 On failure, returns NULL. 379 ** On failure, returns NULL.
376 after call, end contains a pointer to the end of the parsed string 380 ** after call, end contains a pointer to the end of the parsed string
377 end may be NULL, if we are not interested. 381 ** end may be NULL, if we are not interested.
378 382 **
379 parses both rfc 821 and rfc 822 addresses, depending on flag is_rfc821 383 ** parses both rfc 821 and rfc 822 addresses, depending on flag is_rfc821
380 */ 384 */
381 address* 385 address*
382 _create_address(gchar *string, gchar **end, gboolean is_rfc821) 386 _create_address(gchar *string, gchar **end, gboolean is_rfc821)
383 { 387 {
384 gchar *loc_beg, *loc_end; 388 gchar *loc_beg, *loc_end;