File: read.cc

package info (click to toggle)
bobcat 2.08.01-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,668 kB
  • ctags: 953
  • sloc: cpp: 10,403; makefile: 9,042; perl: 401; sh: 195
file content (42 lines) | stat: -rw-r--r-- 1,175 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "mailheaders.ih"

void MailHeaders::read()
{
    static char funName[] = "MailHeaders::read()";

    if (size())
        Errno(funName) << insertable <<
                        "Mail headers already read" << throwable;

    while (true)
    {
        string line;

        if (!getline(d_in, line))               // no more header lines
            Errno(funName) << insertable <<     // is an error condition
                "Headers incomplete after line " << 
                size() << throwable;

        if (line.find_first_not_of(" \t") == string::npos)  // blank line
        {
            resize(size() + 1);                 // last line will be used as
                                                // the search sentinel
            return;
        }

        if (line[0] != ' ' && line[0] != '\t')  // add the new header line
            push_back(line);
        else 
        {
            if (not size())                     // no header yet: error
                Errno(funName) << insertable <<
                "Invalid begin of headers"  << throwable;
            (back() += "\n") += line;           // add line continuation
        }
    }
}