| 760 | } |
| 761 | |
| 762 | int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term) |
| 763 | { |
| 764 | strbuf_reset(sb); |
| 765 | |
| 766 | while (1) { |
| 767 | char ch; |
| 768 | ssize_t len = xread(fd, &ch, 1); |
| 769 | if (len <= 0) |
| 770 | return EOF; |
| 771 | strbuf_addch(sb, ch); |
| 772 | if (ch == term) |
| 773 | break; |
| 774 | } |
| 775 | return 0; |
| 776 | } |
| 777 | |
| 778 | ssize_t strbuf_read_file(struct strbuf *sb, const char *path, size_t hint) |
| 779 | { |
no test coverage detected