MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/string/blank_line/main.cpp:7–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#endif
6
7int 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

Callers

nothing calls this directly

Calls 7

freeFunction · 0.85
find_blank_lineMethod · 0.80
substrMethod · 0.80
clearMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…