Go to the documentation of this file.
51 size_t needed = length + 1;
53 br->
buf = realloc(br->
buf, needed);
66 FILE *
file = fopen(filepath,
"rb");
68 LOG(failureLevel, failureMessage, filepath, strerror(errno));
75 fseek(
file, 0L, SEEK_END);
77 fseek(
file, 0, SEEK_SET);
128 size_t cp =
MIN(length, (
size_t)(newline - curr + 1));
130 strncpy(buffer, curr, cp);
133 strncpy(buffer, curr, length);
int mtar_read_data(mtar_t *tar, void *ptr, unsigned size)
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
void bufferreader_init_from_tar_file(BufferReader *br, mtar_t *tar, mtar_header_t *h)
char * bufferreader_get_line(BufferReader *br, char *buffer, size_t length)
char * bufferreader_next_line(BufferReader *br)
size_t bufferreader_current_line(BufferReader *br)
BufferReader * bufferreader_init_from_memory(BufferReader *br, const char *data, size_t length)
BufferReader * bufferreader_create()
void fatal(enum fatal_error err)
size_t bufferreader_data_length(BufferReader *br)
void LOG(LogLevel logLevel, const char *format,...)
void bufferreader_destroy(BufferReader *br)
char * bufferreader_data(BufferReader *br)
static void bufferreader_init_for_length(BufferReader *br, size_t length)