diff options
author | John Denker <jsd@av8n.com> | 2012-07-25 13:05:03 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-29 15:32:37 -0700 |
commit | 6e8083ff4ffe3fd2b6d337386637a2b5c1378cf7 (patch) | |
tree | a84885e65a856538acbe925645e1c67195bcb686 /tools/mail-scan.c | |
parent | 02bfae1f87c4693eb00bf943fb24886a5ac47a09 (diff) |
fix a bunch of DOS-CR bugs
Diffstat (limited to 'tools/mail-scan.c')
-rw-r--r-- | tools/mail-scan.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/mail-scan.c b/tools/mail-scan.c index 1ea245f..dc8aa5c 100644 --- a/tools/mail-scan.c +++ b/tools/mail-scan.c @@ -183,6 +183,16 @@ public: } }; +string noCR(const string bar){ + string foo(bar); + int len = foo.length(); + if (len){ + if (foo[len-1] == '\r') { + foo.erase(len-1); + } + } + return foo; +} //////////////////////////////////////////////////////////// int main(int _argc, const char** _argv){ @@ -268,6 +278,7 @@ int main(int _argc, const char** _argv){ return 1; } if (getline(infile, line).fail()) continue; + line = noCR(line); Header.push_back(line); msgsize += line.length()+1; if (msgsize > maxsize) { @@ -335,6 +346,7 @@ int main(int _argc, const char** _argv){ break; } } // end loop over matching records in this file + if (vflag && !foundsome_infile) { cout << *file << endl; didprint++; |