summaryrefslogtreecommitdiff
path: root/tools/libskrewt.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-11-22 18:31:19 -0800
committerJohn Denker <jsd@av8n.com>2012-11-22 18:31:19 -0800
commit9d13c14fe5ad5dff32c09b1c5c13af9518b3e727 (patch)
treed6396cc9e5c38fb27a4a215792d816acc72897a0 /tools/libskrewt.c
parent33981cf1aba48b7589fbdc685eeaa8a52ece8c4f (diff)
separate parsing headers from dumping headers
Diffstat (limited to 'tools/libskrewt.c')
-rw-r--r--tools/libskrewt.c15
1 files changed, 11 insertions, 4 deletions
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<string>::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);