return NULL;
}
-struct lbx_state *lbx_open(const char *path)
-{
- struct lbx_state *new = NULL;
- FILE *f;
-
- if ((f = fopen(path, "rb"))) {
- const char *name = strrchr(path, '/');
- new = lbx_fopen(f, name ? name+1 : path);
- } else {
- lbx_errno = -errno;
- }
-
- return new;
-}
-
size_t lbx_numfiles(struct lbx_state *lbx)
{
return lbx->nfiles;
return mapping + base;
}
-void lbx_close(struct lbx_state *lbx)
+int lbx_close(struct lbx_state *lbx)
{
- if (!lbx) return;
+ int rc = 0;
+
+ if (!lbx)
+ return 0;
if (lbx->f) {
- fclose(lbx->f);
+ rc = fclose(lbx->f);
if (lbx->mem) {
munmap(lbx->mem, lbx->memsize);
}
}
free(lbx);
+ return rc;
}
const char *lbx_strerror(void)