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

Function acl_vstring_gets_nonl

lib_acl/src/stdlib/acl_vstring_vstream.c:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34/* acl_vstring_gets_nonl - read line from file, strip newline */
35
36int acl_vstring_gets_nonl(ACL_VSTRING *vp, ACL_VSTREAM *fp)
37{
38 int ch, last = 0;
39
40 ACL_VSTRING_RESET(vp);
41 while ((ch = ACL_VSTREAM_GETC(fp)) != ACL_VSTREAM_EOF && ch != '\n') {
42 if (ch == '\r') {
43 last = ch;
44 } else {
45 if (last != 0) {
46 ACL_VSTRING_ADDCH(vp, last);
47 last = 0;
48 }
49 ACL_VSTRING_ADDCH(vp, ch);
50 }
51 }
52 ACL_VSTRING_TERMINATE(vp);
53 return (ch == '\n' ? ch : ACL_VSTRING_GET_RESULT(vp));
54}
55
56/* acl_vstring_gets_null - read null-terminated string from file */
57

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…