mime-printdoc.cc (1992B)
1 /* -*- Mode: c++; -*- */ 2 /* -------------------------------------------------------------------- 3 * Filename: 4 * mime-printdoc.cc 5 * 6 * Description: 7 * Implementation of main mime parser components 8 * 9 * Authors: 10 * Andreas Aardal Hanssen <andreas-binc curly bincimap spot org> 11 * 12 * Bugs: 13 * 14 * ChangeLog: 15 * 16 * -------------------------------------------------------------------- 17 * Copyright 2002-2005 Andreas Aardal Hanssen 18 * 19 * This program is free software; you can redistribute it and/or modify 20 * it under the terms of the GNU General Public License as published by 21 * the Free Software Foundation; either version 2 of the License, or 22 * (at your option) any later version. 23 * 24 * This program is distributed in the hope that it will be useful, 25 * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 * GNU General Public License for more details. 28 * 29 * You should have received a copy of the GNU General Public License 30 * along with this program; if not, write to the Free Software 31 * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. 32 * -------------------------------------------------------------------- 33 */ 34 #ifdef HAVE_CONFIG_H 35 #include <config.h> 36 #endif 37 38 #include "mime.h" 39 #include "mime-utils.h" 40 #include "convert.h" 41 #include "io.h" 42 #include <string> 43 #include <vector> 44 #include <map> 45 #include <exception> 46 #include <iostream> 47 48 #include <string.h> 49 #include <ctype.h> 50 #include <stdio.h> 51 #include <errno.h> 52 53 using namespace ::std; 54 55 //------------------------------------------------------------------------ 56 void Binc::MimePart::printDoc(int fd, IO &output, unsigned int startoffset, 57 unsigned int length) const 58 { 59 if (crlffile != fd) { 60 crlffile = fd; 61 crlfoffset = 1; 62 crlfSeek(0); 63 } 64 65 crlfSeek(startoffset); 66 67 char c; 68 for (unsigned int i = 0; i < length; ++i) { 69 if (!crlfGetChar(c)) 70 break; 71 72 output << (char)c; 73 } 74 }