1#ifndef LINE_BUFFER_H_2#define LINE_BUFFER_H_34#include "strbuf.h"56#define LINE_BUFFER_LEN 1000078struct line_buffer {9char line_buffer[LINE_BUFFER_LEN];10struct strbuf blob_buffer;11FILE *infile;12};13#define LINE_BUFFER_INIT {"", STRBUF_INIT, NULL}1415int buffer_init(struct line_buffer *buf, const char *filename);16int buffer_fdinit(struct line_buffer *buf, int fd);17int buffer_deinit(struct line_buffer *buf);18void buffer_reset(struct line_buffer *buf);1920int buffer_tmpfile_init(struct line_buffer *buf);21FILE *buffer_tmpfile_rewind(struct line_buffer *buf); /* prepare to write. */22long buffer_tmpfile_prepare_to_read(struct line_buffer *buf);2324char *buffer_read_line(struct line_buffer *buf);25char *buffer_read_string(struct line_buffer *buf, uint32_t len);26int buffer_read_char(struct line_buffer *buf);27void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);28void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);29void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);3031#endif