packio-simple

view include/packio.h @ 0:d81c3ae262a0

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 09 Sep 2012 06:05:11 +0300
parents
children eb07de55d0e6
line source
1 #ifndef PACKIO_H_
2 #define PACKIO_H_
4 struct pack_file;
5 struct pack_dir;
7 #define PACK_NAME_MAX 256
9 struct pack_dirent {
10 char d_name[PACK_NAME_MAX];
11 };
13 /* not sure I like this capitalization, but it matches the libc counterparts */
14 typedef struct pack_file PACKFILE;
15 typedef struct pack_dir PACKDIR;
18 int pack_init(void);
19 void pack_cleanup(void);
20 int pack_mount(const char *fname, const char *path);
22 int pack_exists(const char *path);
23 int pack_isfile(const char *path);
24 int pack_isdir(const char *path);
27 /* file i/o */
28 PACKFILE *pack_fopen(const char *path, const char *mode);
29 int pack_fclose(PACKFILE *fp);
31 int pack_feof(PACKFILE *fp);
32 long pack_filesize(PACKFILE *fp);
34 int pack_fseek(PACKFILE *fp, long offs, int whence);
35 long pack_ftell(PACKFILE *fp);
36 void pack_rewind(PACKFILE *fp);
38 size_t pack_fread(void *ptr, size_t size, size_t nmemb, PACKFILE *fp);
39 size_t pack_fwrite(void *ptr, size_t size, size_t nmemb, PACKFILE *fp);
41 int pack_fgetc(PACKFILE *fp);
42 char *pack_fgets(char *buf, int size, PACKFILE *fp);
44 /* directory handling */
45 PACKDIR *pack_opendir(const char *name);
46 int pack_closedir(PACKDIR *dir);
47 struct pack_dirent *pack_readdir(PACKDIR *dir);
50 #endif /* PACKIO_H_ */