| 34 | /* acl_vstring_gets_nonl - read line from file, strip newline */ |
| 35 | |
| 36 | int 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 | |