libusual
0.1
|
File access utils. More...
Data Structures | |
struct | MappedFile |
Info about mapped file. More... | |
Typedefs | |
typedef bool(* | procline_cb )(void *arg, const char *line, ssize_t len) |
Signature for per-line callback. | |
Functions | |
void * | load_file (const char *fn, size_t *len_p) |
Read file into memory. | |
bool | foreach_line (const char *fn, procline_cb proc_line, void *arg) |
Loop over lines in file. | |
ssize_t | file_size (const char *fn) |
Get file size. | |
int | map_file (struct MappedFile *m, const char *fname, int rw) _MUSTCHECK |
Map file into memory. | |
void | unmap_file (struct MappedFile *m) |
Unmap previously mapped file. | |
int | getline (char **line_p, size_t *size_p, void *f) |
Compat: Read line from file. |
File access utils.
typedef bool(* procline_cb)(void *arg, const char *line, ssize_t len) |
Signature for per-line callback.
void* load_file | ( | const char * | fn, |
size_t * | len_p | ||
) |
Read file into memory.
bool foreach_line | ( | const char * | fn, |
procline_cb | proc_line, | ||
void * | arg | ||
) |
Loop over lines in file.
ssize_t file_size | ( | const char * | fn | ) |
Get file size.
int map_file | ( | struct MappedFile * | m, |
const char * | fname, | ||
int | rw | ||
) |
Map file into memory.
void unmap_file | ( | struct MappedFile * | m | ) |
Unmap previously mapped file.
int getline | ( | char ** | line_p, |
size_t * | size_p, | ||
void * | f | ||
) |
Compat: Read line from file.