29 lines
496 B
C++
29 lines
496 B
C++
#include "IMFText.h"
|
|
#include <unistd.h>
|
|
|
|
namespace coreutils {
|
|
|
|
IMFText::IMFText(int fd, ZString boundary) : MString() {
|
|
int ch = 0;
|
|
int rc = 0;
|
|
char *endcursor;
|
|
char *index = boundary.getData();
|
|
|
|
while(1) {
|
|
rc = ::read(fd, &ch, 1);
|
|
if(ch == *index) {
|
|
++index;
|
|
ZString check(index, index - endcursor);
|
|
if(check == boundary) {
|
|
break;
|
|
}
|
|
} else {
|
|
endcursor = index;
|
|
}
|
|
write(ch);
|
|
}
|
|
|
|
}
|
|
|
|
}
|