7 size_t (*read)(void *buf, size_t size, void *handle);
8 int (*seek)(void *handle, long offset, int whence);
9 long (*tell)(void *handle);
10 int (*eof) (void *handle);
13 struct lbx_pipe_state {
18 /* Default I/O operations for ordinary files. */
19 extern const struct lbx_file_ops lbx_default_fops;
21 /* I/O operations for un-seekable files (e.g. pipes). */
22 extern const struct lbx_file_ops lbx_pipe_fops;
24 /* I/O operations for LBX archive members. */
25 extern const struct lbx_file_ops lbx_arch_fops;
28 typedef struct lbx_state LBX;
29 typedef struct lbx_file_state LBXfile;
36 /* Archive operations */
37 LBX *lbx_open(void *handle, const struct lbx_file_ops *fops,
38 int (*destructor)(void *handle), const char *name);
39 LBX *lbx_fopen(const char *);
40 LBX *lbx_mopen(void *, size_t, const char *);
42 size_t lbx_numfiles(LBX *);
45 int lbx_file_stat(LBX *lbx, unsigned fileno, struct lbx_statbuf *out);
46 LBXfile *lbx_file_open(LBX *lbx, unsigned fileno);
47 size_t lbx_file_read(LBXfile *f, void *buf, size_t n);
48 int lbx_file_seek(LBXfile *f, long offset, int whence);
49 long lbx_file_tell(LBXfile *f);
50 int lbx_file_eof(LBXfile *f);
51 void lbx_file_close(LBXfile *f);