| 5 | #endif |
| 6 | |
| 7 | int main(void) |
| 8 | { |
| 9 | char* s = strdup("aaa\r\n\r\n" |
| 10 | "bbb\r\n\n" |
| 11 | "ccc\n\r\n" |
| 12 | "ddd\n\n" |
| 13 | "eee\r\n" |
| 14 | "fff\n" |
| 15 | "ggg\r\n\r\r\n" |
| 16 | "hhh\r\r\r\n\r\n" |
| 17 | "iii\r\n"); |
| 18 | char* ptr = s; |
| 19 | acl::string buf; |
| 20 | acl::string head; |
| 21 | int nleft; |
| 22 | |
| 23 | std::vector<acl::string> first; |
| 24 | |
| 25 | while (*ptr != 0) |
| 26 | { |
| 27 | buf += *ptr; |
| 28 | |
| 29 | head.clear(); |
| 30 | int offset = buf.find_blank_line(&nleft, &head); |
| 31 | if (offset > 0) |
| 32 | { |
| 33 | printf("ok, findit, offset: %d, offset: %d, " |
| 34 | "header: [%s]\r\n", |
| 35 | offset, nleft, head.c_str()); |
| 36 | first.push_back(head); |
| 37 | } |
| 38 | ptr++; |
| 39 | } |
| 40 | |
| 41 | printf("-------------------------------------------------------\r\n"); |
| 42 | |
| 43 | buf.find_reset(); |
| 44 | printf("total len: %d\r\n", (int) buf.length()); |
| 45 | |
| 46 | std::vector<acl::string> second; |
| 47 | |
| 48 | while (true) |
| 49 | { |
| 50 | head.clear(); |
| 51 | int offset = buf.find_blank_line(&nleft, &head); |
| 52 | if (offset > 0) |
| 53 | { |
| 54 | printf("ok, findit, offset: %d, nleft: %d, len: %d," |
| 55 | " header: [%s]\r\n", offset, nleft, |
| 56 | (int) head.length(), head.c_str()); |
| 57 | second.push_back(head); |
| 58 | } |
| 59 | if (nleft == 0) |
| 60 | break; |
| 61 | } |
| 62 | |
| 63 | printf("-------------------------------------------------------\r\n"); |
| 64 |
nothing calls this directly
no test coverage detected
searching dependent graphs…