From 9d13c14fe5ad5dff32c09b1c5c13af9518b3e727 Mon Sep 17 00:00:00 2001 From: John Denker Date: Thu, 22 Nov 2012 18:31:19 -0800 Subject: separate parsing headers from dumping headers --- tools/libskrewt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tools/libskrewt.c') diff --git a/tools/libskrewt.c b/tools/libskrewt.c index fb1cd4a..68fe741 100644 --- a/tools/libskrewt.c +++ b/tools/libskrewt.c @@ -85,7 +85,7 @@ int skrewt::krunch_rfrom(){ return 0; } -int skrewt::headers(istream& xin, std::ostream& xout){ +int skrewt::headers(istream& xin){ //xxxx cerr << progid << " begins" << endl; for (;;){ // outer loop over all records in the header if (xin.eof()) break; @@ -99,7 +99,6 @@ int skrewt::headers(istream& xin, std::ostream& xout){ cerr << progid << " rejection: bigger than " << maxsize << endl; exeunt(ex_spam); } - xout << line << endl; bigbuf.push_back(line); string headrec = noCR(line); // for a folded record, this is the first line @@ -118,7 +117,6 @@ int skrewt::headers(istream& xin, std::ostream& xout){ cerr << progid << " rejection: bigger than " << maxsize << endl; exeunt(ex_spam); } - xout << line << endl; bigbuf.push_back(line); headrec += "\n" + noCR(line); } @@ -161,7 +159,6 @@ int skrewt::headers(istream& xin, std::ostream& xout){ } else if (headword == "delivered-to") { delivered_to = rest; } - //xxxx xout << headrec.length() << " ... "; recno++; if (0) if (recno <= 6) cerr << progid << "#" << recno << " " << headrec << endl; @@ -169,6 +166,14 @@ int skrewt::headers(istream& xin, std::ostream& xout){ return 0; } +int skrewt::dump_headers(std::ostream& xout){ + for (vector::const_iterator foo = bigbuf.begin(); + foo != bigbuf.end(); foo++){ + xout << *foo << endl; + } + return 0; +} + int skrewt::interstage(){ if (saw_blank_line) {/* ignore */} // Note that the headers are in reverse-chronological order: @@ -347,6 +352,8 @@ int skrewt::body(std::istream& xin, std::ostream& xout){ // early-stage thinking has been done. // Now spew the rest of the message +// Note that multipart messages can have sub-headers. + //xxxx cerr << "body begins: " << main_contype << " " << currently_text << " " << boundary << endl; int in_subheads(0); int textlines(0); -- cgit v1.2.3