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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/*
driver.cc
*/
#include "driver.h"
#include "../mailheaders"
#include <algorithm>
#include <iterator>
#include <bobcat/errno>
using namespace std;
using namespace FBB;
int main(int argc, char **argv, char **envp)
{
MailHeaders mh(cin, MailHeaders::DONT_READ);
try
{
mh.read();
}
catch (Errno &err)
{
cout << err.what() << endl;
}
mh.setHeaderIterator("Received");
cout << "=================================== All mail headers:\n";
copy(mh.begin(), mh.end(), ostream_iterator<string>(cout, "\n"));
cout << "=============================== First and last but 1 hdr:\n";
cout << mh[0] << endl <<
mh[mh.size() - 2] << endl;
cout << "====================== Received: headers:\n";
copy(mh.beginh(), mh.endh(), ostream_iterator<string>(cout, "\n"));
cout << "====================== Received: headers, reversed order:\n";
copy(mh.rbeginh(), mh.rendh(), ostream_iterator<string>(cout, "\n"));
cout << "====================== all From headers:\n";
mh.setHeaderIterator("From", MailHeaders::PARTIAL);
copy(mh.beginh(), mh.endh(), ostream_iterator<string>(cout, "\n"));
return 0;
}
|