2 ** Copyright 2001 Double Precision, Inc.
3 ** See COPYING for distribution information.
10 #include "rfc822hdr.h"
12 static const char rcsid
[]="$Id: rfc822hdr.c,v 1.1 2001/08/12 15:42:02 mrsam Exp $";
15 ** Read the next mail header.
18 int rfc822hdr_read(struct rfc822hdr
*h
, FILE *f
, off_t
*pos
, off_t epos
)
27 size_t hn
=h
->hdrsize
+ 1024;
28 char *p
= h
->header
? realloc(h
->header
, hn
):
38 if (pos
&& *pos
>= epos
)
69 if (c
== '\n' || c
== '\r' ||
70 !isspace((int)(unsigned char)c
))
77 if (h
->maxsize
&& n
+ 2 > h
->maxsize
)
89 for (h
->value
=h
->header
; *h
->value
; ++h
->value
)
95 isspace((int)(unsigned char)*h
->value
))
103 void rfc822hdr_fixname(struct rfc822hdr
*h
)
107 for (p
=h
->header
; *p
; p
++)
109 *p
=tolower((int)(unsigned char)*p
);
113 void rfc822hdr_collapse(struct rfc822hdr
*h
)
117 for (p
=q
=h
->value
; *p
; )
121 while (*p
&& isspace((int)(unsigned char)*p
))