17 size_t (*read)(void *buf, size_t size, void *handle);
18 int (*seek)(void *handle, long offset, int whence);
19 long (*tell)(void *handle);
20 int (*eof) (void *handle);
23 struct lbx_pipe_state {
28 /* Default I/O operations for ordinary files. */
29 extern const struct lbx_file_ops lbx_default_fops;
31 /* I/O operations for un-seekable files (e.g. pipes). */
32 extern const struct lbx_file_ops lbx_pipe_fops;
35 typedef struct lbx_state LBX;
36 typedef struct lbx_file_state LBXfile;
43 /* Archive operations */
44 LBX *lbx_open(void *handle, const struct lbx_file_ops *fops,
45 int (*destructor)(void *handle), const char *name);
46 LBX *lbx_fopen(FILE *, const char *);
47 LBX *lbx_mopen(void *, size_t, const char *);
49 size_t lbx_numfiles(LBX *);
52 int lbx_stat(LBX *, size_t, struct lbx_statbuf *);
54 LBXfile *lbx_file_open(LBX *lbx, unsigned fileno);
55 size_t lbx_file_read(LBXfile *f, void *buf, size_t n);
56 int lbx_file_seek(LBXfile *f, long offset, int whence);
57 long lbx_file_tell(LBXfile *f);
58 int lbx_file_eof(LBXfile *f);
59 void lbx_file_close(LBXfile *f);
62 const char *lbx_strerror(void);