23 char *slash = strrchr(path,
'/');
41 int fd, len, offset = 0;
54 fprintf(stderr,
"ERROR: could not create file in mar_test_callback()\n");
59 fp = fdopen(fd,
"wb");
63 while ((len =
mar_read(mar, item, offset, buf,
sizeof(buf))) > 0) {
64 if (fwrite(buf, len, 1, fp) != 1)
70 return len == 0 ? 0 : -1;
int mar_read(MarFile *mar, const MarItem *item, int offset, char *buf, int bufsize)
Read from MAR item at given offset up to bufsize bytes.
void mar_close(MarFile *mar)
Close a MAR file that was opened using mar_open.
int mar_enum_items(MarFile *mar, MarItemCallback callback, void *closure)
Enumerate all MAR items via callback function.
MarFile * mar_open(const char *path)
Open a MAR file for reading.
The MAR item data structure.