28 lines
481 B
C++
28 lines
481 B
C++
#include "IMFText.h"
|
|
#include <unistd.h>
|
|
|
|
namespace coreutils {
|
|
|
|
IMFText::IMFText(int fd, ZString boundary) : MString() {
|
|
char ch = 0;
|
|
int rc = 0;
|
|
boundary.reset();
|
|
int blen = boundary.getLength() + 1;
|
|
|
|
while(1) {
|
|
rc = ::read(fd, &ch, 1);
|
|
if(boundary.nextChar() == ch) {
|
|
if(boundary.eod()) {
|
|
length -= blen;
|
|
break;
|
|
}
|
|
} else {
|
|
boundary.reset();
|
|
}
|
|
write(ch);
|
|
}
|
|
|
|
}
|
|
|
|
}
|