Still working out parsing buffer stuff.

This commit is contained in:
Brad Arant committed 2025-12-18 15:40:37 -08:00
1 parent ccfab5aecf
commit d415e0abd3
2 files changed
+23 -8

No files matched your search

+19 -7
View File
@@ -7,14 +7,26 @@ namespace coreutils {
IMFHeader::IMFHeader(int fd) {}
virtual int parse() {
char ch;
int rc = ::read(fd, &ch, 1);
while(ch != '\r') {
IMFHeaderField *headerField = new IMFHeaderField(ch, fd);
headers.push_back(headerField);
virtual int parse() {
switch(state) {
case NAME:
name << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-0123456789");
if(buffer.ifNext(":"))
state = FIELD;
else
return 2;
case FIELD:
field << buffer.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-;'\"0123456789");
if(!buffer.ifNext("\r\n"))
if(buffer.eod())
return 2;
// Right here is where we should check if next line is an extension to the previous line.
}
rc = ::read(fd, &ch, 1);
}
}