aboutsummaryrefslogtreecommitdiffstats
path: root/rfc822.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-01-21 20:09:24 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-01-21 20:09:24 +0000
commit717ac4a0da4497e262d111b2272461cf4d98322c (patch)
treeca2a59035555382168a5cf4e5f636f113402dbae /rfc822.c
parent5bf5d6bbc5974b4bb906706316313e146f7cfd95 (diff)
downloadfetchmail-717ac4a0da4497e262d111b2272461cf4d98322c.tar.gz
fetchmail-717ac4a0da4497e262d111b2272461cf4d98322c.tar.bz2
fetchmail-717ac4a0da4497e262d111b2272461cf4d98322c.zip
Improved rewrite.
svn path=/trunk/; revision=796
Diffstat (limited to 'rfc822.c')
-rw-r--r--rfc822.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/rfc822.c b/rfc822.c
index efdbcfd8..43aad408 100644
--- a/rfc822.c
+++ b/rfc822.c
@@ -43,24 +43,27 @@ const char *host; /* server hostname */
printf("state %d: %s", state, mycopy);
printf("%*s^\n", from - mycopy + 10, " ");
#endif /* TESTMAIN */
- if (*from == '(')
- ++parendepth;
- else if (*from == ')')
- --parendepth;
+ if (state != 2)
+ if (*from == '(')
+ ++parendepth;
+ else if (*from == ')')
+ --parendepth;
if (!parendepth && !has_host_part)
switch (state)
{
- case 0: /* before header colon */
+ case 0: /* before header colon */
if (*from == ':')
state = 1;
break;
- case 1: /* we've seen the colon, we're looking for addresses */
+ case 1: /* we've seen the colon, we're looking for addresses */
if (*from == '<')
- state = 2;
+ state = 3;
else if (*from == '@')
has_host_part = TRUE;
+ else if (*from == '"')
+ state = 2;
else if ((*from == ',' || HEADER_END(from)) && !has_host_part)
{
while (isspace(*from))
@@ -76,7 +79,12 @@ const char *host; /* server hostname */
}
break;
- case 2: /* we're in a <>-enclosed address */
+ case 2: /* we're in a string */
+ if (*from == '"')
+ state = 1;
+ break;
+
+ case 3: /* we're in a <>-enclosed address */
if (*from == '@')
has_host_part = TRUE;
else if (*from == '>' && !has_host_part)